CADTutor: The best free help for AutoCAD on the web
Michael's Corner RSS Feed

Michael’s Corner

Michael BeallMichael's Corner is a monthly publication written by Michael E. Beall, Autodesk Authorized Author and peripatetic AutoCAD trainer. Michael travels all over the USA, bringing his fantastic experience and great understanding of AutoCAD to his clients. Michael's Corner brings together many of the tips, tricks and methods developed during these training sessions for the benefit of all users.

Michael's Corner provides something for every AutoCAD user. Every month, a number of articles cover a wide range of topics, suitable for users at all levels, including "The Basics" for those just starting out. Essentially, the aim of Michael's Corner is to help all AutoCAD users work smarter and faster.

This month…

October - One-derful!!!

It's a God-thing.

I had no idea that 14 years ago I would be given the opportunity to make an impact on the professional lives of so many. Only God knew what was ahead, and hopefully, the contributions I have made through Michael's Corner have equipped many of you to be more productive and a bit more savvy using AutoCAD. And apart from all the AutoCAD bashing that is going on, I'm sure it has a long life ahead.

So, in an effort to keep the AutoCAD fires burning, here's what I have for my final installment…

…A reminder on how to customize your hot keys
…Three Power Tools — one for Zoom, one for editing, and one for Layers
…Two Odd Spots — one for Layers and one for Hatching
…Buried text treasure
…And how to Search 14 years of the Archives

As for what's ahead for me, I will continue to present a variety of AutoCAD sessions — Fundamentals, Intermediate, Customizing, Updates, and 2D & 3D. I will also keep training CAP Designer, 20-20 Worksheet, Visual Impression (those three from 20-20 Technologies, Inc.), and some Revit Fundamentals. Next year I'm looking forward to being very involved in training CET (from Configura, Inc.) when Herman Miller joins the growing number of manufacturers embracing this software that is being touted as the ‘Future of Space Planning’. Personally, I'm looking forward to spending a bit more time with Donna, my lovely bride of 30 years. When this posts, we'll probably be within days of going on our 30th Anniversary vacation to the Tanque Verde Ranch in Tucson; Ee-Hah! We had such a good time when we went for our 20th, we figured we'd do it again!

Ah, and I'm hoping to have The AutoCAD Workbench, Final Edition out before snow flies.

And with that, Mike drop! …so to speak.

The LORD bless you and keep you;
The LORD make His face shine upon you,
And be gracious to you;
The LORD lift up His countenance upon you,
And give you peace. Numbers 6:24-26

This month's articles

Change F1 to ESC
Smoother Zoom
Stretch with Extension
Lock Layers with a Crossing Window
Layer Columns & Hatch Background Color
Text Frame on Mtext

From the Vault

Originally published February 2012

Quick Lisps

Say that three times fast!

This month's Power Tool and Odd Sport articles each address circumstances where you need a temporary solution. Each solution could be automated by putting them on the Quick Access Toolbar or on your Tool Palette, but I wanted to change it up a bit and revisit how to create a one-line Lisp routine so you can just type the solution, not pick it.

The fundamentals of the following overview was originally posted 9 years ago(!) in Michael's Corner, February 2003, and can also be found in my book, The AutoCAD Workbench, beginning on page 203.

The example used here will incorporate the coverage of switching Visual Styles found in this month's Odd Spot article.

How to Write and Save a One-Line Lisp

  1. Open Windows Notepad (not Word, it puts hidden characters in the header and footer).

  2. First, it's always a good idea to identify what your routine is doing by adding a comment line at the beginning. Comment lines have a semi-colon as the first character on the line. Add something similar to the following as the first three lines in your notepad file.

    ; CADTUTOR February 2012 Lisp routines.
    ;
    ; Change Visual Styles. 2D Wireframe, 3D Hidden, & Realistic
  3. Add the following text as the fourth line. It's not case-sensitive and there is no preceding semi-colon:

    (DEFUN C:V2()(COMMAND "-VISUALSTYLES" "C" "2")(PRINC))

    Here's how all that stuff breaks down:

    (AutoCAD takes off if you hit the spacebar, so the first open parenthesis puts AutoCAD on 'hold'.
    DEFUNDEfine FUNction. You're telling the Lisp routine what you're setting up.
    C:The Command: line. The text that comes after C: is what you type to 'run' the Lisp.
    ()(The 'clutch'. Push it in ( change the gear ) let it out ( No options. Don't need to know.
    COMMANDFor all one line Lisps, you need to let AutoCAD know you are using Commands.
    "whattodo"All commands and options go in quotes. Yes, you can put a space between them.

    Many AutoCAD commands invoke dialog boxes or a drop-down panel, as found in Visual Styles. You will also find that many of those commands have a Command-line equivalent (which is necessary if you're going to key in the desired responses as we need to do in a Lisp routine). Commands launched with a leading hyphen display the options on the Command line. The equivalent for the Visual Style drop-down box is -VISUALSTYLES and you see the following option string:

    Enter an option [set Current/Saveas/Rename/Delete/?]: C
    Enter an option [2dwireframe/Wireframe/Hidden/Realistic /Conceptual/Shaded/shaded with Edges/shades of Gray/SKetchy/X-ray/Other]: 2
    "C"The option for 'set Current', as shown above.
    "2"The option for '2dwireframe', as shown above.
    (PRINC)Locking the door on the way out. Suppresses that 'nil' you see in some routines.
    )Resolve all the open parentheses.

    Here's what I put in my Notepad after the initial comment lines…

    ;
    (DEFUN C:V2()(COMMAND "-VISUALSTYLES" "C" "2")(PRINC))
    ;
    (DEFUN C:V3()(COMMAND "-VISUALSTYLES" "C" "3")(PRINC))
    ;
    (DEFUN C:VR()(COMMAND "-VISUALSTYLES" "C" "R")(PRINC))
  4. When you're finished adding your one-liners (you can have as many as you want, I would recommend comment lines between them, though), click FileSave, then navigate to AutoCAD's ..\Support folder.

  5. IMPORTANT: You must enter the file extension of .LSP after the filename, not Notepad's .TXT. I'll name this one CTFeb12.LSP.

As I mentioned, your .LSP file can contain as many one-liners as you want. I simply recommend you put comment lines in between each routine so you can reference it later and so it doesn't look so cryptic when you review it later.

How to Quickly Run a One-Line Lisp

  1. To test the routine created in the above exercise, open any AutoCAD and draw any non-orthogonal line, then draw a circle on one side of it.

  2. Open 'My Computer' (also called Windows Explorer) with Windows key + E.

  3. Navigate to where you saved your .LSP, then drag and drop it into the AutoCAD drawing window. You will see something like the following response on the command line:

    LOAD "C:/Program Files(x86)/Autodesk/ AutoCAD 2012-English/Support/CTFeb12.LSP")
  4. Drag and drop the lisp file

    To run your routine, enter VR (the text after DEFUN C: in your lisp file) and you should see your screen background change. If you have a 3D drawing open, you will see the drawing in the Realistic visual style. That's all there is to it!

Bonus Points

This month's Power Tool article addresses the toggling of the Selection Preview feature. The variable for that feature – as you will read, below – is SELECTIONPREVIEW. After reading the article, you should be able to add the necessary lines to your .LSP file to toggle on or off the Selection Preview feature at your leisure. I'll leave it to you to specify what follows the DEFUN C: to launch your options.

Launching Your LSP from the Startup Suite

LaunchIf you have a .LSP file containing routines that you want to have available whenever you open AutoCAD, add that file to the Startup Suite. On the Manage tabApplications panel you will find Load Application. In the Load/Unload Application dialog box, you will find the golden key: The Startup Suite.

The following instructions are also found on the 'AutoCAD Stuff' link on my website.

How to Add Your .LSP to the Startup Suite

  1. Startup SuiteClick Load Application [Manage tabApplications panel] to open the Load/Unload Application dialog box.

  2. Click the Startup Suite suitcase at the bottom (or Contents) to open the Startup Suite dialog box.

  3. At the bottom of the Startup Suite dialog box, click Add, then navigate to the .LSP files in the ..\Support folder (or wherever you saved that file).

  4. Select your .LSP file(s), then click Open to return to the Startup Suite dialog where you will see the file(s) listed.

    File listing
  5. Click Close, then Close out of the Load Application dialog box.

  6. To make them work, you will need to close and re-launch AutoCAD.

Note: There are several Lisp routines on my website on the 'AutoCAD Stuff' page. The Lisp files on that page are zipped for ease of distribution and the instructions are there, too.

Top of page

Local Navigation

Sponsored Links

Accessibility statement

Valid XHTML 1.0!Valid CSS!Creative Commons Licence