Hot Tip Harry: Tips from Our Readers -- November 200514 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.
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!