AutoCAD

Hot Tip Harry: Tips from Our Readers -- May 2006

9 May, 2006 By: Bill Kramer

This month's top tip allows you to erase inside a closed pline.


Great News for Harry Tipsters! Hot Tip Harry Challenge 2006, sponsored by Autodesk, just got better with even bigger prizes. You already know that the author of each published tip will receive a Cadalyst t-shirt, and the author of each month's best tip will receive $100 cash. Now, authors of all tips published in 2006 also will be entered into two year-end drawings. One lucky winner will receive a copy of AutoCAD 2007, courtesy of Autodesk, and a second winner will receive a trip to Autodesk University 2006 in Las Vegas, Nevada. For contest details and rules or to submit your tip, go to www.cadalyst.com/harry2006.

GET THE CODE
Download code for this and all articles. Look for MAY06.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 earn the author a Cadalyst
t-shirt, and the tip judged best each month earns the author $100. Click here for details about the Hot Tip Harry Challenge 2006.

E-mail those tips and tricks to harry@cadalyst.com.

Springtime and the tipsters are blooming! Harry brought a colorful bouquet of tips and utilities that were uploaded this month. Seems there is no limit to the innovation and imagination of AutoCAD users and Harry's tipsters. Check out these tips -- I'm sure you will find something you can use or at least play with.

Readers sent in several new hatch patterns. To use a hatch pattern, copy the PAT file into one of AutoCAD's support folders. Run the Bhatch command, select the Custom type, and then pick the hatch pattern of choice. You'll be able to select from the custom PAT files in the search paths.

You'll find a very intricate pattern in Bird's Eye Maple Wood Cross Hatch Pattern (Tip #2108) from Theresa Poole. Theresa recommends drawing a 12"X12" square then inserting the hatch inside with the scaling factor set to 3 and a rotation angle of around 10 degrees. Harry was thinking of redoing his programming room in maple after playing with this crosshatch pattern!

Jay Thomas sent in Perforated Metal Cross Hatch Patterns (Tip #2109). This set of hatch patterns has different sizes based on how much open area you want after the perforation. The values range from 23% open area to 58% (the file named PERF23.PAT is for the 23% open area, etc.). Set the scale factor of the hatch to match the desired hole size such as 0.5 for one-half-inch holes. This nice set of patterns is perfect for rendering prefabricated metal.

Sometimes simpler is better. Just One Copy Please (Tip #2110) is a Bill Bratt creation that brings home the point. The AutoCAD Copy command assumes you want to make multiple copies of anything you select. Bill wanted a version that only made one copy and returned to the Command line. His creation is a simple LISP macro named CC that accomplishes just that. Load the LSP file and type CC at the Command line. The rest is just like the AutoCAD Copy command, except that after one copy the Command line returns.

Fillet a Corner Full of Lines and Polylines (Tip #2111) from Lanny Schiele is a power tool with a specialized purpose. This utility is applied to a corner where many intersecting lines need filleting with variable radii to maintain a constant offset. Instead of selecting each line pair and calculating the new radius value, load the LSP file and type MFILLET at the Command line. You need to input four points and the inside-most radius value. After supplying the radius for the inner corner, pick a point inside the corner group followed by a point outside the group crossing lines and polylines approaching the corner from one side. The virtual line between these two points should intersect with all the lines and polylines coming in from a given side. Next, the program will request the inside and outside points covering the lines from the other side. The rest is automatic and quite impressive. This utility demonstrates some very sound programming methods and exploits some of the powerful VLAX functions in Visual LISP. Great programming, Lanny, and thanks for another wonderful tip!

You can find another advanced bit of programming in ISO Dimensioning Tool (Tip #2112) by Jeffery P. Sanders. As frequent contributor Jeffrey puts it, "I guess everyone has to try to create their own version once." Isometric dimensioning is something that seems easy until you start to dig into the details and run into exceptions as well as intuitive concepts that vary from operator to operator. This utility runs in a manner like the regular AutoCAD dimensioning commands, so there is no need to explain the details. However, if you really want to exploit this marvelous utility, then you need to dig into the LISP code itself. Fortunately for those of us who like digging into the code, Jeffrey is a talented programmer who includes meaningful programmer comments in his creations.

Text Inside a Rectangle (Tip #2113) from Steve Maher is handy LISP program that asks you to select the two corners of a rectangle and an existing text object. The text object is then moved to the center of the rectangle. There really is no limit to the imagination, and this utility demonstrates yet another way to draw a label in a drawing. Thanks, Steve!

Attribute Data Extractions (Tip #2114) by Robert Zipprich is a specialized LISP program that will require some tweaking to work properly with your computer and drawings. The main variables that you need to change include an output file name and the name of the block containing the attributes you want extracted. From there it's easy because the program runs as it is loaded (check the source code and make the edits before you test the macro). Given a good block name in the drawing with attributes, the attribute data is written to a specified text file. This utility is a nice way to help keep track of drawing header or border data that you can attach to other specialized applications monitoring saves or plotting activities.

Add REF Note to Dimensions (Tip #2115) from David Whitlow is one of those handy LISP macros that is simple, sweet and gets the task done. Load the LSP file, type REFDIM, and then pick any dimension object to have the letters REF appended to the dimension value. Only a couple of lines long and yet so useful!

Offset Command Variations (Tip #2116) by Kevin Sawyer is a pair of utilities for creating objects offset from an existing object. Two LSP files are in the set. OFSETCUR will do a regular AutoCAD Offset command and duplicate the properties of the original object to the newly created object. MOVOFSET erases the original object after creating the offset object. To use these new functions, load the LSP file and type in the command name OFSETCUR and MOVOFSET, respectively. Just goes to show you how easy it is to blend LISP logic structure with AutoCAD commands to make your job easier.

Erase Inside a Closed Pline (Tip #2117) from Pedro Ferreira is this month's top tip. Load the LSP file and type XERASE to make it happen. All you need to do is select a closed polyline object, and the rest is automatic. Everything found completely inside the closed polyline is erased just like using the Fence Window selection. This function uses the Visual LISP VLAX functions and is a sweet example of how easy it is to manipulate lists of points. Thanks for the great tip, Pedro!

Whew! That's a lot of tips and quite a spread of options for everyone to enjoy. Harry thanks all the tipsters that sent in tips this month and looks forward to sharing more of them in the future. Keep on programmin'.


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
At your company, who has the most say in CAD-related software purchasing?
CAD manager
CAD users
IT personnel
vice-president/department manager
CEO/company owner
Submit Vote