AutoLISP can execute a built-in AutoCAD command or one that is defined in a loaded ObjectARX or Managed .NET application.
The command and command-s functions allow you to start and pass values to an AutoCAD command. The command and command-s functions have a variable-length argument list. The first argument of these functions must be the command you want to execute. All other 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.
The command-s function is faster and more efficient than the command function, but the command being executed within the command-s function must be completed within the same statement. This means that an argument must be provided for each of the command’s prompts, and that it cannot execute any more AutoLISP statements until the function has completed. Unlike the command-s function, you can use AutoLISP functions within the command function and the command that is being executed does not need to be completed to continue execution of the program.
There are some restrictions on the commands that you can use with the command and command-s functions.
The following code fragment shows representative calls to command.
(defun c:CircC () (command "._circle" "0,0" "3,3") (command "._thickness" 1) (command "._circle" PAUSE PAUSE) (princ) )
When the CircC command is loaded and executed at the AutoCAD Command prompt, the following actions occur:
The following code fragment shows representative calls to command-s.
(defun c:CircCS ( / p1 rad) (command-s "._circle" "0,0" "3,3") (command-s "._thickness" 1) (setq p1 (getpoint "\nEnter a center point: ")) (setq rad (getdist p1 "\nEnter a radius: ")) (command-s "._circle" p1 rad) (princ) )
The CircCS command is similar to CircC except it prompts the user for a center point and radius before making the last call to the command-s function. With the command-s function, you should avoid the use of the PAUSE token.