Delete all empty meshes

From The Foundry MODO SDK wiki
Revision as of 10:18, 26 November 2015 by GwynneR (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Delete all meshes in the scene that do not contain any vertexes.

Thanks for the help to Bernd Möller and Ivo!


import modo
scene = modo.Scene()
# write all items that do not contain any vertexes in a list
itemList = [item for item in scene.items(itype='mesh', superType=True) if item.geometry.internalMesh.PointCount() == 0]
print ("Following Meshes have been deleted: " + str(itemList))                                                               # Output the names of the deleted Meshes for the user
scene.removeItems(itemList)                                                                                                  # Delete all meshes that were collected in the list