xarial / xcad

Framework for developing CAD applications for SOLIDWORKS, including add-ins, stand-alone applications, macro features, property manager pages, etc.
https://xcad.net
MIT License
126 stars 25 forks source link

How to Register Icons for Customization? #130

Closed foreachthing closed 2 days ago

foreachthing commented 6 days ago

If I want to customize a certain toolbar, I cannot access the icons (commands) from my addin (swTools4):

image

No icons (commands) listed. Even though my toolbar (and menu) are full with commands.

Please compare to "Surface":

image

All possible commands are available.

Any help is appreciated.

andrMollo commented 4 days ago

Hi there, I reached out to @artem1t some time ago: it seems there is a bug in SolidWorks, the icons are actually there they are just tiny. You can try to mouse over and see if the tooltip is displayed.

I hope it helps.

foreachthing commented 3 days ago

@andrMollo, yes, it does help - but not. 😦 I don't undestand why this is a SolidWorks-Bug ... since when I made my toolbar without xcad, it worked as expected. Any example project I've found, using xcad, does not show the icons. So, I'll leave this issue open as it only happens when using xcad.

artem1t commented 3 days ago

@foreachthing, you are correct. I have just done a test and it is indeed displayed correctly with vanilla SOLIDWORKS API, @andrMollo, I apologize as I was mistaken. xCAD is still using the vanilla API (e.g. calling the same Command Manager API) but something breaks this particular icon rendering, perhaps image encoding or something like that. I will be working on this now as I have a working example with SW API so can compare where it is breaking.

foreachthing commented 2 days ago

Sweet!!! image

Thanks for your hard work!! 😀

artem1t commented 2 days ago

Fixed in dev build. The issue was related to disposing of temp icons. Icons were removed immediately after the toolbar is created which has caused this issue. Now the icons are removed when the group is removed.

foreachthing commented 2 days ago

Yeah, thanks! I saw that and tried to compile it. Still trying to find out how to compile without all the examples :roll_eyes:

andrMollo commented 1 day ago

Yesss! Thanks a lot!