Pleasures of Customization (Hot Tip Harry AutoCAD Tutorial)

30 Jun, 2008 By: Bill Kramer

An object query function earns Harry's kudos as July's Top Tip.

Download code for this and all articles. Look for JUL08.EXE or JUL08.ZIP in Get the Code. Downloads are free and are provided "as is" without warranty or support.
Tips are tested using AutoCAD 2008, unless otherwise noted. By submitting code to Cadalyst, you grant Cadalyst the right to print and distribute your code in print, digitally and by other means. Cadalyst and individual authors retain all rights to the code, and it is not to be used for commercial purposes.
Important note: Be sure your submission contains all elements required for it to run independently in AutoCAD. Tips that are missing functions or other necessary elements will not be considered.
Join the Hot Tip Harry Hot Code Contest
Calling all tip writers! The Hot Tip Harry Hot Code Contest is under way for 2008.
Share your hot tips and tricks and you could win an official Cadalyst t-shirt, $100 monthly cash prize, and a chance to win a trip to Autodesk University 2008 in Las Vegas!
E-mail those tips and tricks to
For More AutoCAD Tips More Often: Check out Cadalyst's free Tips & Tools Weekly e-newsletter. View the archives and subscribe today!
Harry's Code Class Free E-Newsletter:
Learn from the master himself. "Hot Tip Harry" author Bill Kramer offers monthly lessons in customization programming for AutoCAD. View the archives and subscribe today!
One of the greatest pleasures you can experience as an AutoCAD operator is when a custom program works just the way you want. This month Harry applauds everyone who has ever ventured into the realm of customization tools and made it happen. He also would like to share the following tips supplied by readers just like you.

Tip 2299: Set Scaling Factors
Set Scaling Factors by Jon Jonas is a handy little setup tool that adds standard architectural scaling factors to a current drawing. Load the LISP code and type Sclcvlarch. This routine only needs to be run once per drawing, and you can adjust the source code to match the scaling factors that you use for your work or use Jon's standards. Short and sweet gets the job done.

Tip 2300: Multiple Line Extensions
Ron Perez has three tips among Harry's favorites this month. The first one, Multiple Line Extensions, is a power tool that uses the object-level intersection method in Visual LISP. Your drawing must have an enclosing polyline or circle, along with lines that need to be extended to meet the enclosure. This routine extends all lines to the closed boundary. It also recognizes internal boundaries. To use, load the LISP code and type Mextend. After you draw a window around the area of interest, the rest is completely automatic. Two animated GIFs included with the download file show how the function works. Great programming, Ron!

Tip 2301: Quadrant Snap
Quadrant Snap, submitted by John Loudermilk, locates points at the 45°, 135°, 225°, and 315° angle points based on your point selection. This function is for use inside AutoCAD commands. To use this utility, load the LISP code and type (QS) when one of AutoCAD's commands is waiting for a point input. When (QS) runs, you will be asked to select the quadrant of an arc or a circle. The point you select is used to determine which quadrant was picked and is then reset to match the exact halfway point of the quadrant. You might consider modifying this routine to work inside other functions of your own design. John, thanks for a great example of how to use LISP to make AutoCAD work the way you want.

Tip 2302: Draw Stair Sections
Jay Thomas sent in a utility called Draw Stair Sections, which automates the process of calculating and drawing stairway components in AutoCAD. The download includes the LISP code with an associated dialog box (DCL) and slide library (SLB) that should be located in the AutoCAD search path, as well as a text file (TXT) that explains how to use this marvelous productivity tool. Load the LISP code and type StairSec at the AutoCAD Command line to start. Thanks from everyone who draws stairs in their plans, Jay -- you just made life easier.

Tip 2303: Block Flipper
The second genius routine from Perez is Block Flipper, a command function that rotates selected blocks by 180°. (One caveat: This routine will not rotate blocks found on locked layers.) To use this utility, load the LISP code into AutoCAD and type BR-180 at the Command line. You will be prompted to select objects -- a filter is applied to only allow Insert object selection -- which will then be rotated 180° after you have completed the selection. Nicely done, Ron.

Tip 2304: Query an Object
Top TipPerez's third tip earns this month's Top Tip prize. Query an Object displays information about an entity object that you select. Although most of the data presented is also available through the Properties dialog box, this function provides a few additional twists, such as checking for layers that can be plotted and for nested entity information from inserts and external references. Most important, from Harry's perspective, is the fact that you can study and modify this routine to make all sorts of useful functions that Harry hopes you will share with him and the readers of Cadalyst.

Thanks for all the great tips! Let's hope they inspire others to send in their handiwork and get a cool Cadalyst T-shirt -- perfect summer wear, not to mention the uniform of a true AutoCAD guru.

Until next month, keep on programmin'.

Join the Hot Tip Harry Challenge
Harry needs your tips! Do you have an original routine written in VBA, Visual LISP, or even ObjectARX for AutoCAD customization? Send it in, with all the source code, to Your tip may be needed by others now, so don't delay!

Subscribe to Harry's Code Class
Cadalyst's Hot Tip Harry helps programmers and programmer wannabes learn the ins and outs of AutoCAD customization in his monthly e-newsletter, Harry's Code Class. Subscribe to Harry's Code Class today and start building your programming expertise.

Hot Tip Harry Discussion Forums
Harry is standing by online to aid AutoCAD users and programmers. Cadalyst's Hot Tip Harry -- Help! Discussion Forum offers assistance with AutoCAD programming and customization problems. Hot Tip Harry -- Requests Discussion Forum can help you locate a specific LISP or VBA routine for AutoCAD. Participation in Cadalyst Discussion Forums requires registration, but it's free.

Get Your Weekly Fix of AutoCAD Tips
Cadalyst's Tips & Tools Weekly e-newsletter mails each Monday, delivering AutoCAD tips by readers for readers -- all reviewed by Cadalyst's volunteer Tip Patrol. Plus, you'll receive a rundown of new online CAD resources, deals and freebies, new CAD-related hardware and software products, and more. View the Cadalyst Tips & Tools Weekly archives and subscribe today!

AutoCAD Users: Check out Cadalyst Tips & Tricks Tuesdays
All it takes is a minute or two, and you could be off to more productive use of AutoCAD. Cadalyst announces Tips & Tricks Tuesdays with worldwide AutoCAD Technical Evangelist Lynn Allen. Each Tuesday, Lynn and Cadalyst bring a new, super-quick tip to the Cadalyst Video Gallery. Subscribe to Tips & Tricks Tuesdays and receive an e-mail notification every time a new tip goes live in the Cadalyst Video Gallery.

About the Author: Bill Kramer