Variable inputs for slider bounds

#1

Is there a way to use outputs from a different slider to control the minimum and maximum bounds of an integer slider? I am working on a parameterization problem and controlling the slider bounds as variables would work best in this instance.

0 Likes

#2

Hi Jessica

Dynamo’s slider can’t do it by itself, but you can easily achieve something this using a few other components (or a few lines of code) by manually clamping the number between a range, like this. Example attached

num_clamp

num_clamp_code

 

1 Like

#3

Gui Hi,
It says link cannot be loaded. Can you upload or edit the link again? I have the same question.

Thanks :slight_smile:

0 Likes

#4

I no longer have this file, but I can describe it to you.
Make a python node with 3 inputs, 0, 1, and 2, where:

  • 0 is your number
  • 1 is your min bound
  • 2 your max bound

Python Code

#python code
num = IN[0]
min_bound = IN[1]
max_bound = IN[2]    

if num < min_bound: 
    return min_bound
if num > max_bound: 
    return max_bound
return num
2 Likes