Jump to content

get attribute of selected points in python


zshawchaw

Recommended Posts

Hi, 

When I select points from the viewport, how do I get a value of point attribute in python? 

I wrote a beginning like this: 

1 import toolutils 
2 viewer = toolutils.sceneViewer() 
3 selection = viewer.selectGeometry('Get Ids From Select Points',geometry_types = [hou.geometryType.Points]) 

but I don't know how to continue this. 

thanks 
Shawn

Link to comment
Share on other sites

Assuming that you only selected from one node inside SOPs, then perhaps something like: (untested)

node = selection.nodes()[-1]
points_patt = selection.selectionStrings(False)[-1]
geo = node.geometry()
for pt in geo.globPoints(points_patt):
    print geo.pointFloatAttribValues("attribute_name")
http://www.sidefx.com/docs/houdini13.0/hom/hou/GeometrySelection#nodes

http://www.sidefx.com/docs/houdini13.0/hom/hou/Geometry#globPoints

http://www.sidefx.com/docs/houdini13.0/hom/hou/Geometry#pointFloatAttribValues

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...