Skip to content

Instantly share code, notes, and snippets.

@StepMaher
StepMaher / change_slider_domain.py
Last active November 4, 2015 21:18
Change the domain of an existing slider with a given NickName.
"""
Reset a named slider's domain.
Inputs:
Sliders: List of slider NickNames.
Min: Minimum Value(s).
Max: Maximum value(s).
Update: Set to 'True' to update the slider's domain.
"""
# Name component
"""
Allows for dynamically changing the Grasshopper document's Faint and Hidden wire display types. This will not affect wires set to Default.
Inputs: WireDisplay: Plug in a boolean value here. True = "Faint" wires, False = "Hidden" wires.
"""
# Name component
ghenv.Component.Name = "Wire Display Changer"
ghenv.Component.NickName = 'Wire Changer'
# Import libraries and methods
@StepMaher
StepMaher / get_all_screens.py
Last active November 4, 2015 22:09
Get X and Y dimensions of all screens. Note: This works once per GH instance.
"""
Get X and Y dimensions of all screens. Note: This works once per GH instance.
Outputs:
Rights: Width.
Bottoms: Height.
Names: Monitor displays.
"""
# Name component
ghenv.Component.Name = "Get All Screen Dimensions"
"""
Creates a data tree from a list.
Inputs: list: List to make a tree.
Outputs: tree: Output tree.
"""
# Name component
ghenv.Component.Name = "List to Data Tree"
ghenv.Component.NickName = 'ListTree'
@StepMaher
StepMaher / get_slider_domain.py
Created November 4, 2015 21:19
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.
"""
"""
Writes to a TXT or CSV file.
Inputs:
relative: Set to 'True' to create a new Text File using relative path. This file will live in the same directory as the Grasshopper document.
file: TXT or CSV file to write to.
lines: Text to write.
write: Set to True to write.
overwrite: Set to True to overwrite the specified file.
append: Set to True to append the specified file.
"""
@StepMaher
StepMaher / add_slider.py
Last active January 21, 2016 17:02
Add a slider with a given NickName to the Grasshopper Canvas.
"""
Create a named number slider.
Inputs:
Name: Slider NickName.
Add: Set to 'True' to create the slider.
"""
# Name component
ghenv.Component.Name = "Slider Creator"
ghenv.Component.NickName = 'Slider Creator'
"""
Finds a file in the same directory as the Grasshopper file.
Inputs: Name: File name and extiestion to grab.
Outputs: Path: Full file path.
"""
# Name component
ghenv.Component.Name = "Relative File Path"
ghenv.Component.NickName = "RelFilePath"
"""
Lists content of the history folder.
Outputs:
full_file: Full file paths for each file.
file_names: File name and extensions for each file.
"""
# Import libraries
import os
"""
Gets active Rhino camera.
Inputs:
A: Set to 'True' to activate current camera.
Outputs:
S: Starting location.
T: Target location.
L: Lens length.
U: Up.
"""