Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
bindlmi
in reply to: WCrihfield

Regarding the proposal with the DisabledCommandList:
I looked at the example on the help page and you have to disable the command in all unwanted environments.

bindlmi_0-1730797430382.png

So I tried my best:

            foreach (Inventor.Environment oTempEnv in Plugin.m_inventorApplication.Environments)
            {
                if (oTempEnv.InternalName != "DLxDrawingEnvironment")
                {
                    try
                    {

                        oTempEnv.DisabledCommandList.Add((ControlDefinition)Btn.ButtonDefinition);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Evn: {oTempEnv.DisplayName}\n\n{ex}");
                    }
                }
            }

But I get the following error message:

bindlmi_1-1730797537621.png

I am not sure if the problem is that I am converting my ButtonDefinition to a ControlDefinition.

I think that the DisabledCommandList does not exist... in the VBA editor it looks like this:

bindlmi_2-1730797697268.png