Hi,
Did something change in mesh.Split from V6 to V7? I’m trying the same code on the same file and get a different result.
I’d like to split this mesh with this surface and returns 2 separate closed meshes
In V6 this works great:
In V7, the exact same code with the same geometry, I get a joined mesh with a seam where the plane was.
210320 MeshSplit.3dm (599.6 KB)
double tolerance = doc.ModelAbsoluteTolerance;
var go = new GetObject();
go.SetCommandPrompt("Select Mesh to split");
go.GeometryFilter = ObjectType.Mesh;
go.Get();
if (go.CommandResult() != Result.Success)
return Result.Failure;
Mesh mesh = go.Object(0).Mesh();
go.SetCommandPrompt("Select plane for splitting");
go.GeometryFilter = ObjectType.Brep;
go.Get();
if (go.CommandResult() != Result.Success)
return Result.Failure;
ObjRef srf = go.Object(0);
List<Mesh> splitmeshes = new List<Mesh>();
var face = srf.Brep().Faces[0];
if (face.IsPlanar(tolerance))
{
face.TryGetPlane(out Plane plane);
var splits = mesh.Split(plane);
foreach (var m in splits)
{
m.FillHoles();
doc.Objects.AddMesh(m);
}
}
doc.Views.Redraw();
return Result.Success;