Given an IGH_Param, how can I find the GH_Component it belongs to (if any)?
Currently I’m looping over all components in the document, but I’m wondering if there’s a better way.
Thanks!
Given an IGH_Param, how can I find the GH_Component it belongs to (if any)?
Currently I’m looping over all components in the document, but I’m wondering if there’s a better way.
Thanks!
You can find the parent component via the parameter’s attributes:
if(!(foo.Attributes.IsTopLevel))
{
var bar = foo.Attributes.GetTopLevel.DocObject as GH_Component;
}
where foo
is your parameter and bar
is the parent component.
Hope this is what you are looking for…
Thanks! Looks good to me!