Dendro Invalid Mesh - Pufferfish Mesh Rebuild Fix

If you have used the Dendro Volume to Mesh component you may have gotten an “Invalid Mesh” on complex outputs. This appears to be a result of mesh vertices being generated out of Dendro that are closer than the minimum tolerances defined in Rhino (possible floating point rounding error).

Saw this mentioned on another post but a quick solution that seems to solve this issue is to use the Pufferfish Rebuild Mesh component with “Merge Vertices” enabled. This fix is pretty computationally efficient compared to other options like using Align Vertices.

Included cluster bypasses the Merge component if the mesh is valid.
Dendro_invalid_mesh_PF-Rebuild.gh (23.0 KB)

5 Likes

Here is a C# component that merges vertices without Pufferfish.

Dendro_invalid_mesh_fix.gh (13.9 KB)

2 Likes

And to link with another discussion

“Simple” C# codes are quite the same, but I made some mistake, so I correct it here
Charlie one

   M.Vertices.CombineIdentical(true, true);
        M.Faces.CullDegenerateFaces();

Mine (corrected)

Mesh result = mesh.DuplicateMesh();
result.Faces.CullDegenerateFaces();
result.Vertices.CombineIdentical(true, true);
result.Vertices.CullUnused();
result.RebuildNormals();
1 Like

Nice, thanks to you and @ryein for the help (if it’s not obvious, I am super rough at C#)

 if (!Mcheck.IsValid)
    {
      Mesh result = Mcheck.DuplicateMesh();
      Mcheck.Vertices.CombineIdentical(true, true);
      Mcheck.Faces.CullDegenerateFaces();
      Mcheck.Vertices.CullUnused();
      Mcheck.RebuildNormals();
    }
    M = Mcheck;

Dendro_invalid_mesh_fix_02.gh (15.4 KB)

1 Like