By Barbara Han
Issue
been reported to My user often clicks my custom command in the sketch context, but my custom command doesn't work in the sketch context, how can I programmatically exit the sketch context to the part environment?
Solution
Running ‘AppReturnTopCmd’ or ‘AppReturnParentCmd’ command through Inventor API can exit the sketch context. Please refer to below sample code snippet:
' Inventor application object.
Private m_inApp As Inventor.Application
……
If m_inApp.UserInterfaceManager.ActiveEnvironment.InternalName =
"PMxPartSketchEnvironment" Then
m_inApp.CommandManager.ControlDefinitions.Item("AppReturnTopCmd").
Execute() 'or AppReturnParentCmd
End If