Hot Tip Harry15 Apr, 2004 By: Bill Kramer
Tips to measure lengths, make patterns, tidy your text, and more.
Harry really liked the two functions supplied by Will DeLoach because they show the true power of Visual LISP to create utilities. Tips #1939 (C:LL) and #1940 (C:OL) are two great examples of how Visual LISP works well with AutoCAD objects. The first is a command function named (C:LL) that you use to measure the length of linear objects. Load the file HTH1939.LSP and type LL. Select linear objects such as lines, arcs, polylines, and so forth. By using the Length property of AutoCAD objects, this function quickly computes the sum of lengths. Will's second tip is found in file HTH1940.LSP and named OL, for offset line. This function creates a pair of offsets on either side of a linear object with the option to remove the original center object when finished. It's useful for drawing walls, highways, and other offset groups.
Once again, Harry was pleased with Watson Kilbourne's patterns. Tip #1941, stored in HTH1941.PAT, draws a herringbone pattern, and Tip #1942 (HTH1942.PAT) creates a batten pattern. Bravo, Watson!
Tip #1943 from Theodorus Winata, found in file HTH1943.LSP, contains a Visual LISP command function that merges text objects. This function is quite helpful when you want to line up a series of notes. Place text notes as you work in the drawing off to the side. Then, to run the program, load HTH1943.LSP and type JMT. The routine asks you to select two text objects. The result appends where the first text object is. The second text object selected is added to the end of the first as a new line. When you select an mtext object with multiple text lines first, the program adds the merge text at the bottom after it adds a new line. When you select a regular text object first, the merge text appears with the expanded characters for mtext appended to the end of the original string.
Theodorus also provides us with another great function that uses dialog boxes and integrated slides for helpful graphics to guide you through creating a breakline. Tip #1944 is supplied in a compressed file named HTH1944.ZIP that contains three files, all named LSB. Place these files in your AutoCAD search path. To use the custom breakline drawing utility, load the Visual LISP code stored in LSB.LSP, then type LSB at the Command line. A dialog box appears to help you draw breaklines and tubes quickly. This is a nice example of a parameter-driven function that uses a graphic dialog box. Thanks for the tips!
Another example of meaty AutoLISP code is a useful application for inserting weld symbols, Tip #1945 from Jerel Walker. It comes compressed in HTH1945.ZIP. This tip was written in Visual LISP and includes a dialog box to select the symbols you want to use. Save the LSP and DCL files in your AutoCAD search path and load WELD.LSP before typing Weld at the AutoCAD Command line. Weld has a series of fields in the dialog box that you select to build the type of welding symbol you want to draw. This is a great example of parametric programming.
When you load Tip #1946 from Mike Hauptman, the (math) function is available from the Command line to perform simple arithmetic functions in a dialog box. Run Math, then type 1+3 and press KEEP 'EM COMING
Harry and all involved thank everyone who submits tips for consideration. See the box below on how to submit a tip. All types of tips are welcome, including menus, patterns, symbols, Visual LISP, VBA, and ARX.
KEEP 'EM COMING
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor Lynn Allen guides you through a new feature or time-saving trick in every episode of her popular AutoCAD Video Tips. Subscribe to the free Cadalyst Video Picks newsletter, and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!