nadmai Posted October 30, 2018 Share Posted October 30, 2018 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. Quote Link to comment Share on other sites More sharing options...
3dome Posted October 31, 2018 Share Posted October 31, 2018 look at the hou.PrimGroup class http://www.sidefx.com/docs/houdini/hom/hou/PrimGroup.html take the length of the result of the prims() method and you should have the same Quote Link to comment Share on other sites More sharing options...
animatrix Posted October 31, 2018 Share Posted October 31, 2018 7 hours ago, 3dome said: look at the hou.PrimGroup class http://www.sidefx.com/docs/houdini/hom/hou/PrimGroup.html take the length of the result of the prims() method and you should have the same Be careful calling this method, on hires geometry, you can waste a lot of memory allocating a large tuple of Prim data. 1 Quote Link to comment Share on other sites More sharing options...
3dome Posted October 31, 2018 Share Posted October 31, 2018 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? Quote Link to comment Share on other sites More sharing options...
animatrix Posted October 31, 2018 Share Posted October 31, 2018 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. Quote Link to comment Share on other sites More sharing options...
nadmai Posted November 1, 2018 Author Share Posted November 1, 2018 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() ) 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.