I’m writing a component that manipulates lists based on component nick names.
I have figured out how to access the list of NickNames - however, I am struggling to have the code to give me the actual input itself.
In the example in the image rather then getting the input [0,1,2,0,1,2] I would like to construct a data structure in the form of [Comp1, 0,1,2] and [Comp2, 0,1,2].
Although I’ve written it in python I can read C# and a fair bit of VB - so if you know where to queery to get the info, I should be able to get the rest of the way myself.test.gh (7.2 KB)
Code:
import ghpythonlib
names = []
for i, input in enumerate(ghenv.Component.Params.Input):
for source in input.Sources:
source_attributes = source.Attributes
if (source_attributes is None) or (source_attributes.GetTopLevel is None):
pass
else:
component = source_attributes.GetTopLevel.DocObject
names.append(component.NickName)
a = names
lists = ghpythonlib.treehelpers.tree_to_list(lists)
print lists