Triggered immediately after a command is issued, but before it completes.
Supported platforms: Windows only
VBA:
object.BeginCommand(CommandName)
Type: Application
An object expression that evaluates to a valid container object. In this case, the only valid container is the application.
Type: String
The name of the command being issued.
The BeginCommand event is triggered as soon as AutoCAD receives a request to issue a command. This request can come either interactively by a user through the AutoCAD user interface or programmatically. The BeginCommand event is followed by the EndCommand 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.
This event will not be fired for Visual LISP functions defined as external subroutines via the Visual LISP vl-acad-defun function. These functions are not exposed to the command stack, even though you execute them from the AutoCAD command line. Instead, these functions will trigger the BeginLISP and EndLISP events. If you need LISP 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 Visual LISP vl-acad-defun function, the BeginCommand event may not be triggered until an actual AutoCAD command is called (command "._LINE" ...) for instance.
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.
VBA:
Private Sub AcadDocument_BeginCommand(ByVal CommandName As String) ' This example intercepts a drawing BeginCommand 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 AutoCAD menus, the AutoCAD toolbars, or LISP. ' Use the "CommandName" variable to determine which command was started MsgBox "A drawing has just been issued a " & CommandName & " command." End Sub
Visual LISP:
Not available