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
Tags:
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);
}
}
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by