I’m fairly to GH developement and I’m having a problem with reading input value from a generated ValueList.
I want to make a custom component, which would, when dropped on canvas, generate a ValueList, connect the list to the component’s input parameter. I have managed to generage the ValueList and connect it to the component, but I don’t know how to read the values from the list as Input Parameters.
Defo no expert here, but if the issue is as you suspect creating the ValueList before registering the input parameters, cant you call ExpireSolution(true), so it re runs the solution with the data the correct way, although it will create an new value list component so perhaps try checking if the valuelist exists, if not then create it, else get its value?
Also dunno if this is a thing in c# but in vb i have always used:
DA.SetData(0, selected);
Hello,
I had the same problem. What I have find out inspired by post by Andrew Heumann, is that if you add quotation marks it works.
So when you format your value while creating GH_ValueListItem like Andrew did, it probably works for you.
From the diagram, you item is the following:
“C4.3 - Balkon”
If grasshopper tries to convert that string into a number, it will output a null as that string cannot be converted to a number.
should be changed to:
for(int i = 0; i< groups.count;i++){
grpList.ListItems.Add(new Grasshopper.Kernel.Special.GH_ValueList(groups[i],i))
}