Skip to content

Instantly share code, notes, and snippets.

@StepMaher StepMaher/wire_display.py
Last active Nov 4, 2015

Embed
What would you like to do?
"""
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
from Grasshopper.Kernel import GH_ParamWireDisplay as GH_PWD
for obj in ghenv.Component.OnPingDocument().Objects: # Ping all objects on the canvas
if not hasattr(obj, 'Params'): continue
if WireDisplay: # Toggle script
for param in obj.Params.Input:
if param.WireDisplay == GH_PWD.default: continue # Skip components with Default wires
else: param.WireDisplay = GH_PWD.faint # Change to Faint
else:
for param in obj.Params.Input:
if param.WireDisplay == GH_PWD.default: continue # Skip components with Default wires
else: param.WireDisplay = GH_PWD.hidden # Change to Hidden
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.