Grasshopper

algorithmic modeling for Rhino

Hi everyone,

I have a GH_Number (GH_Param) which is an output source of a component. I have only the GUID from the GH_Number and I would like to get the parent component. Is there any method to get the reference of the component if I have only a reference to its containing output?

Thanks in advance for your help.

Cheers,

Daniel

Views: 531

Replies to This Discussion

You can access the parent/toplevel object via the Attributes of an object.

You'll have to cast it from IGH_DocumentObject to IGH_Component though if you need to access component functions.

thanks for your fast response. It works:

 if (!number.Attributes.IsTopLevel)
                {
                    GH_ComponentAttributes compAttr = (GH_ComponentAttributes)number.Attributes.GetTopLevel;
                    GH_Component component = (GH_Component)compAttr.DocObject;
                    if (component != null)
                    {
                        component.ExpireSolution(true);
                    }   
  }

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service