Management

Hot Tip Harry

15 Nov, 2004 By: Bill Kramer Cadalyst

Utilities to toggle grips, sort text, and organize your routines.


GET THE CODE
Download free code for this and all articles. Look for NOV04.exe in Get the Code.

Tips are tested with AutoCAD 2005, 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. All published tips are entered into the annual Hot Tip Harry Contest. Find out more online, and e-mail your tips and tricks to harry@cadalyst.com.

THERE SHOULD'VE BEEN A hurricane named Harry based on the way the tips have been coming in. Or you could say that the tip harvest has been bountiful. Either way, Harry?s beat-up old laptop was loaded with new tips.

Pattern Man
"Been seeing a lot from the old timers lately," Harry said. "You remember Watson Kilbourne, right?"

How could we forget? Watson's the king of the hatch patterns. He's submitted more than 100 tips for publication in Cadalyst dating as far back as 1988. You can see the full scope of his hatch talents at www.compugraphx.com. Here's another one?Limestone Crosshatch (Tip #1989). The pattern creates a nicely spaced and random-looking limestone crosshatch using the Bhatch command. Place the limestn.pat file in a common search directory, and it will be available as a custom pattern.

Utilities Galore
Grip Toggle (Tip #1990) is a simple example of the power of AutoLISP from Larry Moore. Once the LSP file is loaded at the command line, type Gripper to toggle the AutoCAD grips setting. This function serves as a great example of how to program a suite of powerful utilities.

Another simple utility is Line to Wall (Tip #1991) from Justin Werner. This function accepts the user selection of a line object and then creates two offset lines that represent the edges of a wall. The original line is then erased. After loading, type the function name L2W and select a line. The wall thickness must then be input for the offset. The routine instantly creates two offset lines and removes the original from the drawing. This is a great example of how AutoCAD commands mesh nicely with AutoLISP code.

Our next tipster, Tracy Coles, submitted two excellent tools, Sort Text (Tip #1992) and Add Text Up (Tip #1993). Sort Text lets you select a group of text objects to sort into alphabetic order. The sorted text is output as new text objects in a column. You select the location of the new text at the beginning of the routine and then select the text objects to be sorted. The sorted text is displayed at the location provided earlier.

Add Text Up is a pair of utilities that adds the numeric values of text and then places the resulting sum in another text or attribute location. The AddEmUp function is available once the LSP file loads. Type Addemup at the command line and select text objects that contain numeric values. Once you've selected the last one, press . The current sum is displayed, and you have the option to select a text or attribute object for the text value to replace. This utility is handy for complex bills of materials. A companion utility in the LSP file adds text elements found inside a window selection. See the source code for more information.

Another regular contributor, Leonid Nemirovsky, shares a utility that adds the values in a table created in AutoCAD. Sum Table Values (Tip #1994) is a Visual LISP macro set. Load the LSP file and then type TTR to activate. The first selection is for a table object. Older versions of AutoCAD can't use this utility because they don't support the table object type. Once a table is selected, the TTR function lets you add the values of a given column identified using an integer value from 0 to the number of columns minus one. This is another handy utility to have around when creating bills of materials.

Grill Window (Tip #1995) from Richard Schwier is a nice parameter-driven drawing program. This program draws a frame and grill for a security window. Load the LSP file and type in Grille. It asks you to enter the frame and grill bar parameter values, and then the program magically creates a detailed grill front and side view. This is a marvelous example of how AutoLISP can be used to drive AutoCAD into the expert system level.

Organize your LISP routines
Our last tip is one of Harry's favorites. Another frequent contributor, Jeffery Sanders, provides LISP Manager (Tip #1996). If you have a directory full of LSP files and are never sure what each one does, this utility gets you organized. The first line of the LSP file is used to house a descriptive comment that you can add and edit. Now you see a list of all your AutoLISP files and a description of what each contains. Brilliant! This is one of those tools you should download, use, and understand so you can customize it to your own specific needs.


About the Author: Bill Kramer


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