How to ignore SplitDisjointMesh popup

Howdy again!

Have a small issue with a reduction script, i need to reduce meshes by layers, sometimes these layers fail when i run a splitDisjointMesh due to them being a bad object, i don’t know how to automate a mesh repair without user input
Nor can i squeeze around the problem without intervention due to the popup needing user input
The rest of my code works once you have cleared that popup
The code also works if you first do a meshrepair, check the mesh, repair the mesh, then run my script

Ultimately I would rather a way to do a mesh repair on a bad mesh, otherwise it would be fine in the meantime if there is a way to just tell rhino not to disp[lay a popup when the script is run and to continue if it errors

    try:
        bbox_size = BOUNDINGBOX_SIZE
        if rs.IsMesh(exploded_obj):
            mesh = rs.coercemesh(exploded_obj)
            if mesh.IsValid:
                rs.Command('-NoEcho -SplitDisjointMesh -NoEcho -SelNone -SelSmall {} _Enter -Delete'.format(str(bbox_size)))
        else:
            rs.Command('-SelNone -SelSmall {} _Enter -Delete'.format(str(bbox_size)))
        small_bits_removed_obj = rs.ObjectsByLayer(layer)
        
        return small_bits_removed_obj

    except Exception as e:
        print('Error encountered while removing bolts: ', e)
        return exploded_obj

Hi @Lawrence_Mercieca,

Rather than scripting the SplitDisjointMesh command, you might just call Mesh.SplitDisjointPieces.

– Dale

1 Like

oh awesome, that worked great, no annoying popup!