Jump to content

nprimsgroup equivalent in Python


nadmai

Recommended Posts

Hi all, 
Is there any equivalent to nprimsgroup in python? I use this hscript expression in a switch, inside a for each SOP, to delete any prims connected to the outside group of a voronoi fracture:

if( nprimsgroup( 0,"outside" ) !=0, 1, 0 )

Wondered what the python equivalent would be, because the Python SOP I wrote in its place is much slower to evaluate.

Link to comment
Share on other sites

14 minutes ago, pusat said:

Be careful calling this method, on hires geometry, you can waste a lot of memory allocating a large tuple of Prim data.

Thanks for the heads-up. Do you know of another way to achieve it without that risk?

Link to comment
Share on other sites

Thanks for the advice, much appreciated. That is a shame, since the path forward for houdini I suspect is to remove hscript at some point.

The original python sop i wrote had too much looping. Thanks to 3dome I adjusted it and with low poly pieces in a for each sop its equivalent speed to the switch expression

if len( geo.findPrimGroup( "outside" ).prims() ) > 0:
    geo.deletePrims( geo.prims() )

 

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