RS ShootRay on trimmed srfs


#1

Hi list,

I am trying out ShootRay() on some very simple geometry. It seems that the rays intersect the untrimmed srf, which is not what I expect.

The green points are the ray origin, red dots and connecting lines are what ShootRay() gives me as the intersection points:

If I untrim the triangular srf, it becomes obvious that the ray shooter hits trimmed-off parts of the srf:

Bug?

This is on version 5SR12


#2

Oh, and here are the model and script…

shoot_rays.3dm (62.8 KB)

shoot.py (314 Bytes)

Have a good weekend


#3

Hi @axa,

unfortunately that is how it has always been and applies to vbscript, python and rhino common. The helpfile mentions:

Only Surface and Brep objects are currently supported. Trims are ignored on Breps.

Your script looks like you’re only interested in the first reflection point ? Why not intersect with a line or project the points and try to keep the closest one ? Below is an example script using projection and scene based on yours. Note that a projection can hit an object multiple times and goes in two directions…

ShootOneRayCustom.py (1.8 KB)
shoot_rays.3dm (90.7 KB)

c.


Rayshoot not recognizing empty geometry
#4

Hi Clement,

thank for pointing out the limitations of ShootRay(). I tend to work almost exclusively with the rs doclumentation

http://developer.rhino3d.com/api/RhinoScriptSyntax/win/

and was therefore blissfully unaware of this. With the limitations in place (no trimmed Breps, no meshes), ShootRays() is essentially useless for most tasks.

Thank you also for providing a ProjectPointsToBreps() example. Yes, for my particular application, this works very well. I’ve now re-written my code around rs.ProjectPointToSurface().

Have a good week