You can use command aliases and shortcut keys to start a command without moving the mouse cursor between the drawing area and the AutoCAD user interface (UI). Command aliases and shortcut keys can be easier to remember than the full command name. Creating your own command aliases and shortcut keys can also help you be more efficient.
There are some command aliases that are predefined in the product. You may have been using them without even knowing it. Let's try a few.
The CIRCLE command starts.
The ERASE command starts.
The LAYER command starts, opening the Layer Properties Manager palette.
There are also predefined shortcut keys that you can try.
The grid toggles on and off each time you press this shortcut key.
The Quick Calc palette turns on and off each time you press this shortcut key.
Clean Screen turns on and off each time you press this shortcut key. Clean Screen does not hide the Quick Access toolbar, the command window, or the status bar.
You can redefine or add command aliases by editing the acad.pgp file, or for AutoCAD LT, the acadlt.pgp file. In this example, you'll override an existing alias with your own and add a new one.
A little about the format of the PGP file:
<Alias>,*<Full command name
A, *ARC
This line in the file defines A as the command alias for the ARC command.
Always add your alias definitions to the User Defined Command Aliases section at the end of the file even if you are redefining an existing command alias. The last definition in the PGP file is the one the product loads.
It should look like the following once you finish.
This command loads the latest changes into your current AutoCAD session.
An Alias Editor is available in AutoCAD as an Express Tool. This editor provides a user interface to edit command aliases.
To open the Alias Editor, do one of the following:
The AutoCAD Alias Editor dialog box opens, where you can add, edit, or remove command aliases.
Command aliases can only be used to start an AutoCAD command. They can't pass any command options or values. A simple AutoLISP program is perfect for when you want to pass an option or a value to a command. In this example, you'll define three commands with abbreviated names using AutoLISP.
There are three basic steps to using AutoLISP programming: create, load, and test.
(defun c:ZP ()(command "._zoom" "_p"))
(defun c:ZE ()(command "._zoom" "_e"))
(defun c:C2 ()(command "._-layer" "_m" "Obj" "" "._circle" "_2p"))This defines an alias that creates a layer named Obj, makes the new layer current, and starts the CIRCLE command using the two points option.
AutoLISP files must load before they can be used. You can load a file manually for the current AutoCAD session and you can set up your LSP files to automatically load every time AutoCAD starts.
You can also enter APPLOAD at the Command prompt.
You should see a message in the Command History window indicating the file loaded.
To load your LSP file automatically each time AutoCAD opens, follow these steps.
You can also enter APPLOAD at the Command prompt.
Next time you restart AutoCAD or open a drawing, the LSP file loads automatically and your commands defined in the LSP file are available to use.
The ZOOM command with the Previous option starts.
The Zoom command with the Extents option runs.
The Obj layer is created, made current, and the CIRCLE command with the 2P option starts.
Shortcut keys are defined in a customization (CUIx) file. In this example, you'll define a shortcut key to run the REVCLOUD command with the Rectangular option.
This displays a complete list of defined shortcut keys on the right side of the editor.
To define a new shortcut key, we'll drag a command from the Command List to the Shortcut Keys node and then assign a key combination to it.
The Properties section is prefilled except for the shortcut keys. We'll assign Ctrl+Shift+R.
The result should appear like the following image.
The REVCLOUD command runs with the rectangular option.
If you aren't happy with the changes you made, you can restore the CUIx file to either its previous saved state or to the program defaults.
If you frequently misspell certain commands you might want to try AutoCorrect. With the AutoCorrect feature enabled, the command line suggestion list provides suggestions based on misspellings you have made in the past. You can also manually add commands and system variables to the AutoCorrect list that you commonly misspell.
This is so we can associate a misspelled word with a command in one try in this exercise.
You'll see Unknown Command in the command window.
This associates the misspelled WPIOUT to the actual command, WIPEOUT.
The misspelled command is now recognized as the WIPEOUT command.
Let's set the options back to the defaults.
You can also manually enter commands in the AutoCorrect file.
Notepad opens the AutoCorrectUserDB.pgp file. The format of this file is INCORRECT, *CORRECT.
You can see that it is now corrected and will start the CIRCLE command.
Customizing these command line features can take your efficiency to the next level. Defining your own command aliases and shortcut keys can save you time over the long run.
Here are some frequently used commands and system variables related to command aliases, shortcut keys, and AutoCorrect.
Command | Description |
---|---|
ALIASEDIT | Creates, modifies, and deletes AutoCAD command aliases. |
APPLOAD | Loads and unloads applications and defines which applications to load at startup. |
CUI | Manages the customized user interface elements in the product. |
REINIT | Reinitializes the digitizer, digitizer input/output port, and program parameters file. |
System Variable | Description | Default Value | Saved in |
---|---|---|---|
RE-INIT | Reinitializes the digitizer, digitizer port, and acad.pgp file. (Bitcode) | 0 | Not saved |