1 Reply Latest reply on Apr 24, 2017 10:49 AM by Alexandre Gragnano

    Enable Command problem

    Alexandre Gragnano

      Hi everyone,

       

      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)
              {
                  return 1;
              }
          }
          return 0;
      }
      

       

      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.

      Regards