Command aliases in AutoCAD



Author Erhan Toker
Profession Architect M.Sc.
  Autodesk Authorized Consultant
  Software Specialist
e-mail  

AutoCAD 12 and higher versions

In support folder under AutoCAD install directory ( After AutoCAD 2005, directory is c:\Program Files\AutoCAD200x\Support ), there is a file named as acad.pgp. Short aliases that are used for AutoCAD commands are listed inside this file.
 
Fig.1
Fig. 1

Aliases of most of the commands can be found here. You can also edit this file, but you should definitely take a backup first. However, definitions here are aliases of standard commands and I suggest that you should not change the alias definitions. By this way, you can form up a common language with your friends in group works and computer sharing. Below, you can find alias definition format that is used in this file:

ALIASE, *COMMAND

It has a simple file structure. You can also add new lines to this file for your own aliases. You can assign more than one alias to a command. Thus, you don’t have to delete the original. Following set of commands is a good example for this:

L, *LINE
LI, *LINE

However, PGP file will be inadequate for the commands that have options. For example, you might think that, it would be a great idea to use ZE for ZOOM/EXTENTS command. You might even be using your own files. In order to make these kinds of aliases, we can use AutoLISP(TM). You can learn more about AutoLISP by looking at AutoLISP part of our website that is prepared by Orhan TOKER. Here, I will simply explain about ‘how to make a new command in AutoCAD’. First of all, we need an AutoLISP page. As this stage, you can get use of any text editor program( NOTEPAD.EXE ). Create a new file named as

c:\Program Files\AutoCAD200x\Support\aliases.lsp“.

Now, add the following code into this file:

(defun c:ze() (command “_.ZOOM” “_E”) (princ))

If I roughly explain the logic, then it will be like this:

(defun c:ALIAS() (command “_.COMMAND” “OPTIONAL”) (princ))

If some certain commands, you have to press ENTER or SPACE buttons to complete the command. In order to achieve this, you have to use  “” as an option. For example, for ERASE/ALL ( it is a dangerous command), you have to use the following code:

(defun c:EA() (command “_.ERASE” “_ALL” “”) (princ))

I would like to remind you once more that the code that is used in this example will delete all of the entities inside the drawing. By using this methodology, you can create aliases that is most suitable for your work style. (You can download the example file from here). Now, let’s take a look at how the file that we created will be automatically loaded when AutoCAD first opens:

Fig.2
Fig. 2

If you are not comfortable with this operation, then I suggest that you should take help from an expert. First of all, take a backup of the

c:\Program Files\AutoCAD200X\Support\Acad200Xdoc.lsp

file. Now, add the code that you can see in Fig. 2 at the end of this file ( Note: Download tal_macro.lsp file from here and copy into the

“c:\Program Files\AutoCAD200X\Support”

directory ). After this stage, save and close the file. From now on, every time you open AutoCAD, then you command aliases will be ready. In the following example, I am giving you the complete list of all of the aliases. Please try to understand the logic by using the tal_macro.lsp file, and make up your own list. The way of learning does not go though copying :)

Files : tal_macro.lsp

Technorati Tags: , , ,

Similar Posts

Rate this article:

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

10 Responses to “Command aliases in AutoCAD

  • 1
    Adam Goode
    June 12th, 2007 23:30

    When I try and alias a command, I get this error message

    Command: ; error: malformed list on input

    Here is the code that I’m using

    _$ (defun c:RG() (command “REGION” pause pause pause pause “EXTRUDE” PAUSE)

    I’m using it to join the lines together for the purpose of making a 3d object.

    Any help would be appreciated..

    Thank you.

  • 2
    Erhan Toker
    June 14th, 2007 09:26

    Hi Adam,
    You should add one right parenthesis at the end of the statement.
    (defun c:RG() (command “REGION” pause pause pause pause “EXTRUDE” PAUSE))

  • 3
    Christopher Tomkins
    May 5th, 2008 03:42

    Thanks
    This is very useful
    Is these similar listing of shortcuts or aliases using the control, alt, F1 F2 etc, or other keys
    thanks again Christopher

  • 4
    Muyiwa Odumosu
    June 4th, 2008 13:08

    I’m using AutoCAD 2008 and I can’t locate the file named as acad.pgp in my directory c:\Program Files\AutoCAD200x\Support. I only see acad.slb file in the directory.
    Any help would be appreciated.
    Thanks.

  • 5
    Coty
    June 12th, 2008 22:58

    i find the easiest way to locate the pgp file is to open AutoCAD, then under tools > customize > click ‘Edit Program Parameters (acad.pgp)’

    Make the necessary changes in here, then save and close the file. Now these changes wont take effect until you either restart autocad or type ‘reinit’ in the command line, then clcik the acad.pgp box to reinitialize autocad so it recognizes your changes.

  • 6
    Ben
    July 31st, 2008 19:54

    I loaded 2008 on my computer without migrating from 2002. Since the .PGP file has been removed, how do you change command names for typing purposes?

  • 7
    Rizwan Ali
    August 3rd, 2008 09:26

    i whant a list of auto cad commands
    plz send me of 2 de auto cad
    thanks
    best regards

    Rizwan Ali

  • 8
    abdul waheed khan
    August 3rd, 2008 14:07

    i dont have knowledge about transparent hatch how can i make transparent hatch in Auto Cad 2008.

  • 9
    shafeek
    August 25th, 2008 10:39

    change short keyof layer isolate

  • 10
    MUHAMMAD ALI
    September 15th, 2008 14:11

    i whant a list of auto cad commands
    plz send me
    thanks

Leave a Reply