Get input parameter data in ghPython

Hello,

I am trying to gather data from arbitrarily many inputs in the ghPython component.
The purpose is to let users add text from panels connected to my component and outputting a dictionary.
so far I have the name of a certain input:

input_name = ghenv.Component.Params.Input[0].Name

how to get to the data of that input?

Also, a pointer to the correct documentation or at least which concepts are involved would be highly appreciated. I am truly lost here.
//frans

You can access the parameter and get all its volatile data (i.e. a GH_Structure) using this method:

ghenv.Component.Params.Input[0].VolatileData.AllData(True)

Yeah, it gets a bit turduckeney with all the wrapper types/layers, have a look here:

Edit: Here’s a quick example of harvesting all inputs to a flat list:


230112_HarvestInputData_GHPython_00.gh (4.4 KB)

Hej Anders,
VoltileData was one of my many flailings, but the trick in your code that I didn’t grasp was to simply iterate over the resulting enumerator. The component output the data, but to get to the data in the code stumped me :slight_smile:

Thank you!

1 Like