stkeg Posted August 31, 2013 Share Posted August 31, 2013 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 Quote Link to comment Share on other sites More sharing options...
edward Posted September 13, 2013 Share Posted September 13, 2013 pgroup is a hou.PrimGroup which contains groups of primitives, not points. So you need pgroup.prims() and for each prim, loop through the vertices. Quote Link to comment Share on other sites More sharing options...
glassman3d Posted October 10, 2013 Share Posted October 10, 2013 you might wanna check out iterPrims() as well as a generator it is super fast! Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted October 11, 2013 Share Posted October 11, 2013 (edited) 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 October 11, 2013 by Stalkerx777 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.