Jump to content

Python Reference For Parameters And Arguments


Andz

Recommended Posts

I'm trying to learn some python scripting for H.

frame = geo.createNode('circle')
frame.parm('type').set('poly')

It took me a while of trial and error to find out that the argument for the circle type was "poly" and not "polygon", etc... Is there a reference somewhere about all these parameters and arguments ?

Thank you.

Link to comment
Share on other sites

I don't think so... what I do in such a case is that I call eval() for a parameter in question to see its current value. This way I'm sure about the token.

cheers,

sy.

EDIT:

upss... not true actually, sorry. Tokens work for hscript only...:

opparm -d circle1 type

In python you get menu item's index from eval():

mynode.parm('type').eval()

-> 0 for prim

Nevertheless both methods of investigations work well ;)

Edited by SYmek
Link to comment
Share on other sites

Hi SYmek

I don't know if I understood you well. As you can see in the video attached, eval was giving me numbers (0,1,2,etc.) not the Argument

But while I was trying it out, I found the list of tokens... check it out in the vid ;-)

** Tech Smith codec

***edit*** Oh, got it now... I can also use its index number for the token, both lines would work:

hou.node('/obj/geo1/circle1').parm('type').set(1)

or

hou.node('/obj/geo1/circle1').parm('type').set('poly')

teste_001.avi

Link to comment
Share on other sites

Continuing exploring python...

I'm creating a PolyBevel node and adjusting some parameters:

bevel = geo.createNode('polybevel')
bevel.parm('group').set('p5-1 p5-4-0 p4-7-3 p7-6 p5-6-2')
bevel.parm('beveltype').set('lowround')
#bevel.parm('setinset_1').set(True)
bevel.parm('absinset').set(0.019)
bevel.parm('repetitions').set(2)
bevel.setFirstInput(instance)

On line 4, I'm trying to turn on the Absolute radio button, but I get a message that there is no Set attribute.

I thought that only by adjusting the absinset value would be enough to switch it on, but I was wrong.

** Edit ****************************************************

I got a hint from SYmek's post on another thread:

hou.node('/obj/geo1/polybevel1').asCode()

In it, I found out that the parameter name listed is deferent than the actual parameter used in the code. That line should look like:

bevel.parm('setinset1').set(1)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...