Command Submission
 
 
 

The command function sends an AutoCAD command directly to the AutoCAD Command prompt. The command function has a variable-length argument list. These arguments must correspond to the types and values expected by that command's prompt sequence; these may be strings, real values, integers, points, entity names, or selection set names. Data such as angles, distances, and points can be passed either as strings or as the values themselves (as integer or real values, or as point lists). An empty string ("") is equivalent to pressing the SPACEBAR or ENTER on the keyboard.

There are some restrictions on the commands that you can use with the command function. See the AutoLISP Reference definition of this function for information on these restrictions.

The following code fragment shows representative calls to command.

(command "circle" "0,0" "3,3")
(command "thickness" 1)
(setq p1  '(1.0 1.0 3.0))
(setq rad 4.5)
(command "circle" p1 rad)

If AutoCAD is at the Command prompt when these functions are called, AutoCAD performs the following actions:

  1. The first call to command passes points to the CIRCLE command as strings (draws a circle centered at 0.0,0.0 and passes through 3.0,3.0).
  2. The second call passes an integer to the THICKNESS system variable (changes the current thickness to 1.0).
  3. The last call uses a 3D point and a real (floating-point) value, both of which are stored as variables and passed by reference to the CIRCLE command. This draws an extruded circle centered at (1.0,1.0,3.0) with a radius of 4.5.