Next Up Previous Contents Index
Next: Dialogue-Oriented Commands Up: Urgent Fury Previous: Multiple Command Modifier

Command Redefinition

Ever since the development of external commands via the .PGP file and user-defined commands in AutoLISP, users have repeatedly asked to be able to redefine built-in AutoCAD commands. Our concern in allowing this was that users would inadvertently render menus or AutoLISP programs unusable by redefining a command used somewhere in their guts. The facility implemented permits redefinition while guarding against the horrors it might lead to.

To delete the built-in AutoCAD definition of a command, use the UNDEFINE command. The command you name must be a known AutoCAD command, but may have been previously UNDEFINEd. To restore the built-in definition of a command, use the REDEFINE command, specifying the command to be restored.

Even if a command has been UNDEFINEd, it can always be activated by specifying its ``true name'', which is simply the command name prefixed by a period. The following sample dialogue illustrates these commands:


Command: (defun C:LINE ()
1> (princ
2> "Shouldn't you be using Polyline?\n")
1> (command ".line"))
C:LINE
Command: line
From point:  *Cancel*
Command: undefine
Command name: line
Command: line
Shouldn't you be using Polyline?
.line From point: nil
From point:  *Cancel*
Command: redefine
Command name: line
Command: line
From point:

Menus, scripts, and AutoLISP programs which are expected to be run in environments in which redefinition is used should protect themselves by using the ``.'' forms of all commands. The UNDEFINE command operates only on main AutoCAD commands: those chosen from the ``Command:'' prompt. Subcommands, such as those used in the LAYER and PEDIT commands, and the dimensioning subcommands may not be UNDEFINEd.


Editor: John Walker