MD Slider initialization

Can a MD Slider be initialized? I can initialize a NumberSlider and would like to do the same with a MD Slider.

From http://james-ramsden.com/instantiate-grasshopper-component/
and made a little change to make MD sliders instead of normal ones…

create_slider.gh (10.4 KB)

Riccardo.

I’ll play with this C# script to get a better understanding of the MD_Slider SDK interface.

My wish list for this hypothetical component:

(1) Initialize an existing MDSlider, not create (instantiate) a new one.
(2) Set the X & Y ranges with input values (not by double-clicking), such as from a Range compoment .
(3) Lock the MDSlider in place (avoid accidentally moving the component when moving the cross-hairs).

For example: if I input (-1 to 1) as the range for both X & Y, and set a Boolean toggle to True (to initialize), the cross-hairs would be centered in the display grid at 0,0 and the output values would be 0,0 as well. If the Boolean toggle is False, whatever the existing values are in the slider would be output and no adjustment made to the cross-hairs.

Thanks again.

… what do you mean, then? Edit/change an existing one?

I don’t know how to do so… (apart from ugly looping a c# to re-set its position…)


Try this:

MDslider intervals.gh (19.4 KB)

This overwrite current slider intervals, so i’m not sure how to integrate your boolean toggle… can you explain that again?
What are the “cross-hairs”?

Reset a MD_Slider.gh (6.0 KB)

Found some old code posted on this subject and adapted it to my needs.

Locking is still a problem because I haven’t found what class hierarchy the Multidimensional slider is derived from. Is it GH_Component:

I’ve recently been experiencing problems with (Reset a MD_Slider.gh) that I included in my prior post.
Sorry.
This seems to work for a single slider - no guarantees.

Reset a MD_Slider_2.gh (7.4 KB)

1 Like