Reply

Addin Sample Command Icons not shown

Hello everyone,

 

I downloaded, registered and started the C# AddIn, but for some reason, the Icons for the Commands do not appear.

Tab-, Category- and Command names are all shown correctly (Loaded from the xml) but i dont where the add command function would look for the icons.

5 REPLIES

Re: Addin Sample Command Icons not shown

Adding to my question, where and how is the AddIn looking for the images? We define an image ID, but whats the procedure that happens in the AddIn's head that results in an image appearing above the command title?

Re: Addin Sample Command Icons not shown

Hi TKrizsan,

I presume you downloaded the Addin sample from 

 https://github.com/SolidEdgeCommunity/SolidEdge.Community.AddIn

 

I did a test on my computer. And after compiling the solution and registring with the .bat file then Addin is shown in  SE with all images.

 

The Addin Sample uses the SolidEdge.Community.AddIn assembly. Also the EmbedNativeResources program is used to build a resouce file from all needed images. This is done  in the Postbuild event of the sample addin project.

Look in the AssmblyInfo.cs file to find the image definitions. The EmbedNativeResources program will use this to build the resouce file which is embedded at compile time (NativeResourceAttribute class).

So you have to compile 2 time to get a result: first to build the addin.dll and a second time to embed the reource for the images.

 

regards

JB
VS2015, SE ST10

Re: Addin Sample Command Icons not shown

Thank you very much! Ill check it out ASAP

Re: Addin Sample Command Icons not shown

Hello JB

 

first of all, sorry for the late response! Second, thanks for the detailed description you provided. It really did work, after retrying, with the steps you described.

One thing still remains as a question for me though. Following the .NET Programmers guide for Solid Edge (BTW great piece of documentation!! Who do I ask for more of that for all our sakes? =) ), I'd like to create an AddIn from scratch, just so I really understand all/more aspects of it. Now in this case I dont have the Embed Native resource program.

What would be the simplest (Maybe not most beautiful solution, but easiest to implement) way, to use own png files as icons in my barebone AddIn described in the .NET Programmers guide?

 

Thanks again

Re: Addin Sample Command Icons not shown

Hi TKrizan,

you don't have to use the embedded resource for command icons in the ribbon.

The embedded resource is needed to build an edge bar window, especially for the icon.

In my addin I use a dynamic load of the images. This is done by calling the AddCommandBarButton method of the Addin and then call the LoadFace() method of the new button object in the OnConnectToEnvironement event.

The advantage of the embedded resource is that you can deliver everything in one file.

My solition will require that the addin has to find all the image files in some directory, BUT using this way will enable the user of the addin to change the icons without changing the progam code.

 

Since this implies that the icons (and in my case also all texts shown in the ribbon) you have to tell Solid Edge that there was a change. Do this by changing the AddinInstance.GuiVersion.

Solid Edge will store the button infirmation internally and load the information only once (paramter firstTime of OnConnectToEnvironment).

If you try to load the images every time the addin starts, then you will mess up the ribbon. Maybe you will not notice the if your addin is the only one, but if there are several addins active then the ribbon will not look like you expect.

I build the GuiVersion by simply building a hash with all image names and command names to be displayed. So this value changes if an command icon is added or removed.

 

I hope this was not too complicated. There is also a document in the SDK directory (installation media, SDK/Advanced/samples/Addins/Doc folder). Unfortionally the addin.doc i not easy to read and also refers to  the history of the Addin SDK, since the user interface changed a lot during the 29 versions of Solid Edge ;-)

 

regards

JB
VS2015, SE ST10