Simple parameter editing Python error.

   1610   3   0
User Avatar
Member
5 posts
Joined: Jan. 2017
Offline
Hi,

I'm trying to modify parameters of a node using python, based off the example on this page: http://www.sidefx.com/docs/houdini/hom/tool_script [www.sidefx.com]

This is my code:
sphere = hou.node(“/obj/sphere1”)
current_tx = sphere.parm(“tx”).get()
print current_tx
sphere.parm(“tx”).set(5)

And this is the error I get:
Traceback (most recent call last):
File “tool_1”, line 3, in <module>
AttributeError: ‘Parm’ object has no attribute ‘get’

I've tried in both the python shell and as a shelf tool and it's driving me mad.
What am I doing wrong?
Edited by councilofevil - Sept. 26, 2017 13:55:04
User Avatar
Member
201 posts
Joined: July 2005
Offline
I'm assuming you want to print out the current value of the parameter so try this:

current_tx = sphere.evalParm(“tx”)
Cheers,
Rob
Digital Supervisor | Stargate Studios Toronto
User Avatar
Member
5 posts
Joined: Jan. 2017
Offline
rdms
I'm assuming you want to print out the current value of the parameter so try this:

current_tx = sphere.evalParm(“tx”)
Thank you, this works! Out of interest, do you know why the original .get() didn't?
User Avatar
Staff
3464 posts
Joined: July 2005
Offline
http://www.sidefx.com/docs/houdini/hom/hou/Node [www.sidefx.com]
has no get()
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
  • Quick Links