I try to write a C# component which splits a mesh by a polyline. See attached screenshot and gh file. The mesh does not split correctly. When I pull the curve to the mesh in Rhino and use the pulled curve in the component the spilt is correct. Any idea what the issue could be?
Many thanks for all the answers.
At the end I want to split a non planar mesh. Also I want to use polylines which are connecting the mesh edges. Therfore the idea of SplitMeshByPolyline is what I thought might be the ideal solution. Unfortuantely mesh splitting is still not reliable in Rhino. Even with extruding a mesh as a splitter, I get sometimes problem with not correct splits.
It is the reason I had to develop some tools. Some hundreds of lines of C# code. The main tool localize the intersection on a triangle mesh (work in UV), … I hope to publish this plugin with the dll used, at the end of the year.
R8 has some better Mesh Bolean but I don’t know if it works better for the mesh splitting. I made some tests without being happy.
BTW: If you want to create a “boundary Loop” of Mesh Edges (due to some recursive grow logic: for instance using some guide Poly) then there’s no reason to attempt to Split the Mesh: just use VV Connectivity and get your Mesh(es).
private void RunScript(Mesh mesh, List<Curve> crv, Vector3d direction, ref object A, ref object Meshexploded)
{
if(mesh != null && crv != null){
var tmp = new List < PolylineCurve >();
foreach(var t in crv)
tmp.Add(mesh.PullCurve(Curve.ProjectToMesh(t, mesh, direction, 0.00001)[0], 1e-6)); // where mesh is the mesh, and crv is the curve
Mesh[] splits = mesh.SplitWithProjectedPolylines(tmp, 1e-4);
Meshexploded = splits;}