Sorry for the long post.
I’m working on a Python script that will save all grasshopper inputs into a CSV file, save the input NickName, Guid and Values.
As well a Script that will load the CSV file and update all inputs inside gh.
I’m not a coder, so I’m struggling a little with some of the input components, mainly the ValueList, BooleanToggle and the TableInputs.
on the BooleanToggle:
if type(obj) is gh.Kernel.Special.GH_BooleanToggle: print obj.ToggleValue
I get an error:
GH_BooleanToggle has no attribute ToggleValue
but if you paste the component onto NotePad you can see the name of the attribute, so don’t know how to get this one.
on the ValueList:
I have no idea on how to get the values, I was thinking on getting the amount of list by using ListCount, and than looping to through that range by using obj.ListItem(i).Expression for value and obj.ListItem(i).Name for the name, but I get the same error that the object doesn’t have those attributes.
#### get all Value List ##### if type(obj) is gh.Kernel.Special.GH_ValueList: print obj.ListCount for i in range(0,obj.ListCount-1): print obj.ListItem[i].Expression print obj.ListItem[i].Name
for the Panels, I got it working for both saving and loading, with one small problem. It will load the list values but if you doubleclick on the panel, all strings are together instead of different lines, but only if you double click:
attached my code, hope someone can help me finish this and it will be usefull for everyone as well.
Python Read Inputs.gh (13.8 KB)