Skip to content

How to use to component from meshinspector in python #2945

Answered by Grantim
dhanraj-khatal asked this question in Q&A
Discussion options

You must be logged in to vote

Hello!
Please try this way:

from meshlib import mrmeshpy as mm

# load mesh with several components
mesh = mm.loadMesh("in/path/filename.stl")

# separate components 
components = mm.getAllComponents(mesh)

for i in range(len(components)):
    compMesh = mm.Mesh()
    compMesh.addPartByMask(mesh, components[i])
    mm.saveMesh(compMesh,"component_"+str(i) + ".stl")

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dhanraj-khatal
Comment options

Answer selected by dhanraj-khatal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants