Python HDA attributes

   106   1   1
User Avatar
Member
41 posts
Joined: July 2013
Offline
I am trying to create an HDA with dynamic Python menus. I can access parameters from nodes, but I don't know how to access attributes.

This works and prints out the appropriate value
geo = hou.node('/obj/geo/pythonMenu/box')
test = geo.parm('tx')
print test.eval()

Using an Attribute Wrangler I created a string, from some primitive attributes.
s@prim = detailintrinsic(0,“primitiveattributes”);

prim contains

I want to use prim in a for loop to populate the menu

I need to generate a string like

token = 0
menu
for x in prim:
menu.append
menu.append

I tried geo.attribValue("prim'), from a forum post. But, attribValue is not a valid method.

I attached the project, but the main issue is how to interact with attributes with python.

Brad Carvey

Attachments:
pythonMenu.hiplc (72.4 KB)

Brad Carvey
User Avatar
Member
66 posts
Joined: June 2011
Offline
Hi there!

“attribValue” is a method from hou.Geometry class. so you need to get the attribValue from the node Geometry instead of the node.
node = hou.node('/obj/geo/pythonMenu/box')
geo = node.geometry()
geo.attribValue('prim')
This should give what you're looking for.
Hope it helps

Cheers
-J
Edited by jjayakumar - Sept. 26, 2018 11:06:32
  • Quick Links