Handling data using dynamic inputs and outputs through ghenv.Component.Params


How can I channel data from two dynamic inputs into a single dynamic output? All my inputs at the left are paired with corresponding output at the right. My inputs and outputs need to be dynamic since this component will be used in varying instances so the number of inputs won’t always be the same.

I am currently using ghenv.Component.Params and some of its methods to create the dynamic inputs and outputs. As of now, I am just having trouble handling the data.

Looking at the first group of inputs and outputs (srfGrp0, attribute0, and data0), what I would like to happen is channel the data structure of srfGrp0 (very important to keep the same data structure) and otuput it thtough data0. Moreover, I would like to replace all the items in srfGrp0 with the input given to attribute0.

Essentially, the output coming out of data0 will be a data structure following that of srfGrp0’s with the same list of items but all of the items will be the same which is the input for attribute0.

So far, I am able to create properly named inputs with corresponding outputs. Also, I am able to channel the inputs of srfGrp0 to data0 while more or less retaining the data structure.

Below are the issues that I am encountering so far:

  1. The data structure coming out is similar but for some reason, some of the branches are getting grafted and I am getting additional branches

  2. I am not sure how to replace the items coming out of data0 with the input of attribute0

  3. Lastly, whenever I run the solver, I do get my outputs from the python component but for some reason, the data doesn’t go downstream and go through the next component which is Merge (as seen in the screenshot below)

Could anyone let me know if anyone has ideas on how to move forward with this?
I am attaching here some screenshots of my component and code. Below is the grasshopper file for it too. Thank you!

Dynamic data handling.gh (22.4 KB)