How to enable/disable add-in commands for appropriate environment(s)

How to enable/disable add-in commands for appropriate environment(s)

DRoam
Mentor Mentor
503 Views
1 Reply
Message 1 of 2

How to enable/disable add-in commands for appropriate environment(s)

DRoam
Mentor
Mentor

I've noticed that Inventor commands will disable themselves if you're not in the appropriate environment. For example, if you place a Parts List in a drawing, then switch to an Assembly and right-click, "Repeat Parts List" in the context menu will be grayed out.

 

I know how to disable a control definition with its "Enabled" property, and I guess I could handle the environment switch event and enable/disable my commands with that. But is that the right way to do it? Or is there a better way? Such as a way to tell Inventor, "this is a Part command", "this is an Assembly command", etc.?

0 Likes
504 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

I'm not 100% sure, but I believe it has to do with a combination of how you set up the ControlDefinition's Classification (CommandTypesEnum, which are 'bits'), and the CommandCatagory(s) that you have added it into.  Then Inventor just knows how to handle it from there.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes