AutoCAD 2015 and AutoCAD LT 2015 Bible

The most comprehensive AutoCAD book around!

Productivity boost ideas

Note: This is an article by Fran Golding, Senior Drafter at Parsons Brinckerhoff, a large planning, environment and infrastructure firm with offices in Australia and New Zealand. Perhaps you can add your own productivity boost ideas.

When I first started to drive a car, I had the feeling that I was not the one in control. The car was controlling me. It took some

Out of control

Out of control

time and practice before that changed. Likewise, when I started to use AutoCAD, I had the same feeling. All sorts of things happened which I did not understand. With time and practice (quite a lot of time and practice, I might add), that changed. As with driving a car, I did the same functions, the same way in which I was taught. It wasn’t until I had more confidence in what I was doing that I branched out and tried new ways of doing things. Thence came the beginning of my productivity boost!

Unlike driving a car, AutoCAD performs the same functions in many different ways. You can start the PLOT command by typing plot at the command line, choosing a toolbar or ribbon icon, or choosing File> Print from the drop-down menu (with variations depending on your release and workspace). Any of these will perform the same result. When you are first learning to “drive” AutoCAD, chances are you will generally follow the exact method which you were taught. It’s not until you understand how the program works that you can speed up what you do by creating shortcuts.

I am always surprised to find that users with many years experience still perform functions the long way. Often it depends on what (or who) they have been exposed to at their jobs. It rings true for any trade – if you have an innovative mentor, you will be more innovative! With the technological information super highway we have so much information at our finger tips. There is just no need to plod along doing the same things, the same way, year after year, after year!

“How much difference can it make?” I hear you asking. If we measure key strokes performed in a day, then reduce them by only one key stroke, it compounds to a staggering saving in a year.

To increase your productivity, you don’t need to reinvent the wheel. If you don’t know where to start and you don’t have a resident CAD guru in your office, don’t despair! An Internet search will return countless results. Don’t be put off. Start your journey with that one step. It will lead to the next in a very short time.

Create aliases

The very first step which I took was to add some command aliases to my ACAD.PGP file. Aliases allow you to type one letter at the command line instead of the full word, such as E for Erase, C for Copy or M for Move. They cut out many key strokes. Editors note: In AutoCAD 2010, go to Manage tab> Customization panel> Edit Aliases to customize acad.pgp. You can also open acad.pgp from Windows in a text editor; its location varies according to your release and Windows version.

Part of the acad.pgp file

Part of the acad.pgp file

Write simple AutoLISP routines

The next step which I took was to write some very simple AutoLISP routines. I began my own AutoLISP file which I added to the Startup Suite. This means you do not need to load the routines individually each time you start AutoCAD. Editors note: To add a .lsp file to the Startup Suite, use the APPLOAD command. In the Load/Unload Applications dialog box, locate the file and drag it to the Startup Suite icon.

Drag AutoLISP files to the Startup Suite

Drag AutoLISP files to the Startup Suite

Some examples of these very simple routines are getting distance measurements with selected object snaps. For example, I sometimes need to obtain a distance nearest an object or line, then perpendicular to an object or line. The coding for this looks like: (defun C:DNP () (command “DIST” “NEA” pause “PER”))

Then, typing DNP at the command line allows me get the information I need. You might say that you can easily set OSNAPS and achieve the same thing, but the above coding ensures that the correct object snap is used every time. This can often be critical.

Editor’s note: The syntax is (defun C:[name] () (command “DIST” “[osnap]” pause “[osnap]”)) where [name] is the name of the custom command you are creating and what you type to execute it and [osnap] is any object snap you want to use. The pause command stops the execution of the routine for user input, in this case, specifying a point.

From here there are many more such command combinations that you can write using the same syntax, and substituting different object snaps, such as:

  • DII (distance from intersection to intersection):
    (defun C:Dii () (command “DIST” “INTERSECTION” pause “INTERSECTION”))
  • DEE (distance from endpoint to endpoint)
    (defun C:DEE () (command “DIST” “ENDPOINT” pause “ENDPOINT”))
  • DEP (distance from endpoint to perpendicular)
    (defun C:DEP () (command “DIST” “ENDPOINT” pause “PERPENDICULAR”))

Likewise, you can write many AutoLISP routines to draw lines using selected object snaps:

  • LINE command from Nearest, then Perpendicular to an object or line:
    (defun C:LNP () (command “LINE” “NEA” pause “PER”))
  • LEE (line from endpoint to endpoint):
    (defun C:LEE () (command “LINE” “ENDPOINT” pause “ENDPOINT”))
  • LME (line midpoint to endpoint):
    (defun C:LME () (command “LINE” “MIDPOINT” pause “ENDPOINT”))

Editor’s note: Here, the syntax is similar, but uses the LINE command instead of the DIST command.

Once you start writing these, you can easily add others. Even slightly more complex AutoLISP routines will become easy to write. For example, you can write AutoLISP routines to change system variables such as turning wipe out frames on or off.

  • To turn wipe out frames on:
    (defun C:WF1 () (command “WIPEOUT” “FRAME” “ON”))
  • To turn wipe out frames off:
    (defun C:WF01 () (command “WIPEOUT” “FRAME” “OFF”))

If you look closely at the coding, you will notice that the text inside the inverted commas [quotation marks] is what you would normally type at the command line.

Another series of handy AutoLISP routines is creating frequently used layers, setting their colour and setting them to current. For example, the company I work for specifies that all dimensions are drawn on a layer called “DIMS” which has the color 2 (yellow). The AutoLISP to create this layer looks like: (defun C:D2 () (command “-LAYER” “N” “DIMS” “S” “DIMS” “C” “2” “”))

You can then write extras to add many more layers such as a layer to draw hatches would look exactly the same as for DIMS with the appropriate substitutes. For example: (defun C:H2 () (command “-LAYER” “N” “HATCHES” “S” “DIMS” “C” “2” “”))

My company also has a dedicated layer for inserting external reference drawings called XREF. So, the code to create this and set it current looks like: (defun C:X2 () (command “-LAYER” “N” “XREF” “S” “DIMS” “C” “2” “”))

Here are some more of my favourites:

  • To lock or unlock viewports:
    (defun C:V0 () (command  “MVIEW” “LOCK” “OFF” pause “”))
    (defun C:V1 () (command  “MVIEW” “LOCK” “ON” pause “”))
  • To fillet lines using a zero radius:
    (defun C:F0 () (command  “FILLET” “R” “0”) (command “FILLET”))
  • To fillet using a supplied radius:
    (defun C:FR () (setq rad (getstring “\n Enter Radius:”))
    (command  “FILLET” “R” rad)
    (command “FILLET” pause pause)

Editor’s note: This last routine uses the setq AutoLISP command to set a variable named rad to the result of user input in response to the Enter Radius: prompt. It then uses the result to set the fillet radius.

The key to successfully boosting your productivity is to keep on learning. You will be surprised how much greater satisfaction you will get out of increasing your learning. Greater productivity leads to a win-win situation. Your employer will be pleased, and who knows — that may lead to greater remuneration. In this article, I want to encourage all users to embrace the latest and strive to be more productive each day!

Ellen Finkelstein

14 comments to Productivity boost ideas

  • Robert L. Lawrence

    I pasted your FR into a plain text file (Windows Notepad), saved it as FR.lsp, and then loaded it in AutoCAD 2008. It doesn’t work! When I type FR and then , ACAD halts. It doesn’t ask for input of any kind. I have to to get ACAD back to functioning.
    Am I doing something wrong?

  • Robert L. Lawrence

    When I type FR and then , ACAD halts

  • Robert L. Lawrence

    When I type FR and then press enter, ACAD halts

  • Robert, the quote marks in the examples above are not the same quotation marks as those next to the enter key on your keyboard. Autocad does accept them as valid input. Replace them with the quotation mark next to the enter key and that will fix the script.

    As for why autocad hung, I’m not sure on that one. It could just be the version of Autocad you’re using freaks out with the fancy quotes. (Btw Autocad 2010 doesn’t freak out and halt, it just returns an error.)

  • Also, for a momentary zero-radius fillet, (while in the fillet command) you can hold the shift key down while selecting the last object to be filleted.

  • Arg, I meant to say that Autocad does NOT accept fancy quote marks as valid input. Sorry about that.

  • Millish

    Making ‘Blocks’ whose Layers & Linetype information can be controlled & handled perfectly when inserted into any drawing, requires Extra Initial thought.

    The procedure is to make a Block of each type of information that is associated with the Main ‘Block(Machine/Item/Name)’ and then to combine them as nested blocks. i.e.

    1) Make a separate ‘Block’ for everything associated with the Main ‘Block(Machine/Item/Name)’, whose ‘Linetype’ has to be controlled/Varied, i.e. Make a ‘Block’ for the ‘Centre lines’, ‘Details’, ‘Outlines’, ‘Hidden Line Details’, ‘etc’.
    2) Ensure that the, ‘individual lines’, of all these ‘Blocks’, which are to be, ‘Nested Blocks’, are made & set to be on layer ‘0’ & that all their line-type information is set to ‘ByLayer’.
    3) After making each of the; ‘Nested Blocks’; make a ‘Layer’ whose name corresponds to the; ‘Nested Block Name’; & set the, ’Linetype’, Colour & Line information as they are required to be viewed. (i.e. Hidden, Continuous, Dotted, etc.)
    4) When finished move each of these defined, ‘Named Blocks’, (not the individual lines), to the layer that corresponds to their, ‘Nested Block Name’. (Then set the line-type information as they are required to be viewed in the Master / Main, ‘Block(Machine/Item/Name)’.
    5) After all the ‘Nested Blocks’ are made; combine them into the Master / Main, ‘Block(Machine/Item/Name)’, to make a single ‘Block’ which contains all the other ‘Blocks’ Nested within it.
    6) Finally Make & Move the Master / Main, ‘Block(Machine/Item/Name)’, to a layer that corresponds to its ‘Name’.
    7) When inserted into a new drawing you will have loads of Blocks & Layer names but each one will be controllable in that new drawing.

  • Alex

    How do a make a lisp comand for my different view prompts. Swiso,Nwiso,Neiso, etc…

  • admin

    Using the same format in the post for creating a command in AutoLISP and then entering what you’d type, you can do the following:
    SW Isometric: vpoint -1,-1,1
    SE Isometric: vpoint 1,-1,1
    NW Isometric: vpoint -1,1,1
    NE Isometric: vpoint 1,1,1

  • […] a comment on the post, Productivity Boost Ideas, someone asked about AutoLISP code for SE Isometric and other viewpoints. You can use the VPOINT […]

  • erik

    How would a routine work that will create different osnap combinations? Sometimes I only want endpoint snaps, other times I needa combination of center of circle, endpoint, perpendicular and intersection.

  • admin

    You could create a custom command for each combination that you want and put it on a toolbar or the ribbon.

  • Luis Duran

    I’ve included this code in my acad2011doc.lsp:
    (defun c:DD () (princ (CAL “dist(nea,per))(princ))
    Try it!

  • Robert

    use this for FR
    not originally written properly

    (defun C:FR ( / rad)
    (setq rad (getstring “\n Enter Radius: “))
    (command “FILLET” “R” rad)
    (command “FILLET” pause pause)

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>