I’ve been trying to use extension methods to add command groups to a new add in. I faced two issues:
First, I use a static class to generate the icons. it works fine in debug mode and generates the icons. but when I close Visual Studio and open solidworks on its own, all the commands disappear, it should have something to do with AppDomain.
Second, commands in tabs have their tooltip text underneath instead of their names. I don’t have this problem in a command group that is listed “toolbar” menu.
here is the gist to the code
[AddCommandGroup.cs · GitHub]
Your code is incomplete in the sense that it can’t be used to reproduce your issue. You need an MVE that isolates your problem. What’s the IconGenerator class ?
I understand it’s not complete. I’ll make the repo public and share it. but the IconGenerator.cs makes and saves the icons (strips) on assembly folder. It then returns list of their addresses.
the problem was in the IconGenerator.cs
it wouldn’t save the icons in the directory specified. Here is the intersting thing though. when my code would Throw an exception solidworks would disregard it. in other words SOLIDWORKS does not show the error messages that a class library throws. this way a faulty plug-in does not stop the main application. but you will never know what has been the issue unless you log everything!
I have a feeling your app domain is pointing to the sw installation folder. You are probably use some sort method to load your icons that relies on AppDomain’s application folder.
Use (new InfoFile(typeof(AnyClassInTheDebugFolder).Assembly.Location)).Directory
to get the debug folder properly.