Jump to content
Tranguz

ramp maximum value

Recommended Posts

Sorry, a novice question about ramps. I was trying to get the maximum value of a ramp (Spline Ramp) with an expression using Python. How do i cycle between ramp points?

Share this post


Link to post
Share on other sites

Sorry, a novice question about ramps. I was trying to get the maximum value of a ramp (Spline Ramp) with an expression using Python. How do i cycle between ramp points?

ramp.eval() returns an object containing keys and values, so along this line:

ramp = node.parm("myramp").eval()
maximum = max(ramp.values())
for x in range(len(ramp.keys())):
    print ramp.keys()[x]
    print ramp.values()[x]

etc.

hth,

skk.

Share this post


Link to post
Share on other sites

Oh Thanks for your help SYmek. Now I got it!

So eval() method in hou.Parm class with a referenced ramp parameter doesn't give you a int, float, or str value but an instance of hou.Ramp from which I can easily obtain the maximum ramp value from the values() tuple!

Thanks a lot!

Edited by Tranguz

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

×