Special Form Entry: COMMAND
← Prev | ↑ Chapter | Next → | Index | Symbols
Special Form Entry: COMMAND
Name
command
Class
Special Form
Syntax
(command [args ...])
Arguments and Values
- a sequence of command name and command input arguments
Description
Executes an AutoCAD command through the host command processor.
Evaluation Rules
Autodesk classifies command as a special form because its argument handling and command-loop interaction differ from ordinary function calls.
Return Values
Host-dependent command-execution result; exact return-value conventions are not fully formalized in the current source set.
Side Effects
- executes a host command
- may modify the drawing, system variables, user interaction state, and command stack
Affected By
- current document state
- command versioning
- localization
PAUSE*error*mode
Exceptional Situations
Command failure, invalid input, and command-loop state errors are host-dependent.
Compatibility
- central AutoLISP host interaction facility
- related to
command-s
Notes
This is one of the clearest examples of an AutoLISP construct that cannot be reduced to pure Lisp evaluation semantics.
clautolisp
clautolisp registers command as a special operator in the runtime
(alongside trace / untrace) and implements it against the Host
Abstraction Layer: every argument is evaluated, each value is
normalized to the command-line token string a user would type at
the CAD prompt, and the whole token sequence is routed through the
active backend's command channel in one call. Normalization rules:
- a string passes verbatim;
""is the RETURN token and the one-backslash string"\\"is the PAUSE token (the predefined variablepauseis bound to it); - an integer prints in decimal, a real in its AutoLISP
princspelling (no Common Lisp float marker); - a 2D/3D point (a list of two or three numbers) prints as the
comma-separated coordinates
"X,Y"/"X,Y,Z"; - an entity name passes as its handle text;
- any other value (including
nil) raises:invalid-command-argument.
Because all arguments are evaluated before the sequence is sent,
clautolisp's command shares vl-cmdf's evaluate-first behavior:
there is no vendor-style partial execution before an
argument-evaluation error.
Under the in-process backends there is no CAD command engine.
MockHost (the default) records each routed token sequence on a
per-session command log — readable through the clal-command-log
extension — echoes a Command: ... line to its prompt output, and
returns nil; (command) with no arguments records an empty
sequence (the vendor "cancel" call). The bare NullHost signals
:host-not-supported. A live CAD backend routes the same token
sequence through its SendCommand / script analog.
Availability
- AutoCAD 2026: documented (per Autodesk reference page).
- BricsCAD V26: presumed compatible (no contradicting page found).
- Status: AutoCAD documented; BricsCAD presumed-both pending Phase 4 verification.
Source Notes
- [About Special Forms (AutoLISP)](https://help.autodesk.com/cloudhelp/2017/ENU/AutoCAD-AutoLISP/files/GUID-F992EAA3-AFFC-425D-B7C9-6A9CB0EA2768.htm)
- [Query and Command Functions Reference](https://help.autodesk.com/cloudhelp/2016/ENU/AutoCAD-AutoLISP/files/GUID-F9ABE09D-9A71-4C00-8E5D-5BA70C3797B5.htm)
- Status: documented in role and category; further host details remain chapter-level.