Change Wire Display: Custom Preview: M Input

Hi guys,

I found this Python code to change wires of selected componets so kindly provided by Atelier Panda on this page.
http://pandagopanda.com/thoughts/2014/7/28/meta-grasshoppering-i-cleaning-up-wires

from Grasshopper.Kernel import GH_ParamWireDisplay
from Grasshopper.Kernel import GH_RuntimeMessageLevel 

# A dictionary of wire types 
wire_display = {'0':GH_ParamWireDisplay.default, 
                '1':GH_ParamWireDisplay.faint,
                '2':GH_ParamWireDisplay.hidden}

# Get selected components and change the wire display
if on:
    doc = ghenv.Component.OnPingDocument()
    sel_objs = doc.SelectedObjects()
    if not len(sel_objs):
        ghenv.Component.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, 'Nothing was selected')
    for sel_obj  in sel_objs:
        if not hasattr(sel_obj, 'Params'): continue
        for p in sel_obj.Params.Input:
            p.WireDisplay = wire_display[wire_type]

I might be just needing one more step of specification, I would like to change specifically all M inputs on the Custom Preview component.

I have been taking a look at the Grasshopper SDK but I could’t find any reference to selecting specific inputs of components…

Thanks for any insight,
Shynn

Hello, it is old topic but maybe this help someone,

from Grasshopper.Kernel import GH_ParamWireDisplay
from Grasshopper.Kernel import GH_RuntimeMessageLevel 
import Grasshopper as gh

wire_display = [GH_ParamWireDisplay.default,
GH_ParamWireDisplay.faint,
GH_ParamWireDisplay.hidden]

objects = ghenv.Component.OnPingDocument().Objects
for obj in objects:
    if obj.Name == "Custom Preview":
        if on:
            for input in obj.Params.Input:
               input.WireDisplay = wire_display[wire_type]