@AndersDeleuran wrote:
Hi All,
I’m trying to implement this Intersection.MeshRay overload through GHPython (i.e. that return the “faces on mesh that ray intersects”). I think I’ve got it working, but just wanted to check that I’m going about it properly. Calling the overload through IronPython seems a wee bit convoluted this way:
import Rhino as rc from System import Array import clr def meshRayIntersect(mesh,point,vector): """ Intersect a mesh with a ray, including intersected mesh face IDs """ ray = rc.Geometry.Ray3d(point,vector) faceIDs = clr.StrongBox[Array[int]]() rayP = rc.Geometry.Intersect.Intersection.MeshRay(mesh,ray,faceIDs) if rayP: rayPt = ray.PointAt(rayP) faceIDs = list(faceIDs.Value) return rayPt,faceIDs else: return None XPt, XIDs = meshRayIntersect(MyMesh,MyPoint,MyVector)
That is, having to instantiate an
Array
inside aStrongBox
prior to callingrc.Geometry.Intersect.Intersection.MeshRay
just to return the faceIDs. I might be way off hereCheers,
Anders
Posts: 1
Participants: 1