AutoCAD

The Infamous Pigpen File

1 Jan, 2003 By: Lynn Allen


Last month I provided a quick overview on using Visual LISP to shorten the AutoCAD commands: ZA for Zoom All, EL for Erase Last, and so on. This month we'll actually take a step backwards to something even easier to program: the Acad.pgp file. It's within the PGP file that we find our aliases: E for Erase, C for Circle, and so on. Whereas Visual LISP allows you to create a command that executes an AutoCAD command along with an option, the Acad.pgp file can only be used to shorten an AutoCAD command (no options).

The PGP file has been called the Pigpen file for as long as I can remember. I'm not sure who originally knighted this file with the unsavory title, but it has certainly stuck over the years. In the early days of AutoCAD we used the PGP file to access DOS commands from inside of AutoCAD (long before the days of Windows and the ability to multitask). This process was called "Shelling." The ability to format a floppy disk without leaving AutoCAD seemed like magic. I was even able to access Wordstar from inside AutoCAD by carefully tweaking the Acad.pgp file. Do any of you remember Wordstar? (Wow, what a blast from the past!) Then came the AutoCAD aliases: shortened versions of our favorite commands that saved us countless keystrokes. All this power packed into one mystical file!

Even though we technically don't need the PGP file to access other programs from inside of AutoCAD anymore, it should be noted that the Acad.pgp file is set up to allow easy access to three popular Windows programs. Keying in the word EXPLORER at the AutoCAD command prompt will actually launch Windows Explorer. Keying in NOTEPAD will launch Notepad, and PBRUSH will launch the Windows Paintbrush program. If you like to type, you might actually find these fast and efficient alternatives to executing the programs in other ways.

We may not need the PGP file to access other programs, but we still like to shorten our favorite commands. Let's take a look at the super-simple syntax (say that three times fast!) that creates the AutoCAD aliases.

Here are a few examples:

L, *Line would set the alias L to the LINE command

You can find the Acad.pgp file in the AutoCAD Support directory. Open the file in Notepad (which we now know we can execute directly from the AutoCAD command prompt) and take a look at it. Here you'll find the many aliases that have been created for you. I've included just a few:

A, *ARC
ADC, *ADCENTER
AA, *AREA
AL, *ALIGN
AP, *APPLOAD
AR, *ARRAY
-AR, *-ARRAY
ATT, *ATTDEF
-ATT, *-ATTDEF
ATE, *ATTEDIT
-ATE, *-ATTEDIT
B, *BLOCK
-B, *-BLOCK
BH, *BHATCH
BO, *BOUNDARY
-BO, *-BOUNDARY
BR, *BREAK
C, *CIRCLE

The spacing between the comma and the command is not important; it just makes it easier to visualize.

So what commands do you use on a regular basis? Do you like the alias assigned to this command? Do you want to override an existing alias? No problem--clearly, it's easy enough to add to or change the existing aliases. For example, if you prefer the DTEXT command to MTEXT, you might choose to change the alias T to DTEXT (rather than MTEXT). Do you prefer using the command-line interface of some commands? We know it takes a dash in front of a command to execute the command-line interface, so why not map that to a simple alias?

You'll also find that, by simply exploring the PGP file, you might stumble across an alias that you could have been using all along. And there's no problem overriding the existing aliases, so you should set up AutoCAD to suit your personal needs!

If you change your PGP commands during an AutoCAD session and you want AutoCAD to recognize those changes pronto, you'll need to execute the REINIT command, as shown in Figure 1. This will reinitialize the PGP file and load up the new values.


Figure 1. To view the PGP file information immediately, use the REINIT command or wait until you launch AutoCAD again.

If you have the Autodesk Express Tools, you have the awesome Alias Editor available to you. This makes setting up your own aliases even easier! The Command Alias Editor is available from the Express=>Tools pulldown menu, as shown in Figure 2. You can also key in ALIASEDIT if you have the Express Tools installed.

The Alias Editor is even easier than editing the Acad.pgp file directly. To add an alias, simply pick the ADD button, key in the alias abbreviation you have in mind, and then pick the desired AutoCAD command from the list in the dialog box. If you wish to change an existing alias, highlight the alias and then hit the Edit button. You'll also find a REMOVE button to eliminate any aliases you have no intention of ever using. It's all very, very simple! You'll also notice the Shell Commands tab in the Command Alias editor contains the commands that "shell" you outside of AutoCAD to other functions and programs.


Figure 2. The Command Alias Editor makes it easy to create your own aliases.

Question for you: What if you have a LISP routine that assigns the letter E to ELLIPSE, and your Acad.pgp file assigns the letter E to ERASE? Who's going to win?

AutoLISP will always beat out the PGP file command aliases. That's important to know. If you think you've set an alias in the PGP file only to find out it doesn't appear to be working correctly, chances are, there's a lingering LISP routine that is already using that key combination.

Now remember: The goal here is to eliminate keystrokes. You'll notice that there are a couple of aliases that are longer than some command names: for example, PRCLOSE for PROPERTIESCLOSE. This closes the Properties dialog box. But, for goodness sakes, just execute Cntrl+1 to open and/or close the Properties dialog, which is much easier. You'll also see a couple of amusing aliases such as COLOUR for COLOR.

I strongly suggest backing up the Acad.pgp file before going too crazy with it (just in case). This will make it easy for you to get the original back should something "unfortunate" happen while you're editing it (good insurance).

Take a look at the Pigpen file (and remember to call it the Pigpen file if you want to remain cool). You might just find some clever means of making your AutoCAD days a little shorter and more pleasant! Add this newfound knowledge to that you learned from last month's AutoLISP mini-lesson, and you should be on your way to becoming a true AutoCAD guru! It's all about productivity.

Until next month...Happy AutoCADing!


AutoCAD Tips!

Lynn Allen

Autodesk Technical Evangelist Lynn Allen guides you through a different AutoCAD feature in every edition of her popular "Circles and Lines" tutorial series. For even more AutoCAD how-to, check out Lynn's quick tips in the Cadalyst Video Gallery. Subscribe to Cadalyst's free Tips & Tools Weekly e-newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!
Follow Lynn on Twitter Follow Lynn on Twitter



Poll
Which file format do you use most often for CAD drawing/model exchange?
Native format
PDF
3D PDF
DWF
STEP or IGES
JT
IFC
Other
Submit Vote