Manually Querying an input within a Python component

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 (7.2 KB)


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):
            component = source_attributes.GetTopLevel.DocObject

a = names

lists = ghpythonlib.treehelpers.tree_to_list(lists)

print lists

You can use ghpythonlib.treehelpers.list_to_tree or write the DataTree yourself:

Thanks for your reply.

The issue i had was that i wanted to identify the elements that belonged to a particular input.

Turns out you can use .VolatileData and a little list manupulation to do it.