Retrieve information about the input and output parameter access types

Hi everyone,
I am looking for a way to get information for the access types of the input and output parameters for multiple components. I am using the following script to get the GUID of the component, and together with that, I need for each one of the input and output parameters their type, name and their access type.

foreach (var objectProxy in Grasshopper.Instances.ComponentServer.ObjectProxies)
 {
        Print( "Guid: " + objectProxy.Guid);
 }

private void RunScript(ref object Guids, ref object Names, ref object Inputs, ref object InAccess, ref object Outputs, ref object OutAccess)
{
  var ids = new List<Guid>();
  var names = new List<string>();
  var inputs = new DataTree<string>();
  var inAccess = new DataTree<GH_ParamAccess>();
  var outputs = new DataTree<string>();
  var outAccess = new DataTree<GH_ParamAccess>();
  var objectProxies = Grasshopper.Instances.ComponentServer.ObjectProxies;
  for(var i = 0; i < objectProxies.Count; i++)
  {
    var proxy = objectProxies[i];
    ids.Add(proxy.Guid);
    names.Add(proxy.Desc.Name);
    var obj = proxy.CreateInstance();
    if (!(obj is GH_Component)) continue;
    var comp = (GH_Component) obj;
    foreach(var input in comp.Params.Input)
    {
      inputs.Add(input.Name, new GH_Path(i));
      inAccess.Add(input.Access, new GH_Path(i));
    }
    foreach(var output in comp.Params.Output)
    {
      outputs.Add(output.Name, new GH_Path(i));
      outAccess.Add(output.Access, new GH_Path(i));
    }
  }
  Guids = ids;
  Names = names;
  Inputs = inputs;
  Outputs = outputs;
  InAccess = inAccess;
  OutAccess = outAccess;
}

Information.gh (8.2 KB)

1 Like

@Mahdiyar Thanks! That works perfectly!

Is there also a method to retrieve the tab (the group of components) name that a component belongs to?
There should exist something like this:
proxy.Desc.TabName

var cat = proxy.Desc.Category;
var subCat = proxy.Desc.SubCategory;