Plug multiple values into the input of a component simultaneously

Hello all,

My aim is very simple - to sum values from multiple panels. Conventionally I would have to plug in each component one by one in the mass addition component. My question is - is there any way to select all my panels and say connect all these to the input of the mass addition component. If it was one set I wouldn’t have bothered, just did it straight away. However I have a lot of groups with several panels of which I want to take the sum individually. Refer image below for a better picture -

Something like what Galapagos has. You select all your sliders and right click on the Genome, say selected slider and bam…all are connected.

From what I understand this is something which is a part of the architecture of Galapagos. Grasshopper doesn’t have such a functionality built-in.

Any help is much appreciated. Unfortunately I don’t code. An idea to come up with a component perhaps… something similar to Control Wire Display component.



Ok wow, you got a another problem.
This is not how gh is supposed to work.
All These copy paste Things could be managed in a good list / data Management.

Have a look at this, may helps you:

I do work with lists frequently but this one is quite complicated.

Basically this whole thing takes surface geometries and categorizes them in 8 directions (split list and culled pattern coming from outside this cluster). Then for one day in 3 months (Mar, June, Dec - the three big rows) I need to calculate sunlight hours data for each hour - 7am to 6pm seperately for all surfaces in their resp. direction, 12 sub-rows, 8 columns), There are already a lot trees and their branches managed in each component. All those white panels have unique values for every hour for each direction for each month, which are to be multiplied by the data for the corresponding surfaces.

I am sure some genius can come up with better list organisation but that’s the most I could do at the moment.

Apart from that the question still remains - how to connect multiple panels to the input of a component ‘simultaneously’ (in this case mass addition)
What I want to achieve I should have done it in the beginning for one group and later copied it but well… I did not think of it that time.


technically you can script such functionality. You can add wires programmatically, although implementing exactly the way you want to will be a bit challenging, due to mouse handling. Unless someone has coded such tool, you could calculate some hours of development. So yes, Tim said it faster, learn more about data management and reduce component count as much as possible (but keep it simple, simplification also means to keep readability).
You could also check if Metahopper plugin has a feature inside doing it for you, not sure. Telepathy plugin may also works for you…
However, better learn basic coding if gh-data management is too difficult for you (for me it is, so coding made it much easier for me :wink: ). So my bet, you need to go through the pain of manual connecting this time. :confused:

Ouch, you could probably have used a multiline panel instead of all that copy-and-pasting :dizzy_face:

But if it’s all wired up already that would be another huge amount of work to refactor… it shouldn’t be that hard to script something that does the auto-wire connection, I’ll see what I can come up with

Yup it wasn’t all that complicated, here you go: (8.9 KB)

(although definitely do learn better data management strategies next time)

Code for anyone interested:

from Grasshopper.Kernel import *
import clr
import System.Drawing
sources = []
this = ghenv.Component
this.Name = "AutoWire"
this.Description = "Select all floating parameters to connect and press the button"
doc = this.OnPingDocument()
pos_x = 0
for obj in doc.SelectedObjects():
    if clr.GetClrType(IGH_Param).IsAssignableFrom(obj.GetType()):
      sources.append([obj, obj.Attributes.Pivot.Y])
      pos_x = max(pos_x, obj.Attributes.Bounds.Right)

if sources and button:
    sources.sort(key = lambda tup: tup[1])
    pos_y = sum([tup[1] for tup in sources]) * 1.0 / len(sources)
    pos_x += 100

    p = Parameters.Param_GenericObject() 
    doc.AddObject(p, False)
    p.Attributes.Pivot = System.Drawing.PointF(pos_x, pos_y) 
    for s,_ in sources:

Exactly what I was looking for. I did end up adding manually in all this time but will be of great help in future.

I do have a few merge components at the end which combine the hourly data for all surfaces and perform the calculations. I am aware of its existence haha.

wrt the snapshot you have posted above, in my case at the incoming side D1, D2, D3… for each surface I have data in 8 trees (for 8 directions) with 36 branches each (for 36 different hours). I need to seperate out the tree branch corresponding to different directions and different hours, multiply by factors which are again different for every hour and direction and combine all of that back for surfaces in respective directions.
I just made a quick flowchart to roughly show the process, not sure if I missed something but this gives the idea.

This is a cluster part of a bigger calc. So I do need to maintain the cull patterns for the surfaces and orientations. I am sure I can combine the copy-pasted components but I was afraid of refactoring the whole thing to get my desired end product. Surely some exercise I will perform in future to clean this up but thanks a lot for the component to wire things simultaneously.

Thank you very much for your time !!

:roll_eyes: :man_facepalming: that’s why I stopped writing scripts like this…


Surely in the future you will be able to avoid these cases by organizing the data flow in trees/branches, instead of lists.

Whoops, so much for encouraging best practices :grimacing:

I think that screenshot might just be my new favorite to illustrate “Grasshopper spaghetti code horror” phenomenon-
Check out the runner up, and imagine having to debug a dropped wire in either of them :dizzy_face::

1 Like

I was just thinking about managing all my clutter into more branches and trees than I already have. I will definitely try it out for self education.
But I realized that it can be a nightmare to debug a wrong result in a more compressed version of the whole thing as there are several layers of trees and branches. At least in the current stage I was able to find some wrong plugs and de-bug for issues pretty quickly.

Just to clarify that it is not a dumb copy paste of algorithmic operations up there :grimacing: (not that I don’t agree I need to learn more data management), some of the big components in my screenshot are vb scripts and clusters in themselves. An overkill would have been if those were out on the canvas in a native form as well haha :rofl:

1 Like

don’t worry, in the end its about solving the problem and not making the nicest script. I also know much worse definitions (some of them I made myself) and there is the complete opposite, people over-optimising definitions, even thinking about placing components in the best location to prevent intersecting wires…Those people spend 80 % of daily work on cosmetics…

1 Like

Beauty or aesthetics is not implicitly superfluous, as it can emerge from utility or functionality. It’s not just about solving the problem, it’s about solving it in context. For example, if you work on a definition as a team, a more nice definition means less time to understand it for others. So I agree with you, what matters is the raw problem, but only when the context demands nothing more.