SHORTCUTS

Translate

Contents

 

What is a Shortcut Key Command?

One of the fastest ways to issue a command in AutoCAD is to use keyboard shortcut commands. Common examples of shortcut commands are using E for ERASE,  SA for QSAVE, TR for TRIM etc. For those who have never used a shortcut command before type "E" and then press the <Space> bar with your thumb. It is that easy. As you get used to using shortcut commands you will find the best position for your hand on the keyboard. Experiment and you will figure it out.

Shortcuts are typically defined in the acad.pgp file but can also be defined using AutoLISP®. AutoCAD comes with many shortcut commands already defined, but many people feel that the AutoCAD definitions could stand some improvement. This is why we developed the SHORTCUTS command. The SHORTCUTS command allows you to easily define shortcuts without having to edit the acad.pgp file or know AutoLISP. Definitions can be changed on the fly right from within AutoCAD.

Some tips for shortcut key commands:

The standard shortcut definitions that come with AutoCAD we feel could use some improvement, but due to the fact that most people are used to them (simply because AutoCAD comes that way) we have used them as the default definitions for the SHORTCUTS command. Please use the SHORTCUTS command to change these definitions in a way that will make you more efficient.

An example of some shortcut definitions that are a little better (at least for "right handers") can be found in the Tips & Tricks area.

 

 

KEYBOARD SHORTCUT COMMAND UTILITY

This utility allows you to create, modify, and delete keyboard shortcut commands quickly and easily in one location. 

Keyboard shortcut: none
Toolbar button: none
Compatible with AutoCAD Versions: 14, 2000, 2000i, 2002, 2004, 2005, 2006, 2007, 2008

User configurable options: none

Layers: not applicable

Known limitations:

Alternate uses:

 

SAMPLE SHORTCUTS COMMAND SYNTAX:

Command: SHORTCUTS

The following dialog will appear:

Select an area on the dialog above to go to the description for that area below.

This dialog lists all of the current keyboard shortcut definitions that have been created by this command (those defined in the "acad.pgp" file will not appear here unless also defined here). To get the complete list of shortcut commands that will be defined in your drawings you must combine the commands defined in the "acad.pgp" file with the commands defined here. In the case of duplicate shortcut names the commands defined in this command will take precedence.

To help make things simpler many of the standard AutoCAD definitions defined in the "acad.pgp" file have also been defined in the list defined by the SHORTCUTS command so that the list is more complete. To see the list of shortcut commands (both AutoCAD and APS) that has been compiled using the SHORTCUTS command see below.

 

Disable all shortcuts

Should you not want to use any shortcut commands from the SHORTCUTS command check this box and all of the shortcuts defined with this command will be disabled.

Back to top

 

Edit shortcuts

This box lists all of the shortcut commands currently defined with this command. Use the bar on the right to scroll down and see the rest. Any definition shown in the dialog above that is preceded by an "*" (asterisk) has been disabled (commented out). To edit one of the shortcuts select it from the list shown above (use the slider bar on the right side to scroll up and down in the list) and the following dialog will appear:

The shortcut name is shown on the left and the command that it is assigned to is shown on the right. You may change one or both.

To change the shortcut name type the new characters that you would like to assign to the command. So if for example you wanted to make the DETLHATCH command "DTH" instead of "DH" you would simply add a "T" in between the "D" and "H" shown in the box on the left.

If you want to change the command that the name represents you may choose one of three types of commands: APS-2008 commands, AutoCAD commands, or custom/other commands.

APS-2008 commands:  If you would like to use one of the APS-2008 commands select "APS-2008 Commands" (if it isn't already) and then click on the down arrow to the right of the box with the command listed in it. The list of APS-2008 commands will drop down and you may scroll up and down until you find the command you need. They are listed alphabetically to help you find the command quickly. They also have a short description of the command to help you if you are not familiar with the command names and what they do.

AutoCAD commands:  To use an AutoCAD command select "Commonly used AutoCAD Commands" and then click on the down arrow to the right of the box with the command listed in it. The list of AutoCAD commands will drop down and you may scroll up and down until you find the command you need. They are listed alphabetically to help you find the command quickly.

Custom/Other commands:  Finally the last choice is to create a command or command reference using AutoLISP®. For more on what may be done in this option see below for Creating custom shortcut commands using AutoLISP®.

If you would like to disable this shortcut (but not get rid of it completely) you may check the "Disable this command shortcut" box and this shortcut will not load but will be saved in the list in case you would like to add it later.

When you are done editing the shortcut press "OK" and the dialog will close and the list shown in the main dialog will be updated with your changes.

Back to top

 

Add shortcuts

To add a new shortcut definition press this button and the following dialog will appear (only the shortcut name will be blank):

Enter characters for the "Shortcut name:" and then select the command to assign to it.

The three types of commands you may choose from are: APS-2008 commands, AutoCAD commands, or custom/other commands.

APS-2008 commands:  If you would like to use one of the APS-2008 commands select "APS-2008 Commands" (if it isn't already) and then click on the down arrow to the right of the box with the command listed in it. The list of APS-2008 commands will drop down and you may scroll up and down until you find the command you need. They are listed alphabetically to help you find the command quickly. They also have a short description of the command to help you if you are not familiar with the command names and what they do.

AutoCAD commands:  To use an AutoCAD command select "Commonly used AutoCAD Commands" and then click on the down arrow to the right of the box with the command listed in it. The list of AutoCAD commands will drop down and you may scroll up and down until you find the command you need. They are listed alphabetically to help you find the command quickly.

Custom/Other commands:  Finally the last choice is to create a command or command reference using AutoLISP®. For more on what may be done in this option see below for Creating custom shortcut commands using AutoLISP®.

When you have entered the characters for the shortcut name and the command to be assigned to it press "OK" and the dialog will close and the list shown in the main dialog will be updated with your change.

Back to top

 

Delete shortcuts

Before you rush off and delete a shortcut entry, if you feel that there is a chance that you might need to use the shortcut again or would want to keep it around but not have it load you may want to disable the shortcut in the "Edit" section above as opposed to deleting it. With that said to delete a shortcut definition press the "Delete a shortcut" button and the following dialog will appear:

Select the shortcut you would like to delete and the following dialog will appear:

This dialog confirms that you got the shortcut definition that you wanted and are sure you would like to delete it. If you are sure, press "YES" if you made a mistake press "NO". The dialog will close and if you deleted an entry the change will be reflected in the shortcut list in the main dialog.

Solutions to common questions and problems with this command

Back to top

 

Creating custom shortcut commands using AutoLISP®

The most flexible choice for defining a shortcut command is to enter in one or more AutoLISP® expressions that will run when the shortcut name is typed in. Allowing program code to be entered this way means that what you can do with shortcut commands is virtually limitless. Of course you have to know how to write the code in AutoLISP®. We don't have the time or space to give you a complete lesson on AutoLISP® programming, see one of the hundreds of publications out there for that. What we will do is give you the basics and hopefully it will be enough for you to create some basic AutoLISP® expressions to get the job done.

First the rules:

  1. The lisp code is limited to 256 characters. If you need more, create the command in a file and load and run it in the shortcut.
  2. There is no limit to the number of AutoLISP® expressions assuming they will fit in the character restrictions above.
  3. Due to the nature of shortcut commands they may not be run "transparently", however commands called from inside of the shortcut may.
  4. The parenthesis must be balanced. If you have three of "(" you must have three of ")". If for some reason they are not balanced the SHORTCUTS command will make an attempt to balance them for you (this may or may not work depending on your code).

 

Running standard AutoCAD commands

Because not all of the AutoCAD commands are listed in the drop down list of commands you may need to create a shortcut command for a standard AutoCAD command. You may also want to have a command preset to use specific options or settings. This is where you may set that up.

When using AutoLISP® to run a standard AutoCAD command chances are it will need to be run using the (COMMAND "xxx....") format. By enclosing a statement in parenthesis ( ) you create an AutoLISP® expression. Let's use an example; let's say we would like to create a shortcut command that always creates text that is "bottom right" justified. Using our AutoLISP® the expression might look like this:

(COMMAND "DTEXT" "J" "BR")

The (COMMAND portion of the expression tells AutoCAD to read the next items as if they were typed in at the command prompt. Each of the items after that needs to be enclosed in quotes unless you are passing a value from a variable (chances are you won't do this). Each item in quotes is assumed to have an <Enter> after it so the expression above is as if you typed (at the command prompt): DTEXT and then pressed <Enter>, then typed in J and pressed <Enter>, and finally typed in BR and pressed <Enter>.

If you assigned the shortcut name "TBR" to the expression above the command would run like the following when you typed in "TBR" at the command prompt:

Not the cleanest shortcut in the world but it WORKS. You could select the insertion point and start banging away on the text.

Formatting the AutoLISP® expression this way will work with the majority of the AutoCAD commands. There are always a few exceptions though. Every once in a while you will run into a command that won't run using the "(COMMAND" format. You will get an error message saying something like:

XYZ Unknown command "XYZ". Press F1 for help.

When this happens it means that the command is not a native AutoCAD command (that doesn't mean they won't work) and we have to address it a little differently. Usually this means we just have to use the

(C:CMDNAME)

format. See "Running other commands and previously defined AutoLISP® routines" for more on this format.

Back to top

 

Running other commands and previously defined AutoLISP® routines

Running non-native AutoCAD commands and previously defined AutoLISP® routines is accomplished the same way. There are two types of commands: "Command line" commands and "non-command line" commands also referred to as "transparent" or as "subcommands". Most of the commands that you will be dealing with will be command line commands and they all begin with a "C:". This has nothing to do with your C: drive or any kind of path. These commands act as though they are "native" commands when they are typed in at the command prompt but when called by an AutoLISP® routine we use the format:

(C:CMDNAME)

Where CMDNAME is the name of the command we would like to run. If the command is not a "command line" command you simply omit the "C:" in the expression like:

(CMDNAME)

It is actually very easy to tell which type of command it is:
If you can just type the name of the command at the command line and press <Enter> and it works, then it is a "command line" command and requires the "C:", otherwise it does not.

Example: Let's say you have several custom AutoLISP® routines in a file called "mylisp.lsp" and we will assume that your file is somewhere in the AutoCAD search path. The command you would like to run is called "MYCMD" and it is a "command line" command. Your code would look like this:

(C:MYCMD)

If you have your custom file somehow loading automatically this is all you would need. If it is not loading automatically we can add another AutoLISP® expression to load it before running. Since the file is somewhere in the AutoCAD path all we need is the file's name in the quotes (if it were not in the AutoCAD path a full path would be required) and the code would look like this:

(LOAD "MYLISP.LSP")(C:MYCMD)

It will load every time this shortcut is run but that is OK. This way it will always be loaded when needed.

Note: If you must include the path to load your AutoLISP® file the slashes must be "forward" slashes (leaning to the right). So the code above might look like the following:

(LOAD "X:/APS-2008/Custom/MYLISP.LSP")(C:MYCMD)

Backslashes disappear when read by AutoCAD.

Back to top

 

Standard Shortcut Definitions

AutoCAD comes with several "shortcut" commands already defined in the "acad.pgp" file. (Click here to see the standard AutoCAD shortcut commands) Each of these shortcuts will be used in your drawings until you define a replacement shortcut. Any shortcut definition that is created using the SHORTCUTS command will take precedence over one defined in the "acad.pgp" file. So if for example you define "B" to be "BREAK" in the SHORTCUTS command it will no longer be "BLOCK" as defined in the "acad.pgp" file. There is no need to get rid of the "B = BLOCK" definition in the PGP file, the commands defined in the SHORTCUTS command are loaded after the PGP file so they will always override what is defined there.

APS-2008 also has some standard shortcut commands that are already defined in the SHORTCUTS command. (Click here to see the standard APS-2008 shortcut commands)

AutoCAD standard shortcuts that are defined in the "acad.pgp" file do not show up in the list that appears in the SHORTCUTS command. To allow you to see more of a complete list in the SHORTCUTS command, many of the more commonly used standard AutoCAD shortcuts have been added to the standard list used by the SHORTCUTS command.

Below is the default shortcut list saved with the SHORTCUTS command. This list includes the standard APS-2008 shortcuts, the more commonly used AutoCAD shortcuts, and a few AutoCAD shortcuts that now use APS-2008 commands.

If you would like to print out the list of shortcuts we have created two files to help you:

Shortcut Commands.pdf   (Adobe Acrobat® format)
Shortcut Commands.doc (Microsoft® Word® version 2.x format )

Key to listing below:
Standard AutoCAD shortcut commands added to the SHORTCUTS list of commands
Standard APS-2008 shortcut commands (click the cmd name for description of cmd)
Standard AutoCAD shortcuts that use APS-2008 commands (click the cmd name for description of cmd)
Shortcut Command Shortcut Command Shortcut Command Shortcut Command
3A 3DARRAY DRC C-SDOOR LW LWEIGHT SEC SECTION
3DO 3DORBIT DRO DROTATED M MOVE SET SETVAR
3F 3DFACE DS DSETTINGS MA MATCHPROP SHA SHADE
3P 3DPOLY DST DIMSTYLE ME MEASURE SL SLICE
A ARC DT DTEXT MI MIRROR SN SNAP
AA AREA DTL DETAILER ML MLINE SO SOLID
AC ATTCOUNT DV DVIEW MO PROPERTIES SP SPELL
AE TXTEDT DW DWELEV MS MSPACE SPL SPLINE
AL ALIGN E ERASE MT MTEXT SR SURNOT
AP APPLOAD EB ELEVBLKS MV MVIEW ST STYLE
APS APS-CONFIG ED DDEDIT N NOTES STC STRETCHCP
AR ARRAY EH ELEVHATCH NC NOTESC SU SUBTRACT
AT ACTILE EL ELLIPSE NL NEWLINE T MTEXT
ATT ATTDEF EM EMODE NS NEWSCHEME T2M TXT2MTXT
B BLOCK EX EXTEND O APS-OFFSET TAL TALIGN
B20 BLK20 F FILLET0 O2 OF2LAYR TC TCLEAN
B2B BLK20BB FI FILTER OC O-CWIND TE TXTEDT
B2L BLK20BL FL FZLYR OD O-SDOOR TH THICKNESS
BBL CLOUD FR FILLRAD ODD O-DDOOR TI TILEMODE
BF C-BIFOLD G GROUP OH O-OHEAD TL LDRTXT
BH BHATCH GB GYPBD OHC C-OHEAD TLA LDRTXTA
BI BRKINT GL GLULAM OP OPTIONS TLB LDRTXTB
BL BBLLDR GR DDGRIPS OPD O-PATDOOR TLD LDRTXTD
BM BLIPM H BHATCH OR O-RWIND TLS LDRTXTS
BO BOUNDARY HE HATCHEDIT OS OSNAP TLT LDRTXTT
BP C-BIPASS HI HIDE OSL O-SLIDER TO TOOLBAR
BR BREAK HL HILITE P PAN TR