My Goal is it to remove Islands from an 3D scanned object (3D printer purpose) with python. I was thinking something like:

  • Getting all vertices
  • Iterate through all vertices
    • Save linked vertices and number of linked vertices
    • Remove all already scanned vertices from iteration
    • Compare with old maxLinked, if lower delete vertices

enter image description here

If someone could point me to a solution it would be great.


Use the Separate into Loose Parts Operator.

Possibly the quickest and simplest way to do this is to run the bpy.ops.mesh.separate(type='LOOSE') operator to split the single mesh into loose parts. Then remove all but the object with the most vertices.

import bpy

context = bpy.context
# edit mode
# split into loose parts
# object mode

parts = context.selected_objects
# sort by number of verts (last has most)
parts.sort(key=lambda o: len(o.data.vertices))
# print
for part in parts:
    print(part.name, len(part.data.vertices))
# pop off the last
# remove the rest
for o in parts:

There are a number of methods for doing this without the operator in answers to How to find the number of loose parts with Python? including my answer which returns a list of verts for each island in selection which would be ideal for making an interactive tool to do this per selection, to clean "splatter-cake" verts.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.