The RayBounce function is precious when it comes to checking ceiling heights in order to place components, or to check program compliance. But more often than not, the elements needed “to bounce on” are in a linked model, and the OOTB RayBounce node only works with elements from the current document.
So, I took a look at the API and couldn’t find anything called RayBounce. After a little research I, as always, stumbled upon a post from Jeremy Tammik on The Building Coder that pointed me in the right direction: the ReferenceIntersector class. I then came up with the “RayBounce on linked file” node (Data-Shapes Package, code below). Because Revit doesn’t work internally with units other than feet, I had to come up with a unit conversion workaround. Using the Units and UnitUtils class, I was able to retrieve the UI unit type of the current document and convert the data to/from internal API units.
The node is meant to be used in a very similar way to the OOTB RayBounce Node, although I could not find a way to set the amount of bounces (maxBounce). The node will return null values for the points that don’t have an element to bounce on, in order to keep the list structure as similar to the initial one as possible and facilitate data exploitation. I also couldn’t find a way to specify which linked model to perform the RayBouncing on in the API. An easy way to address the problem is to use a 3D view where only the appropriate links are displayed.
I also published a node called “RayBounce on Link Category” (code below) that allows to specify the categories you want your rays to bounce on :
Feel free to comment if you have some improvement ideas. Hope this helps save some time on the job!