Expression Editor in Slider

I am trying to link the Max and Min values of a slider to an output from another slider / input parameter. I am wondering is there an option at all to that? Is there any alternates to work around to my requirements? Is “Expression Editor” useful for that? How to use the Expression Editor in Slider? Could some one show few examples of how this Expression Editor is used?

Hi Hari

Does this help?

import Grasshopper as gh
# Get the Grasshopper component, document and objects
ghDoc = ghenv.Component.OnPingDocument()
ghObjects = ghDoc.Objects

for obj in ghObjects:
    if type(obj) is gh.Kernel.Special.GH_NumberSlider:
        # Get the slider nick name
        name = obj.NickName
# Set the maxvalue and minvalue of the sliders name
        if name == slidername and bool:
            obj.Slider.Minimum = min
            obj.Slider.Maximum = max
            obj.ExpireSolution(True)

SetSliderMaxValue.gh (6.7 KB)

2 Likes

Thanks Naruto, much appreciated.
I am new to Pyhton programming but your code is simple.
I modified the logic to suit my requirements.
Thanks once again!