Jump to content

PYTHON - how to get points in group?


stkeg

Recommended Posts

i have a copy node that copies a bunch of boxes.

i would like to iterate through all the boxes and then set the vertices of those boxes.


node = hou.pwd()
geo = node.geometry()
for pgroup in geo.primGroups():
for point in pgroup.geometry().points():
print point.position()
[/CODE]

what i'm trying to do is get the primGroups. then for each primGroup, get the points associated with that primGroup.

i'm not clear as to how this can be accomplished. pgroup.geometry just returns the whole geometry that contains this primGroup.

what i want is just the geo that the primGroup is referencing.

ie. my groups are named copy1Box, copy2Box, etc. i just want to modify the box in the group copy2Box, but geometry() returns all the boxes

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

you might wanna check out iterPrims() as well

as a generator it is super fast!

Unless you are not accessing individual primitives(random access) or unless you are not going to break iteration when certain condition is met, generator won't be faster then creating a list of prims with pgroup.prims().

Edited by Stalkerx777
Link to comment
Share on other sites

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...