About Accessing the AutoCAD Command Line (ActiveX)

You can send commands directly to the AutoCAD command line by using the SendCommand method.

The SendCommand method sends a single string to the command line. The string must contain the arguments to the command listed in the order expected by the prompt sequence of the executed command. A blank space or the ASCII equivalent of a carriage return in the string is equivalent to pressing Enter on the keyboard. Unlike the AutoLISP environment, invoking the SendCommand method with no argument is invalid.

Send a command to the AutoCAD command line

The following example creates a circle with a center of (2, 2, 0) and a radius of 4. The drawing is then zoomed to all the geometry in the drawing. Notice that there is a space at the end of the string which represents the final Enter to begin execution of the command.

AutoLISP
(vl-load-com)
(defun c:Ch3_SendACommandToAutoCAD()
    (setq acadObj (vlax-get-acad-object)
          doc (vla-get-ActiveDocument acadObj))
  
    (vla-SendCommand doc "_Circle 2,2,0 4 ")
    (vla-SendCommand doc "_zoom a ")
)
Note: You can also use the command and command-s function in AutoLISP. Depending on the behavior needed, the SendCommand method might be preferred.
VBA (AutoCAD Only)
Sub Ch3_SendACommandToAutoCAD()
  ThisDrawing.SendCommand "_Circle 2,2,0 4 "
  ThisDrawing.SendCommand "_zoom a "
End Sub