Possible to get the input values by index instead of name?

Hi everybody,

Is it possible to get the values of a component input by index, instead of the input name?
I want to get the data from an input, independent of changes to its name. The input is part of a GHPython component,



  private void GetComponentParams()
    for (int i = 0; i < GrasshopperDocument.Objects.Count; i++)
      if(GrasshopperDocument.Objects[i].ComponentGuid != this.Component.ComponentGuid)
        if( GrasshopperDocument.Objects[i] is GH_Component)
          GH_Component comp =GrasshopperDocument.Objects[i] as GH_Component;
          // Here you have access to the actual inputs
          // You can retreive any by index... ect
          // As a place holder I am just printing out the names
          List<IGH_Param> inputs = comp.Params.Input;
          for (int j = 0; j < inputs.Count; j++)           





Thank you for your answer, but I’m not looking to get the input name, but the value that is input! Let’s say the first input is called ‘x’ and the user input is an integer 4. Now, I want to get the value of 4 only knowing that I want to get it from the first input.

a = ghenv.Component.Params.Input[0].VolatileData.AllData(False)

VolatileData.gh (3.1 KB)


Yeah, In that case just use the other methods that the IGH_Param provides. Like VolatileData as @Mahdiyar showed you. I just got the names as a place holder. What VolatileData returns is just a IGH_Structure. Check the docs :slight_smile:

1 Like