Jump to content
Sign in to follow this  
Dejo1974

Getting a node output value...

Recommended Posts

Well I'm a total begginer in Python and Houdin, how do I get output distance value from hou.node('/obj/KIN_Chops/Measure_Distance_L_Hand'), and assign it to a variable let's say "A" ?

I can see it when I MMB hower over the node it reads 54. 99476.

I dragged&dropped the node to the python shell but I can't see it in the .attribute listing... or am I doing this completely wrong?

Share this post


Link to post
Share on other sites

Hye Dejo1974,

I think you must write :

A = hou.hscriptExpression('chop("/obj/KIN_Chops/Node_Name/Channel_Name")')

Share this post


Link to post
Share on other sites

If you look at the help for chop() you'll see how you can access the same data through HOM:

> exhelp chop
float chop (string channel)
        REPLACED BY
            hou.ChopNode
            hou.Track

value = hou.node('/obj/chopnet1/mynode').track("chan1").eval()

Share this post


Link to post
Share on other sites

Thanks a lot! So you must navigate it to a channel's track and order evaluation? The bottom line of what I'm trying to get is let's say A=54. 99476...

Share this post


Link to post
Share on other sites

Sorry guys... maybe I'm too stupid to crack this...but this doesn't  work... sorry for  a late reply also, and rising this topic out of the dead... I'm getting something like "this node has no track attribute" error...

Edited by Dejo1974

Share this post


Link to post
Share on other sites

GOT IT!!! As it usually happens... after days of pulling my hair...

it turns out that I should first assign the object node from the chopnet

i.e.

hou.node('/obj/KIN_Chops/object1')

 

TO the hou.chopnode

 

i.e.

 

hou.chopnode = hou.node('/obj/KIN_Chops/object1')

 

THEN

 

call the hou.track class with the name of the track as the tuple (double quotes)

 

i.e.

 

hou.chopnode.track("dist")

 

and the last step was to call .eval()

 

i.e.

 

hou.chopnode.track("dist").eval()

 

and it spits out the distance... with this many doors open... next question is should this be setted to evaluate per frame (will it slow down the rig) or per time range basis?

And the people say there is no hiearchy in programming...

Edited by Dejo1974

Share this post


Link to post
Share on other sites

Now, the next question arises, how to evaluate multiple tracks at once? "For" loop inside node's tracks? Is that even possible? 

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  

×