nadmai 0 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. Share this post Link to post Share on other sites
3dome 132 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 Share this post Link to post Share on other sites
animatrix 210 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 Share this post Link to post Share on other sites
3dome 132 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? Share this post Link to post Share on other sites
animatrix 210 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. Share this post Link to post Share on other sites
nadmai 0 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() ) Share this post Link to post Share on other sites