Copy wire to another component

Is there a shortcut similar to LMB+Ctrl+Shift+Drag, but instead of moving the wires, it copies them instead?

1 Like

No the only copy-wire thing is if you make a regular wire and right-click while left-dragging. By all the rules of consistency that should also work for ctrl+shift+lmb+drag but it doesn’t.

1 Like

This is still a highly wanted feature! :smiley:

2 Likes

Indeed

1 Like

It’s not there but it’s wanted

One option is to double click on the wire in order to create a relay, then connect from the relay. Not perfect, but often quicker than going back to the original component.

I dealt this with code, creating a relay is a solution, but it expires the downstream components, which is sometimes not desirable.

Can you share a minimum working example of how you achieved that using code that does not expire the pipeline?

it’s part of Melanoplus plugin, I don’t like the current implementation, am working on a newer/cleaner method, but this works for now:

private static void ObjLMB(object sender, KeyEventArgs e)
        {
            if (sender is GH_Canvas canvas
                && canvas.ActiveInteraction is GH_RewireInteraction
                && (Control.ModifierKeys & Keys.Alt) != 0)
            {
                Type type = typeof(GH_RewireInteraction);
                if (type
                    .GetField("m_input", BindingFlags.NonPublic | BindingFlags.Instance)
                    .GetValue(canvas.ActiveInteraction) is bool fromInput
                    && type.GetField("m_source", BindingFlags.NonPublic | BindingFlags.Instance)
                        .GetValue(canvas.ActiveInteraction) is IGH_Param from
                        && type.GetField("m_target", BindingFlags.NonPublic | BindingFlags.Instance)
                        .GetValue(canvas.ActiveInteraction) is IGH_Param target)
                {
                    if (fromInput)
                        foreach (IGH_Param s in from.Sources)
                            target.AddSource(s);
                    else
                        foreach (IGH_Param r in from.Recipients)
                            r.AddSource(target);
                    canvas.Document.NewSolution(false);
                }
            }
        }

subscribe that method to something like canvas.KeyDown
initiate a rewire, and instead of letting go, press Alt to copy the wires.
[ Ctrl + Shift + LMB + Alt]

1 Like

Nifty! Thank you for sharing.