Skip to content

Instantly share code, notes, and snippets.

@ivogrig
Created July 6, 2015 10:03
Show Gist options
  • Save ivogrig/c536eeec36e419e17531 to your computer and use it in GitHub Desktop.
Save ivogrig/c536eeec36e419e17531 to your computer and use it in GitHub Desktop.
Modo Selection set
# There is no dedicated methods for the selection sets in the TD SDK as of yet.
# Currently you can only create pickMaps for vertices using the vmaps methods.
import modo
# Create a sphere
lx.eval('script.implicit "Unit Sphere Item"')
mesh = modo.Mesh('Sphere')
myVertices = mesh.geometry.vmaps.addPickMap("MyVertices")
# Add vertex 10 to the selection set. Can be any float value
myVertices[10] = 1.0
# Add vertices 0 to 4
for i in range(0, 5):
myVertices[i] = 1.0
# Select the contained vertices (looping through all indices, testing for None)
contained_indices = [i for i in range(len(myVertices)) if myVertices[i]]
mesh.geometry.vertices.select( contained_indices )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment