In my C# addin, I limit some command to some document type:
public int Command1Enable()
var doc = (ModelDoc2)App.ActiveDoc;
if (doc != null)
var type = (swDocumentTypes_e)doc.GetType();
if (type == swDocumentTypes_e.swDocPART)
Everything works great, when I switch between different document types (Ctrl+Tab), Command1 button state is updated.
... Until I create a new drawing doc:
After that, when I switch between different document types (Ctrl+Tab), Command1 button state is no longer updated.
Do you have the problem too?
SolidWorks 2017 SP2.
My error was I did not retain ICommandManager instance during the addin connection time.
When GC'ed after some object instantiations, all buttons was disabled and no updates was trigged.
Retrieving data ...