Where can I find a sample project for RayShoot?

I am actually stuck with the generation of the second argument. I want to put all the visible objects that are in the document. I was thinking to go with
Rhino.DocObjects.ObjectEnumeratorSettings settings = new Rhino.DocObjects.ObjectEnumeratorSettings();
var tmpUniverse = thePanelUserControl.theDoc.Objects.GetObjectList(settings);


  • first I am not sure that’s the right way to list all the objects in the current document (I haven’t found the right keys to look for a sample exposing the right method. Each time I’m looking for it, I find solutions where the user has to click on the faces),
  • second it returns a [Rhino.DocObjects.Tables.ObjectTable.EnumeratorWrapper] and not the IEnumerable required by RayShoot.

You are enumerating Rhino Objects, and Intersection.RayShoot requires an enumerable of GeometryBase. A RhinoObject is basically a “wrapper” around a geometry definition, with more information about its state in the document. To get from the RhinoObject to its geometry, do this:

List<GeometryBase> geometries = new List<GeometryBase>();
foreach(RhinoObject obj in theDoc.Objects.GetObjectList(settings))

Point3d[] rayIntersections = Intersection.RayShoot(ray, geometries, numberOfReflections);

Please note that RayShoot only works on Surfaces and Brep geometries and that trims are ignored (see http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_Geometry_Intersect_Intersection_RayShoot.htm)

Thank you.

(I had seen the limitation of RayShoot)