Python HDA attributes

   1739   1   1
User Avatar
Member
52 posts
Joined: 7月 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
106 posts
Joined: 6月 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 - 2018年9月26日 11:06:32
  • Quick Links