Is there a way to incorporate an “add parameter” option to a cluster similar to when you add input nodes to the merge component? I am trying to create a cluster that will merge a list of points and then partition them by list length, but I want it to be fully parametric to where I can just click to add a node (like with the merge component) and it will at that list to the full list. Is there a better way to do what I want?
Combine lists2.gh (10.9 KB)
Sorry, no. That requires custom code in the component itself and clusters do not have this.
Hi, David! We all want to have these sympathetic “+” and “-” symbols like in “Merge” Component. Could you please directly guide us to materials where we can read about how to do such stuff or to examples? Maybe something similar, at least to understand where to search… SDK is not small. C# is not very kind to us =) “is it possible to do it directly in python in grasshopper?” forgive us for our laziness!!! =) Thank you for your time =)
Traditionally, you need to have a custom component derived from
GH_Component and implements
IGH_VariableParameterComponent. I’m afriad for clusters you cannot achieve that within mere Grasshopper capaibility.
However, if you are scripting component, instead of a cluster, to perform customized tasks, since they are variable-input components already, you may access the data accessor of your scripting component to go through every input. It’s not the same as coding a component on your own, but very close.
20200105 VariableScripting.gh (14.9 KB)
double sum = 0.0;
foreach(var inp in Component.Params.Input)
foreach(var v in inp.VolatileData.AllData(true))
if(GH_Convert.ToDouble(v, out dest, GH_Conversion.Both))
sum += dest;
A = sum;