Changing the wire between components depending on their subcategory

I want to change the wire between two components to faint, if and only if they are both simple params-geometry or params-primitive. (If just one of the first level upstream components is of this category the wires should be faint)

I got the script to change all wires going to a simple params-geometry or a params-primitive, but I can’t seem to find the subcategory of the nearest upstream,

 private void RunScript(bool showFaintWires)
    foreach(IGH_ActiveObject ao in GrasshopperDocument.ActiveObjects()){
      if(ao.SubCategory == "Primitive" || ao.SubCategory == "Geometry"){
        if(ao is IGH_Param){
          IGH_Param param = ao as IGH_Param;
          fixWires(param, showFaintWires); //This function is defined elsewhere in C# component

How do I access the upstream components subcategories?

Best Timo

param.Sources probably. But note that wire display is not a wire property, but a parameter property so it will either apply to all or none of the wires coming in to a parameter.

I have tried with the param.sources. I get the right number of sources. But when I try to get subcategory of sources[i] it does not return the subcategory of the upstream component, and I’m honestly a bit in doubt what ‘subcategory’ it is returning.

A source is always of type IGH_Param. However it might be a free floating parameter, or a component output parameter. To get the category or subcategory for the entire object you’re linking to you’ll need to access the Attributes of the parameter, then get the top level attributes (which will differ in the case of component outputs) and then interrogate the owner of those top level attributes.