how to access the points selected in the viewport? python

   5407   2   1
User Avatar
Member
617 posts
Joined: Aug. 2008
Offline
i want to create a line from the points i selected in the viewport.

i can select my geometry, do S+2 and select the points / vertex of the geometry.

def get_points():
import toolutils
selection = toolutils
selection = selection.sceneViewer().selectGeometry()
selection = selection.selectionStrings()
#selection is a tupple
print selection
print type(selection)

and returns a tupple where the first index is a tupple with numbers and the second index is empty that looks like this

>>>('21 32 36 40-41 ‘,)
>>><type ’tuple'>


is there a way to get the points as a class and then i can get the position of them OR???
i have to loop the point nomber agains the points in the geometry and if it match then do something with that?

is there a more elgant way to do that?


ops:
User Avatar
Member
1906 posts
Joined: Nov. 2006
Offline
Look at hou.Geometry.globPoints().
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
617 posts
Joined: Aug. 2008
Offline
YEI!!!….

def get_points():
import toolutils
selection = toolutils
selection = selection.sceneViewer().selectGeometry()
node = selection.nodes()
selection = selection.selectionStrings()

#selection is a tupple
print selection
print type(selection)
selection = list(selection)
print selection
print node

list_of_points = node.geometry().globPoints(selection)
print list_of_points
return list_of_points

get_points()
  • Quick Links