Jump to content
Sign in to follow this  
infinity_spiral

Return the PrimType on selected nodes ?

Recommended Posts

Can someone tell me how to return the primType on any selected node in Python? I saw the hou.primType() in the docs but not sure how to use it on selection.

What I want is for example to select some curves or geometry and the script to return what is the  prim type  of each selected node (NURBS, Bezier,Polygon ,Mesh,NURBSSurface, etc)

Thank you!

 

,

Share this post


Link to post
Share on other sites

Anyway I think I figured it out .If there is another way I will be happy to see it.

def primType():
  sel = hou.selectedNodes()
  nodes = []
  types = []
  for node in sel:
    nodes.append(node.name())
    prim = node.geometry().prims()
    for i in prim:
      types.append(i.type().name())
  return dict(zip(nodes,types))

Cheers

Edited by T.I.M.

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  

×