Last active
November 4, 2015 22:03
-
-
Save StepMaher/18b7d18d137ddf32f1aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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