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.
Feel free to comment if you have some improvement ideas. Hope this helps save some time on the job!
Hello. Thank you for the article. I haven’t had luck using the RayBounce nodes. I am getting null returned. Do you have a script I can try using?
I am new to this. i need to place family in revit using X,Y,Z co-ordination… X & Y value got from autocad to excel, for z value based on face i need to place a family. ( For example : like placing lights in ceiling based on autocad X&Y, based on revit model Z value). As of now i got script for placing family using X&Y co-ordination from Autocad to Excel to Dynamo. But for Z, i am not getting how to do. Please someone help to find solution.