Grasshopper.Kernel.GH_CompiledObjectProxy

Hello all - I might be barking up the wrong tree on how to do this, but…

I’m trying to write some simple code that returns all instances of a component that is in a file. I’m not overly familiar with how to queery objects on the canvas in general.

I found a FindObjectByName function, however, it returns a GH_CompiledObjectProxy and there doesn’t seem to be a class associated with it as every time I call the type it doesn’t seem to get found.

So I guess the question is two fold - how can I call the type GH_CompiledObjectProxy and is this moving towards queering every component of a type on the canvas?

import Grasshopper

a = Grasshopper.Instances.ComponentServer.FindObjectByName("Panel", True, True)

 print a
#Python
import Grasshopper as gh
for obj in ghenv.Component.OnPingDocument().Objects:
    if type(obj) is gh.Kernel.Special.GH_Panel:
        obj.Properties.Colour = c
//C#
private void RunScript(Color c)
{
  foreach(var obj in GrasshopperDocument.Objects)
  {
    if(obj is GH_Panel)
    {
      var panel = (GH_Panel) obj;
      panel.Properties.Colour = c;
    }
  }
}

FinObjByType.gh (3.6 KB)

1 Like

Mahdiyar - you are a legend!