Hi, I just noticed that Rhino.Geometry.Intersect.Intersection.MeshPlane doesn’t work with Quad Face…
This is my method.
Maybe it help you.
ON_3dPointArray points;
points.Append(StartPt);
points.Append(EndPt);
const ON_MeshTree* mesh_tree = mesh->MeshTree(true);
if (mesh_tree)
{
ON_SimpleArray<ON_CMX_EVENT> cmx;
if (mesh_tree->IntersectPolyline(2, points.Array(), cmx))
{
flag = true;
if( cmx.Count() == 1 )
InterPt_nearestEnd = cmx[0].m_M[0].m_P;
else if( cmx.Count() > 1 )
{
InterPt_nearestEnd = cmx[0].m_M[0].m_P;
double MiniDis = cmx[0].m_M[0].m_P.DistanceTo(EndPt);
double TestDis;
for (int i = 1; i < cmx.Count(); i++)
{
TestDis = cmx[i].m_M[0].m_P.DistanceTo(EndPt);
if( TestDis < MiniDis )
{
MiniDis = TestDis;
InterPt_nearestEnd = cmx[i].m_M[0].m_P;
}
}
}
}
}
Can you post your geometry?
Here it is.
MeshPlaneXX - Copy.gh (4.5 KB)
How about a 3dm file?
MeshPlaneXX.3dm (33.4 KB)
I’ve reported this as a bug.