Mesh.UnweldVertices

Greetings, I have a list of mesh vertices IDs and I would like to unweld mesh at those vertices.
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Mesh_UnweldVertices.htm
Seems like a perfect solution, except I can’t get it to work.
My current mesh is completely welded with no creases, if I unweld it it doesn’t change behavior.
I have read the tips for the method and I did TopologyVertices.TopologyVertexIndex() but the provided list has the wrong indexing no matter how I approach it.

I couldn’t get .UnweldVertices() to work properly, neither in python nor C#
To solve the problem I got topology edges indices for vertices (thankfully they were somewhat ordered) and .UnweldEdge() worked like a charm.
Picking vertices inside rhino on a mesh and using UnweldVertex works flawlessly as well (but is not a solution as I need this automated in gh).

For me it seems to work, however the results are pretty unpredictable!

Since you’re unwelding individual vertices, it has to guess which edges to unweld!

Screenshot 2021-08-28 at 09.26.48

A better approach, depending on what you want to do, would probably be to unweld edges instead.

Here’s an example for unwelding mesh edges:

import Rhino.Geometry as rg

topo_edge_indices = []

for i in range(M.TopologyEdges.Count):
    if M.TopologyEdges.IsEdgeUnwelded(i):
        continue
    line = M.TopologyEdges.EdgeLine(i)
    pt = line.PointAt(0.5)
    rc, _ = C.ClosestPoint(pt, t)
    if rc:
        topo_edge_indices.append(i)

M.UnweldEdge(topo_edge_indices, False)

sub_meshes = list(M.ExplodeAtUnweldedEdges())  # optional

a = sub_meshes

Screenshot 2021-08-28 at 09.43.59

Screenshot 2021-08-28 at 09.51.34

Keep in mind that many Grasshopper components actually don’t seem to respect unwelded edges somehow. A prominent example would be Catmull-Clark Subdivision from Weaverbird.

unweld_edges.gh (7.3 KB)