AnsweredAssumed Answered

Enable Command problem

Question asked by Alexandre Gragnano on Apr 19, 2017
Latest reply on Apr 24, 2017 by 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

Outcomes