Interesting Slider Number Query

Hello everyone,
I have a query regarding the slider number! What I want to do is I want to use just a single slider number to feed data to multiple components! Now let us suppose Component A & Component B( Addition factor) as seen in GH canvas! I am creating a slider number ranging from 0.0-2.0. Now when I move the slider from 0 to 2 the Component B should accept just from 0.0-1.0 and omits the further input. So is there a way around for this! I think expression can be used here to solve this! Thanks in advance!



Slider Query.gh (9.8 KB)

Hi,

Do you have something like this in mind?

Slider Query 2.gh (7.7 KB)

2 Likes

Use round or floor

1 Like

Floor doesn’t clamp the value though, if you wish to have an overall maximum.

1 Like

Thank you so much everyone for the responses! Stay safe and Take care! :slightly_smiling_face:

Try this code in C# scrpit

x = Math.Min(2, x));

This code compares between 2 and x, and outputs the minium.
When x < 2, it returns x. When x > 2, it returns 2.

1 Like

Good idea but you don’t need C# for that, there is a standard GH Min component.

Slider Query_2021_Jul11a
Slider Query_2021_Jul11a.gh (8.2 KB)

2 Likes

I’ve long wanted a “Clamp” component and this works perfectly fine to that effect. Thanks!

1 Like