Hot Tip Harry: Tips from Our Readers -- November 2005

14 Nov, 2005 By: Bill Kramer Cadalyst

From attribute editing utilities to calculating your fuel mileage, Harry's tipsters keep you on top of your game.

Download code for this and all articles. Look for NOV05.exe in Get the Code. Downloads are free and are provided "as is" without warranty or support.

Tips are tested using AutoCAD 2006, 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 using AutoCAD 2006. Tips that are missing functions or other necessary elements will not be considered.

All published tips are entered into the annual Hot Tip Harry Contest. From a pool of reader-selected monthly winners, our judges will pick the Top Tip for 2005. The first prize is $1,000. Second place wins $500 and third place, $250. E-mail those tips and tricks to

As the tips for this column arrived, Harry's tipsters seem to have that fact on their minds. Let's get right to them!

Miles Per Gallon (Tip #2066) from Corey Smith is a very simple LISP routine to calculate your gas mileage after a fill up. Load the LSP file and type MPG to activate. Now supply the odometer reading from the previous fill up, the current odometer reading and how many gallons of gasoline were purchased. The computer then displays the miles per gallon you obtained between the two fill ups. Corry said the idea came to him while filling up and watching the price climb. After searching the Web, he could not find a utility to do the simple calculation. Well Corey, here it is and you wrote it!

Next up is a pair of tips sent in from previous tipster Jeffery Sanders. Select Plotter (Tip #2067) presents a list of currently available plotters for you to select. When one is picked, the name of the plotter (as displayed in the dialog box) is returned. This tip is a utility for LISP programmers and not a command function. The utility consists of two files, SELECTPLOTTER.LSP and SELECTPLOTTER.DCL, both of which you need to place in the standard AutoCAD search path for custom programs. When the function (SelectPlotter) is run inside AutoCAD, a dialog box shows the available plotters for your selection. Nice tip for programmers wanting a peek into the plotter system and other AutoCAD areas that are not often demonstrated

Jeffery also sent Incrementing Attribute Values in Blocks (Tip #2068). Place the LSP and DCL files in a folder known by AutoCAD's search path. Load the ATTINC.LSP program file, and then type ATTINC at the AutoCAD Command line. The first request is for a block inserted into the current drawing with at least one attribute. If you select a proper block with attributes, then a dialog box appears. The names of the various tags will display along with two edit boxes to supply the initial value and the increment. The values of the attributes are then updated automatically in the drawing in either the order or insertion or the reverse order of insertion.

Increment Attributes (Tip #2069), from Michael Murphy, appears similar to the previous tip at first, but it is different. First, the program is written in VBA (supplied as a TXT file, which you must import into an empty project and press the Run button). Second, the program searches for attribute values containing a matching prefix and, when located, increments the trailing numeric values. Just supply the prefix string for the pattern match and the value to increment. The rest is automatic. Nice job, Michael -- very useful when working with lots of attribute labels.

Attribute Layer Match (Tip #2070), from Craig Klein, is the last of the attribute edit utilities for this month. Load the LSP file into AutoCAD and type MAT at the Command line. The utility first requests that you select an object representing the layer you want to use. Then select the additional attributes that need to have their layer changed. This time-saving editing utility was Craig's first foray into LISP, and we all are richer for his efforts!

Displaying the Drawing Scale in a Text Object (Tip #2071) is from veteran tipster Leonid Nemirovsky. Just load the LSP code, type SCL at the Command line, and locate where you want to display the scale of the drawing. The scale value is displayed as the text string Scale: 1" = 1'-0". This function takes the current drawing settings as input and demonstrates the power of LISP to get the job done.

Wm. J. Townsend supplied two tips for us to contemplate this month. Date Stamp (Tip #2072) creates a casting stamp for the date. According to Mr. Townsend, a casting stamp appears as a circle with the year in the middle of a circle of numbers 1-12. The month is circled and provides a visual representation of the month and year when sorting through large lots of drawings. Load the LSP code and type in CDS at the Command line. You will need to show or enter the various points needed for the function as it draws the casting date stamp.

Draw Gear Set Label (Tip #2073) is also from Mr. Townsend. This excellent example shows how you can use LISP to create custom detailing commands of your own design for your specific industry. Load the associated LSP file and type GS2 or GS3 for a two gear or three gear set annotation. This function does not draw the gear details. It creates a label for a set of gears. First select where the label points, and then select the label location and fill in the required answers for describing the gear set.

Our last tip for the month is a redo of a prior tip. Al Rogers originally wrote Steel Sections (Tip #1779) in 2002. This winning tip had a few problems in a metric environment, so Australian reader John Baister took the time to create a fix. Resubmitted for your approval is Metric Steel Sections (Tip #2074), which takes the original and makes it better. Place the contents of the ZIP file into a folder known to the AutoCAD search system and load the LSP file. Type STL to activate the Command line, and a massive dialog box appears with lots of steel section drawing options. If you draw steel sections, take a look at this powerful tool for AutoCAD. Thanks and a tip of the hat to John for sending this great update.

Keep those tips coming in -- your input is what makes this database exist!

About the Author: Bill Kramer

More News and Resources from Cadalyst Partners

For Mold Designers! Cadalyst has an area of our site focused on technologies and resources specific to the mold design professional. Sponsored by Siemens NX.  Visit the Equipped Mold Designer here!

For Architects! Cadalyst has an area of our site focused on technologies and resources specific to the building design professional. Sponsored by HP.  Visit the Equipped Architect here!