Jump to content
Sign in to follow this  
nadmai

nprimsgroup equivalent in Python

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.

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites
3 hours ago, 3dome said:

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

nprimsgroup. I filed an RFE for this before to have the same available function in Python HOM but it was rejected. So submit an RFE please.

Share this post


Link to post
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() )

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×