Bug in rs.ExplodeMeshes



I have noticed a small bug in rs.ExplodeMeshes:
The help file states the input parameters are:

Required. String, Guid, or list of Guids. The identifier(s) of the mesh object(s) to explode.

Optional. Boolean. Delete input objects after exploding. The default is not to delete objects (False).

However when passing delete=True, the input meshes are not deleted.

Inspecting the code for rs.ExplodeMeshes shows that the delete parameter is unused. Can this be added in?


I humbly suggest the following change to rs.ExplodeMeshes:

def ExplodeMeshes(mesh_ids, delete=False):
    """Explodes a mesh object, or mesh objects int submeshes. A submesh is a
    collection of mesh faces that are contained within a closed loop of
    unwelded mesh edges. Unwelded mesh edges are where the mesh faces that
    share the edge have unique mesh vertices (not mesh topology vertices)
    at both ends of the edge
      mesh_ids = list of mesh identifiers
      delete[opt] = delete the input meshes
      List of identifiers
    id = rhutil.coerceguid(mesh_ids)
    if id: mesh_ids = [mesh_ids]
    rc = []
    for mesh_id in mesh_ids:
        mesh = rhutil.coercemesh(mesh_id, True)
        if mesh:
            submeshes = mesh.ExplodeAtUnweldedEdges()
            if submeshes:
                for submesh in submeshes:
                    id = scriptcontext.doc.Objects.AddMesh(submesh)
                    if id!=System.Guid.Empty: rc.append(id)
    if rc: scriptcontext.doc.Views.Redraw()
    if delete:
        for id in mesh_ids:
            scriptcontext.doc.Objects.Delete(id, True)
    return rc

with the addition being the 2nd, 3rd and 4th last lines

(Dale Fugier) #3

Hi @wattzie,

Thanks for reporting.


– Dale

(Brian Gillespie) #4

RH-41744 is fixed in the latest Service Release Candidate