Hot Tip Harry: Tips from Our Readers -- May 20069 May, 2006 By: Bill Kramer
This month's top tip allows you to erase inside a closed pline.
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'.
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!