magneto Posted November 29, 2015 Share Posted November 29, 2015 Hi, I want to check if a volume with a specific name exists in Python or VEX. Just like you can check if a certain attribute exists using haspointattribute for example. Thanks Quote Link to comment Share on other sites More sharing options...
pezetko Posted November 29, 2015 Share Posted November 29, 2015 Iterate over primitives and check their name attribute? node = hou.pwd() geo = node.geometry() # filter volume and vdb primitives by allowed names allowedNames = ["density", "dens"] foundVol = [pr for pr in node.geometry().prims() if pr.type() in [hou.primType.VDB, hou.primType.Volume] and pr.attribValue("name") in allowedNames] # delete other primitives geo.deletePrims([pr for pr in node.geometry().prims() if pr not in foundVol], keep_points=False) if not foundVol: print("Not Found") 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted November 30, 2015 Author Share Posted November 30, 2015 Thanks man, it works. I just thought there would be a function for this to do a quick look up. Quote Link to comment Share on other sites More sharing options...
koen Posted November 30, 2015 Share Posted November 30, 2015 Find attribval should be able to do this: http://www.sidefx.com/docs/houdini15.0/vex/functions/findattribval Cheers, koen 1 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.