Add a custom icon image to Grasshopper plugin tabs

Hello,

I asked this question last year, but I didn’t have a chance to use it that time.
I’m trying to add a custom icon image to a plugin tab like below.
image

Because I’m very new to making a plugin using C#, I’m sure this might be a basic question to many people here.
David answered to my question in the old forum, but I’m not very clear or the method seems to have changed in Rhino 6.

Using a Grasshopper template in Visual Studio gives me a “AssemblyInfo.cs” where Assembly Title and other top level information seems to be assigned. Is it supposed to get a custom icon image in this file? Can anyone kindly let me know how to do it?

Dongyeop

1 Like

I added this for my plug-in.

public class PufferfishCategoryIcon : GH_AssemblyPriority
{
public override GH_LoadingInstruction PriorityLoad()
{
Instances.ComponentServer.AddCategoryIcon("Pufferfish", Resources.PfCategoryIcon);
Instances.ComponentServer.AddCategorySymbolName("Pufferfish", 'P');
return GH_LoadingInstruction.Proceed;
}
}

9 Likes

Thanks a lot Michael! I also found that there’s a space that’s set up to get a Bitmap Icon in a template.
image
I’ll try to change “null” to “Properties.Resources.xxx” in the template and your method.

I think that one is the icon for when you go to Help>About>and click the little black box in upper left corner(show loaded component libraries). Can’t remember at the moment.

Capture

2 Likes

Oh, I see. I’ll try your method.

It worked. Awesome!! Thank you again.

1 Like

Also, if you do not know already, remember to make the image as an “embedded resource” or else it wont show on other machines after being compiled.

Do you mind showing me also how to make the image embedded resources?

Looks like this makes the image “Embedded Resource”.
image
Thank you for this important information.

2 Likes

Yes that is it. Component icons should be set to embedded as well.

1 Like

i would love some more help here… can u guys help in more detailed way?
Mike, thnx in advance…

This is a really nice c# workshop about plugin developement with visual Studio from the ICD Stuttgart.
All material can be downloaded and all 3 days were recorded. I think somewhere in day 2, it’s explained how to do it.

http://icd.uni-stuttgart.de/?p=22773

7 Likes

im looking on adding plugin TAB logo … struggling here

Yes I know. I won’t watch 6 hours again to tell you at which point he shows it…
But I’m 100% sure Long Nguyeny shows how to do it.

1 Like

2:18:40 :slight_smile:

Glad you found it :slight_smile:

Are you using visual studio?
If so to add the plugin tab logo you will need to add a new class
Mine looks like this:

 public class PufferfishCategoryIcon : Grasshopper.Kernel.GH_AssemblyPriority
    {
        public override Grasshopper.Kernel.GH_LoadingInstruction PriorityLoad()
        {
            Grasshopper.Instances.ComponentServer.AddCategoryIcon("Pufferfish", Pufferfish.Properties.Resources.PfCategoryIcon);
            Grasshopper.Instances.ComponentServer.AddCategorySymbolName("Pufferfish", 'P');
            return Grasshopper.Kernel.GH_LoadingInstruction.Proceed;
        }
    }
6 Likes

OK. managed…

i’ve been banging my head against this problem for a while. I’ve made a simple plugin here to try and problem solve why the Category Icon never displays.

image
What am i doing wrong?

I’ve done the following:

zipped VS solution attached below
MyProject1.zip (554.1 KB)

Any tips welcome!

2 Likes

Try adding Michael Pryor’s block of code to your “MyProject1Info.cs” file

1 Like