Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Disable custom command in other environment

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
jatindevaiya08
276 Views, 3 Replies

Disable custom command in other environment

Hello,

I have created several custom command which work in Drawing, Part and Assemblies. And I have use OnEnviromentChange event to enable & disable those. But while doing this Dynamic simulation and Stress Analysis was disable automatically. When I'm removing this event then both are enabled.

Can anyone help me to resolved it?

Regards,
Jatin Devaiya

If a response answers your question, please use ACCEPT SOLUTION to assist other users later.


Also be generous with Likes! Thank you and enjoy!
3 REPLIES 3
Message 2 of 4

To disable and enable commands you need to get hold of the "ControlDefinition". This property can "Enables/Disables the UIDefinition objects.". That could work like this:

Dim Ribbon As Ribbon = ThisApplication.UserInterfaceManager.Ribbons.Item("Ribbon name")
Dim ribbonTab As RibbonTab = Ribbon.RibbonTabs.Item("Ribbon tab name")
Dim ribbonPanel As RibbonPanel = ribbonTab.RibbonPanels.Item("Ribbon panel name")
Dim commandControl As CommandControl = ribbonPanel.CommandControls.Item("Command controls name")

commandControl.ControlDefinition.Enabled = False

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 4

@JelteDeJong 

I have used UserInterFace as well as UserInput Event. So some of the command is in ribbon and some on ContextMenu.
That's why I have used OnEnvironmentChange Event to disabled it. But facing issue in Assembly Environment only where those two command is disabled.


Regards,
Jatin Devaiya

If a response answers your question, please use ACCEPT SOLUTION to assist other users later.


Also be generous with Likes! Thank you and enjoy!
Message 4 of 4

Instead of OnEnvironmentChange I have used OnActiveDocument event to disable or enable custom command and it's work fine. Dynamic simulation and Stress Analysis is not disabled by this method.

Regards,
Jatin Devaiya

If a response answers your question, please use ACCEPT SOLUTION to assist other users later.


Also be generous with Likes! Thank you and enjoy!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report