EndCommand Event (ActiveX)

Triggered immediately after a command completes.

Supported platforms: Windows only

Signature

VBA:

object.EndCommand(CommandName)
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

CommandName

Type: String

The name of the command that was issued.

Remarks

The EndCommand event follows the BeginCommand event after AutoCAD completes processing the command. If the user cancels out of the command, the EndCommand event will not be triggered.

The BeginCommand event will be fired for any basic AutoCAD command, or any command registered on the AutoCAD command stack via an ObjectARX application, or the Visual LISP vlax-add-cmd function. It will not be fired for any normally defun'd C: AutoLISP function because it is not exposed to the command stack, even though you execute it from the AutoCAD command Line. If you need AutoLISP commands to be recognized when they execute, you will need to use the Visual LISP vlax-add-cmd function to register the command correctly to the AutoCAD command stack.

If you undefine an AutoCAD command and then redefine it via the AutoLISP defun function, the BeginCommand event may not be triggered until an actual AutoCAD command is called; for example, (command "._LINE" ...).

AutoCAD commands are stored in groups in the command stack. One instance of the command stack is created per AutoCAD session. This stack consists of the native AutoCAD commands, as well as any custom commands you add to it.

No events will be fired while a modal dialog is being displayed

Examples

VBA:

Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
    ' This example intercepts a drawing EndCommand event.
    '
    ' This event is triggered when a drawing receives
    ' any command compatible with this event.
    '
    ' To trigger this example event: Issue any command to an open drawing from
    ' either the command line, VBA, the ACAD menus, the ACAD toolbars, or LISP.
    ' When the command is finished, this event will be triggered.

    ' Use the "CommandName" variable to determine which command just finished
    MsgBox "A drawing has just finished a " & CommandName & " command."

End Sub

Visual LISP:

Not available