<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cancel a command in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/10804584#M150736</link>
    <description>&lt;LI-CODE lang="general"&gt;AppContextual_ApplyCmd                        Apply

AppContextual_BackCmd                        &amp;amp;Back

AppContextual_CancelCmd                        Cancel (ESC)

AppContextual_ContinueCmd                        &amp;amp;Continue

AppContextual_CreateCmd                        &amp;amp;Create

AppContextual_DoneCmd                        &amp;amp;Done [ESC]

AppContextual_OKCmd                        OK (Enter)

AppContextual_RemoveCmd                        &amp;amp;Remove

AppContextual_RestartCmd                        &amp;amp;Restart

AppContinueCmd                        Continue to next step

AppExitCmd                        Quit the application; prompts to save documents

FeaExResultsCmd                        Exit Results

HSL:Cable:End_Command                        Create current segment and exit the command

Archon:Done                        End current command

DragAndDrop.Popup.CancelCommand                        End the command without applying changes

DragAndDrop.Popup.EndCommand                        Complete the command and commit changes

AppCGUCS_CreateCmd                        
AppCGUCS_DoneCmd                        
AppCGUCS_RestartCmd                        
AppCleanScreenCmd                        
AppCloseAllCmd                        Close all the documents

AppNavigationBarCloseCmd 
&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 06 Dec 2021 20:11:56 GMT</pubDate>
    <dc:creator>maxim.teleguz</dc:creator>
    <dc:date>2021-12-06T20:11:56Z</dc:date>
    <item>
      <title>Cancel a command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/2262558#M150731</link>
      <description>I want to cancel every edit command when a inventor document is read-only and give the user a message. (such as ESC) The message i get but the command isn't cancelled. (wrong commandname "FDTrasparentCancel" ?)&lt;BR /&gt;
How can I do this? &lt;BR /&gt;
&lt;BR /&gt;
Code:&lt;BR /&gt;
Private Sub mobjUserInputEvents_OnActivateCommand(ByVal CommandName As String, ByVal Context As NameValueMap)&lt;BR /&gt;
On Error GoTo Errorhandler&lt;BR /&gt;
    Dim fs As New FileSystemObject&lt;BR /&gt;
    Dim oFile&lt;BR /&gt;
    Dim oINVDoc As Inventor.Document&lt;BR /&gt;
    Set oINVDoc = objInventorApp.ActiveDocument&lt;BR /&gt;
    &lt;BR /&gt;
    If UCase(Left(oINVDoc.FullDocumentName, 3)) = "T:\" Then&lt;BR /&gt;
        'check of is file read_Only &lt;BR /&gt;
        Set oFile = fs.GetFile(oINVDoc.FullDocumentName)&lt;BR /&gt;
        If oFile.Attributes = 1 Or oFile.Attributes = 33 Then&lt;BR /&gt;
            objInventorApp.CommandManager.PromptMessage "Let op Command: " &amp;amp; oINVDoc.DisplayName &amp;amp; " is Read_Only en kan niet gewijzigd worden!", vbExclamation&lt;BR /&gt;
            'Cancel edit command&lt;BR /&gt;
            Dim oControlDef As ControlDefinition&lt;BR /&gt;
            Set oControlDef = objInventorApp.CommandManager.ControlDefinitions.Item("FDTrasparentCancel")&lt;BR /&gt;
            oControlDef.Execute&lt;BR /&gt;
        End If&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
    Exit Sub&lt;BR /&gt;
&lt;BR /&gt;
Errorhandler:&lt;BR /&gt;
    GeneralErrorHandler "mobjUserInputEvents_OnActivateCommand"&lt;BR /&gt;
&lt;BR /&gt;
End Sub</description>
      <pubDate>Fri, 23 May 2008 09:26:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/2262558#M150731</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-05-23T09:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Cancel a command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/2262559#M150732</link>
      <description>I just found how to cancel every command&lt;BR /&gt;
&lt;BR /&gt;
'Cancel edit command&lt;BR /&gt;
objInventorApp.CommandManager.StopActiveCommand&lt;BR /&gt;
&lt;BR /&gt;
but I want only to stop the edit commands.&lt;BR /&gt;
Is that possible?</description>
      <pubDate>Fri, 23 May 2008 09:39:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/2262559#M150732</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-05-23T09:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Cancel a command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/2262560#M150733</link>
      <description>I just made a workaround to cancel the invoked command.&lt;BR /&gt;
I hope there is a better (easier) way, so if anyone has a idea?&lt;BR /&gt;
&lt;BR /&gt;
Now I've just one little problem with my code (see below)&lt;BR /&gt;
When the command is cancelled the button in the panelbar stays pressed and my cursor has a plus sign to it.&lt;BR /&gt;
I assume that the command isn't cancelled completly?&lt;BR /&gt;
How can i make that the buttons aren't pressed? See attachment.&lt;BR /&gt;
&lt;BR /&gt;
Code: This is a snippset of my previous code mobjUserInputEvents_OnActivateCommand&lt;BR /&gt;
&lt;BR /&gt;
                'close command&lt;BR /&gt;
                Dim oCancelCommand As clsCancelCommand&lt;BR /&gt;
                Set oCancelCommand = New clsCancelCommand&lt;BR /&gt;
                oCancelCommand.Initialize&lt;BR /&gt;
                oCancelCommand.SetTrigger&lt;BR /&gt;
                Set oCancelCommand = Nothing&lt;BR /&gt;
&lt;BR /&gt;
Code in class -&amp;gt; clsCancelCommand&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
Private WithEvents oInteractionEvents As InteractionEvents&lt;BR /&gt;
&lt;BR /&gt;
Public Sub Initialize()&lt;BR /&gt;
    On Error GoTo Errorhandler&lt;BR /&gt;
    Set oInteractionEvents = objInventorApp.CommandManager.CreateInteractionEvents&lt;BR /&gt;
    oInteractionEvents.Start&lt;BR /&gt;
    Exit Sub&lt;BR /&gt;
    &lt;BR /&gt;
Errorhandler:&lt;BR /&gt;
    GeneralErrorHandler "Initialize-CancelCommand"&lt;BR /&gt;
End Sub&lt;BR /&gt;
Public Function SetTrigger() As Boolean&lt;BR /&gt;
    Dim strCommandName As String&lt;BR /&gt;
    &lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
    Do While LCase(strCommandName) = "interactionevents" Or strCommandName = ""&lt;BR /&gt;
        DoEvents&lt;BR /&gt;
    Loop&lt;BR /&gt;
    'Stop event&lt;BR /&gt;
    oInteractionEvents.Stop&lt;BR /&gt;
 End Function&lt;BR /&gt;
&lt;BR /&gt;
Private Sub oInteractionEvents_OnTerminate()&lt;BR /&gt;
    'sluit active commando af&lt;BR /&gt;
    objInventorApp.CommandManager.StopActiveCommand&lt;BR /&gt;
    'Refresh panelbar!&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
End Sub</description>
      <pubDate>Fri, 23 May 2008 14:15:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/2262560#M150733</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-05-23T14:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Cancel a command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/10803659#M150734</link>
      <description>&lt;P&gt;add the following to your code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;Windows&lt;/SPAN&gt;.&lt;SPAN&gt;Forms&lt;/SPAN&gt;.&lt;SPAN&gt;SendKeys&lt;/SPAN&gt;.&lt;SPAN&gt;SendWait&lt;/SPAN&gt;(&lt;SPAN&gt;"{ESC}"&lt;/SPAN&gt;)
&lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;UserInterfaceManager&lt;/SPAN&gt;.&lt;SPAN&gt;DoEvents&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Dec 2021 14:02:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/10803659#M150734</guid>
      <dc:creator>maxim.teleguz</dc:creator>
      <dc:date>2021-12-06T14:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Cancel a command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/10804133#M150735</link>
      <description>&lt;P&gt;Actually, that might not work if the proper window/dialog does not have top system focus at that moment.&amp;nbsp; Using SendKeys can be tricky.&amp;nbsp; You could try adding something like AppActivate(ThisApplication.Caption) on the line above the SendKeys line, but no guarantees.&amp;nbsp; A better option might be to execute one of Inventor's built-in commands for exiting out of an active dialog/command.&amp;nbsp; Something like "AppContextual_CancelCmd".&amp;nbsp; There are other more specific commands for canceling out of other more specific actions/commands, but that is about the most generic one.&lt;/P&gt;
&lt;P&gt;To use it, the line of code would look similar to this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;ThisApplication.CommandManager.ControlDefinitions.Item("AppContextual_CancelCmd").Execute&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 16:59:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/10804133#M150735</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-12-06T16:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Cancel a command</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/10804584#M150736</link>
      <description>&lt;LI-CODE lang="general"&gt;AppContextual_ApplyCmd                        Apply

AppContextual_BackCmd                        &amp;amp;Back

AppContextual_CancelCmd                        Cancel (ESC)

AppContextual_ContinueCmd                        &amp;amp;Continue

AppContextual_CreateCmd                        &amp;amp;Create

AppContextual_DoneCmd                        &amp;amp;Done [ESC]

AppContextual_OKCmd                        OK (Enter)

AppContextual_RemoveCmd                        &amp;amp;Remove

AppContextual_RestartCmd                        &amp;amp;Restart

AppContinueCmd                        Continue to next step

AppExitCmd                        Quit the application; prompts to save documents

FeaExResultsCmd                        Exit Results

HSL:Cable:End_Command                        Create current segment and exit the command

Archon:Done                        End current command

DragAndDrop.Popup.CancelCommand                        End the command without applying changes

DragAndDrop.Popup.EndCommand                        Complete the command and commit changes

AppCGUCS_CreateCmd                        
AppCGUCS_DoneCmd                        
AppCGUCS_RestartCmd                        
AppCleanScreenCmd                        
AppCloseAllCmd                        Close all the documents

AppNavigationBarCloseCmd 
&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 06 Dec 2021 20:11:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/cancel-a-command/m-p/10804584#M150736</guid>
      <dc:creator>maxim.teleguz</dc:creator>
      <dc:date>2021-12-06T20:11:56Z</dc:date>
    </item>
  </channel>
</rss>

