RayBounce.ByOriginDirection passes through the geometry

Hi Dynamo Gurus,

currently we’re working on a script whitch should automates positioning of lights in a tunnel structure. We’ve tried to use RayBounce.ByOriginDirection but it seems it doesn’t detect some geometry of the tunnel, see the attachment. On an image Raybounce_right_in_Revit the ray stops on the covering, which is a shared generic model adaptive, but if we move with the height of the origin, we actually need s to by in height 4.5m, the ray pass through the geometry of the tunnel, which is also a shared generic model adaptive and stops on opposite tunnel see the image Raybounce_wrong_in_Revit. It must by an issue or we’re missing something? Has somebody any idea how to resolve this problem? You can download the data HERE!




We will by please for any help.


Lukas, CAD Studio Team

Hi @Lukas,

It may be problem with tunnel geometry. Do you see some double faces?
Element.Geometry and Element.Solids fails here. Check it.

Hi @Vladimir,

thanks for your reply. I think there is no problem with the tunnel geometry. You can’t pick up the whole segment with standard select model element node, that’s because the geometry is created from several shared geometries which represent individual parts of the tunnel structure. If you try to select a model element with clicking on TAB to pick just one-piece part of the structure, everything works fine, see the image bellow. Another strange thing is that, if you try to send the ray just in Z axis, it will find the point on the geometry. It seems that the RayBounce node doesn’t work on some types of geometry curvature.

RayBounce in Z axis direction works fine!? How it’s possible?

Hi, @Lukas!

Well, had a look into your families. First bounce (3.5 height) hits into small wall, which we can get by Element.Geometry node. But only this wall, nothing else. Maybe the problem is that your family is complex, consists of other several families. For test, try to remove all but upeer part of tunnel families, try with 4.5 then. Maybe small walls in Host tunnel parts family are at fist place in list of sub-families, so error of raybounce occures.

Anyway, we can get Element.SubComponents (from Clockwork package) and get all sub-families Element.Geometry. Then just intersect long lines (maybe 20 meters) made by your vectors with solids, and find closest endpoints to start points. Maybe it’ll take more time to run, but we can bypass use of Raybounce than.

If you’ll face any problems, i can help later today.