I’m currently stuck on the following problem and was hoping to get some tips on how to go about it:
I would like to work with a slider that has dynamic min/max values. So I found the work-around of remapping or using fractions, that works fine for the script, but I don’t like the usability on the front end.
To illustrate the problem further I simplified to scenario to this: The user can change the length of a line and position a point on that line within a defined range.
Now I would like the user to have a slider that displays the absolute position of the point instead of the fraction value. I thought about using the DataOut component and taking the absolute position from the API, but that’s probably too slow to be of use. Or maybe there is a totally different way to achieve this?
overwriteSliderValueDisplay.gh (12.4 KB)
Thank you (:
Using the SDDataOutput is reasonable approach and the response depends on the overall complexity of your model. The best is to try and see if you are happy, this code example can help you with testing.
You can also set dynamically the maximum value of slider Position with the current value of slider Length in your front end and make sure to set large Grasshopper slider ranges for flexibility.
thanks for your reply.
I like the second approach better, because it shifts the computation time towards the Length Slider.
Just to make sure that I understood your suggestion: I would provide the min/max values via SDDataOutput towards the front end and limit the front end slider accordingly?
You can actually do this without the SDDataOutput. The mentioned code example gets all parameters including names, actual values, min and max values with following API call:
See more on this documentation page. Set large slider domains in Grasshopper (ie. 0 - 1,000,000) and then override them with an appropriate range in the custom UI on your website.