Extract Disjoint Mesh

If you have a disjoint mesh with 1000s of disjoint pieces, it could be nice to maybe have a utility to extract a single disjoint mesh from it. Current workaround is to run split disjoint mesh, wait for your ‘n’ disjoint meshes to be broken up, deselect which one you wanted, and then join the ‘n’ meshes again.

What do folks think? Python scriptable maybe?

You would click the 1 mesh you want to extract a disjoint piece from, and then select the meshes one by one you wish to extract. For the time being, could just be that you have to pick a face from the mesh that you want to extract. Or, as a command line option under splitdisjointmesh.

Edit - I can see there’s something called Extract Mesh Part! Never knew that!

Perhaps it should be considered being renamed Extract Disjoint Mesh though, for consistency with SplitDisjointMesh.

Hello - yeah, this seems like a reasonable thing - I’ll get it on the list. I can make a script that will work, more or less, but I do not see how to make the workflow very clean, so far at least. I’ll poke some more.
RH-61415 ExtractDisjointMeshPart

Does ExtractMeshPart work in a different way, then, perhaps?

I see now that ExtractConnectedMeshFaces with “greater than” 0 degrees achieves it too, I think? Plus that has a nice extract a copy option. From the help notes: “or to extract set of faces that make up a coherent feature in the mesh.”

Clearly I just hadn’t delved deep enough here.

Yeah - just chatting with the developer - the problem is there is no way to identify the pieces, I believe, without duplicating the whole mesh as multiple pieces that correspond to the disjointness - there is no subobject that corresponds to the disjoint piece. So it may be that we’ll have to do this from the face selection in ExtractMeshPart and simply stop when there are no more faces that can be added. A bit funky workflow wise… to my eye.

@Jonathan_Hutchinson - here is a very hacked together try at a script - see if it does anything good - it might not work very zippety on large meshes…

ExtractDisjointMeshes.py (2.0 KB)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"


1 Like

For now I’ll alias ExtractMeshPart to ExtractDisjointMesh I think. I’m certainly glad it’s a doable operation anyway.