Connectivity test in python

   3299   5   1
User Avatar
Member
696 posts
Joined: March 2009
Offline
I'm writing a script to create points in the centroid of selections of primitives (viewport selection that is). I want to be able to test if the selections are connected, loop through the connected groups and create one centroid for each, but I can't figure out a way to do so.
Is there a way to test the connectivity in python?
I know I could do a similar task with a connectivity SOP and a handful of other nodes, but I wanted to be able to do the whole trick in one single python operator, if possible, that is…

Cheers
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
Unfortunately there no basically no useful topology information functions exposed in HOM. You basically have to process all the geometry and build the connectivity information yourself and then do what you want with it. That or use inlinecpp to build your own functions that provide access to more useful underlying GU_Detail functions.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
696 posts
Joined: March 2009
Offline
hmmm… and what is hou.GeometrySelection.connectivity() supposed to do?
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
Not sure. Docs are useless. I'd suggest emailing support asking them and requesting that someone document the hou.GeometrySelection class.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
696 posts
Joined: March 2009
Offline
yeah… there's a lot of stuff undocumented, so frustrating!
Thanks though, knowing what's not possible is a great help!
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Member
41 posts
Joined:
Offline
I had a similar problem not so long ago, and actually I did a cutom python node which list all your selected prims, then all points in these prims (find prims() then vertices() then points() )
Then save all that in a list of points for each prims, then compare points for each prims and if points are found in common then merge prims into a group …

But I'm quite sure there is something to do with that hou.GeometrySelection.connectivity() yes
My portfolio : www.guillaume-j.com
  • Quick Links