- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?
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!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.
Blog: hjalte.nl - github.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@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.
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.
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!