Inputs Value changes through Python

Hi there!
Heres the thing, we are developing some very simple things. And for the first time one of then is blocked by admins. Just uploaded GH file, with script inside, which is made to change Slider.Maximum and CurrentValue for Tube Thickness value to this value be always smaller then radius of tube, to avoid overlap geometry of tube with itself at its very center. This is short clean script and GH file size is 31.5KB.

Here is script which is forbidden, so the question is how we can reach the absolutely same goal: (Thickness Slider value of tube should be always be smaller on a certain value (for example if radius is 2, then thickness Maximum Value could not be bigger 1.99) of tube radius, to make possible to control Thickness, with outer size is still when changing thickness parameter and current value of radius is defines MaxValue for Thickness parameter to avoid overlaps of the model with itself in the center) and file will not to be blocked by admin?

Has anyone experienced same problem, may be anyone could help to find the alternative to our decision?

The reason your script was rejected is that it updates the slider maximum value which is not allowed as explained here in Manipulating inputs section.

It seems that the logic could be built with basic Grasshopper components and maybe clearly defined design constraints would make your tool work more predictably for a user.

1 Like

Thanks for your answer,
However i`m new to GH and Python, it will be great if you could find some little time to create an example for me how can I achieve with Basic GH components the same or similar result.

There are a number of ways you can go about this, all depending on your design intent.

You can set up the thickness as a ratio of the radius which solves the overlap problem and always works.

If you want to give users control over thickness in millimeters (or any units), you need to set up a cutoff value which overrides the thickness slider with default minimum to avoid overlap as you tried with the Python script.

You may also consider leaving the control over thickness to the script and have a list of predefined optimal values. This way users control only the radius of the pipe and the thickness is adaptive.

Attached Grasshopper definition covers all mentioned cases. (48.7 KB)

1 Like

Thanks a lot! Ill pickn`choose nodes now much more carefully :slight_smile: