Hi everyone,
I was searching for the property of the components to change its icon to the default name via C# for a certain subcategory of components.
I can´t find how the property of this is called:
Thanks !
Hi everyone,
I was searching for the property of the components to change its icon to the default name via C# for a certain subcategory of components.
I can´t find how the property of this is called:
Thanks !
I got it working in parts, but axactly that components(primitive/containers) I want to change do not respond:
Aren’t they in the GH_Component class? If not in which are they?
That’s the code so far:
private void RunScript(bool run, ref object A)
{
GH_Document doc = GrasshopperDocument;
if (run)
{
foreach(IGH_DocumentObject obj in doc.Objects)
{
if(obj is GH_Component)
{
GH_Component comp = obj as GH_Component;
//test for category / sub category
if (comp.IconDisplayMode.ToString() == "icon" || comp.IconDisplayMode.ToString() == "application")
{
comp.IconDisplayMode = GH_IconDisplayMode.name;
}
}
}
}
}
Thanks!
File:20190509_SetIconDisplayMode.gh (2.7 KB)
Those are parameters, not components.
Hi David,
thanks a lot!
One more questions, do I have to test for each type like this :
if(obj is GH_Param<Grasshopper.Kernel.Types.GH_Number>)
or is there a way to check for all of them at the same time?
I tried it like this:
if(obj is GH_Param<IGH_Goo>)
without success.
Many thanks!
Just applied per Category was the easiest.
Thanks
All params implement the interface IGH_Param, so you can test
if(obj is IGH_Param)
that´s good to know.
Thanks a lot Andrew!