Hi,
I am learning plugin development for Grasshopper 1. I made a component from the Grasshopper 2 sample file, but I cannot figure out how to use the new way of making icons for components.
[assembly: PlugInDescription(DescriptionType.Icon, “Grasshopper2_PlugIn.Icons.plugin.ico”)]
I think someone has been able to do this. @t.schwartz It seems that you were able to do this.
@martinsiegrist Would you be able to help with this topic?
@gankeyu & @matthewaustin233
I was wondering if you could type or copy and paste how I would use associate an icon with a different name than the component name? I apologize that I do not how to static methods in the way you are suggesting to use them. I watch ParametricCamp’s video, but I can not pick up on what you are directing people to type.
[Screenshot 2025-04-26 144345]
[image]
I edited the post because I may have gotten part of the way. Grasshopper ignores, but Visual Studio does n…
@martinsiegrist
Not a problem. I was thinking along that path, but I thought it would be a good thing to ask you. Thank you for the well wishes. It is good to get an instance to speak to a significant contributor.
@martinsiegrist
I was able to get it solved with the help of @gankeyu
Well, it depends on David. I think, since GH2 is still far from complete, it would be documented a bit later.
Thank you.
KR_Li
(KR Li)
May 29, 2025, 3:25am
6
Hi,
You might see this:
You either embed the ghicon with the same name of component, which would be automatically discovered during the loading procedure by GH2.
Or you can override Icon/IconInternal and use AbstractIcon.FromXXXX
If you wish to use the second method, override the IconInternal via AbstractIcon.FromResource / FromBitmap();
protected override IIcon IconInternal => AbstractIcon.FromResource("YourIcon.ghicon", typeof(YourComponent));
Remember embed the icon file in the project.