Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Retrieve a named slider's domain.
"""
Retrieve a named slider's domain.
Inputs:
Sliders: Slider NickNames.
Update: Set to 'True' to update information.
Outputs:
Start: Slider domain start.
End: Slider domain end.
"""
# Name component
ghenv.Component.Name = "Slider Domain Retriever"
ghenv.Component.NickName = 'Slider Retriever'
# Import libraries
import Grasshopper as gh
# Get to the GH objects
gh_objects = ghenv.Component.OnPingDocument().Objects
if Update:
# Iterate objects
for obj in gh_objects:
# Set the named slider values
if obj.NickName in Sliders:
# Get [Number Slider] objects with NickNames
if type(obj) is gh.Kernel.Special.GH_NumberSlider:
# Find mininimum and maximum values
Start = obj.Slider.Minimum
End = obj.Slider.Maximum
# Update slider information
obj.ExpireSolution(True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.