mesh.Split result different in V6 vs V7

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;

Hi @siemen

yes, mesh.Split() was rewritten and we are still improving it. Here more info:

I created RH-63422 to track this.

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Hi @piac,

I wanted to pick this back up today and it seems like it now works even though the youtrack item is still open, thanks a lot! These Mesh.split improvements are awesome.

1 Like