Access the AutoCAD Command Line

AutoCAD ActiveX

 
Access the AutoCAD Command Line
 
 
 

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.

Sub Ch3_SendACommandToAutoCAD()
 ThisDrawing.SendCommand "_Circle 2,2,0 4 "
 ThisDrawing.SendCommand "_zoom a "
End Sub