Skip to content

Instantly share code, notes, and snippets.

@StepMaher
Last active November 4, 2015 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StepMaher/18b7d18d137ddf32f1aa to your computer and use it in GitHub Desktop.
Save StepMaher/18b7d18d137ddf32f1aa to your computer and use it in GitHub Desktop.
"""
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