AutoCAD/short commands

Advertisement


Question
I want to learn more short commands, or set my own, for AutoCAD 2010. I read something about opening acad.pgp in notepad, but I donīt know what that means.
How do I do to open the file and where is it? In program files or somewhere else? I canīt find it... :(


Answer
Hi Ebba,

The acad.pgp file is stored under your documents and settings\username\Application Data\Autodesk\ACAD\enu\Support.  It might be a little different on your system.  You can do a search for it in Windows Explorer.

The pgp file has quite a few short cut combinations already in it.  Learn and use what's there and I'd advise to not modify the existing commands in there.  You might also make a backup copy of the acad.pgp before you go customizing it to make sure you can always get back to the basics.

If you're relatively new to using Autocad, I don't recommend learning shortcut commands as it'll be a crutch and if you move to another machine, they won't be there and you'll have nothing to fall back on.  Learn the regular commands and become very familiar with them before you start shortcutting them.

A lot of people write short lisp routines and load them into an acad.lsp file and have that load on startup.  An example of a shortcut command in an acad.lsp file would be something like this:

(defun C:ZA()
 (command "ZOOM" "A")
)
(defun C:ZE()
 (command "ZOOM" "E" "ZOOM" "0.95x")
)
(defun C:ZP()
 (command "ZOOM" "p")
)
(defun C:ZW()
 (command "ZOOM" "W")
)

Open notepad and copy all those lines into it, then save it as something like acad.lsp or maybe en.lsp.

Next you'll go to your briefcase in Autocad and have that file load on startup.

Those are four differet zoom commands.  ZA is Zoom All, ZE is Zoom Extents, ZP is Zoom Previous, and ZW is Zoom Window.

Currently, you type Z, return, W, return and pick the corners of your zoom window.  With the shortcut, you'd type ZW, then return.  It saves a keystroke.  Also, most people that use these type of commands just hit ZW and the spacebar.  Much easier than traveling across the keyboard and hitting that smaller return or enter button.

That's a short lesson in PGP and Lisp.  A lot more people use lisp than deal with the pgp because you can combine a lot of commands together using lisp.  For example, here's one called RT that makes a rectangle on an angle:

(defun c:rt ()
(setq a (getvar "SNAPANG"))
(setq b (getvar "ORTHOMODE"))
(setq c (getvar "GRIDMODE"))
(setq p1 (getpoint "\nFrom point: "))
(setq p2 (getpoint p1 "\nTo point: "))
(command "LINE" p1 p2 "")
(setvar "SNAPANG" (angle p1 p2))
(setvar "ORTHOMODE" 1)
(setq p3(getpoint p2 "To point: "))
(setq p4(polar p3 (angle p2 p1)
(distance p2 p1)))
(command "ERASE" "L" "")
(command "PLINE" p1 p2 p3 p4 "CLOSE")
(setvar "SNAPANG" a)
(setvar "ORTHOMODE" b)
(setvar "GRIDMODE" c)
(print)
(print)
(
  '((f x)(princ (vl-list->string (f x)))(princ))
  '((x)(mapcar '(lambda(x) (boole 6 42 x)) x))
  '(121 69 10 70 69 68 77 6 10 75 68 78 10 94
    66 75 68 65 89 10 76 69 88 10 75 70 70 10
    94 66 79 10 76 67 89 66 4 32
   )   
)
;(print "Hey, isn't that a polyrectangle??")
(princ)
)

Save that file as RT.lsp and load it from appload and give it a try.  You'll have to type RT at the command line and a return and it will start working.

Simple and effective.

Do some searching in the web for autocad lisp routines and you'll find millions of them.  

Happy hunting.

Paul

AutoCAD

All Answers


Answers by Expert:


Ask Experts

Volunteer


Paul Jordan

Expertise

Anything to do with Autocad, MEP, Architecture, and all Revit Products

Experience

I'm an Autodesk Application Engineer for all Building Solutions Products. This includes Autocad, Autocad MEP, Autocad Architecture, all Revit products, Viz, and Raster. I've been using Autocad since 1989 and did manual drafting for 10 years before that.

Organizations
Autodesk Users Group International

Education/Credentials
A.S. Engineering Drafting, A.S. Construction Design

©2012 About.com, a part of The New York Times Company. All rights reserved.