VARIABLE INPUT PARAMETERs GHPYTHON

Hi All! 

I ran into a problem which I cannot seem to solve! So this goes out to all the coders out there:

Is there a way to make a ghpython component take a variable number of input parameters / variables? Of course without having to declare additional variables in the code! 

I think that in a custom gh component one would use the GH_Component.GH_InputParamManager to, well, manage the inputs! 

How is this achievable, if at all, in a ghpython component? How can I count and list out the variable input parameters of the ghpython component I am running the code in?

Example python pseudo code (the simplest I can think of! i.e. print out the variable input params):

thisGhPythonComponent = GH_Component() <-- how to get THIS component?

inputManager = thisGhPythonComponent.GH_InputParamManager()

inputCount = inputManager.ParamCount

for i in range(len(inputCount)-1):

    input = inputManager.Param(i)

    print input

Any help would be appreciated! 

Also note that this is purely a Python question! Not looking for solutions in VB or C#...

  • up

    Guido Maciocci

    The point being, of course, that adding more inputs will result in printing out more outputs automatically!

    • up

      djordje

      Hi Guido,

      Check the attached file.

      The definition creates python's list of lists and data tree based on input parameters values.

      9