Tips from Our Readers -- October 2007 (Hot Tip Harry AutoCAD Tutorial)1 Oct, 2007 By: Bill Kramer
This month's winner is a great plot-management tool that you can easily customize to suit your needs.
This month, Harry has collected a variety of tips submitted by users like you, including a custom hatch pattern, Visual LISP power tools, and a plot-management system that demonstrates how easy it is for VBA to command Visual LISP. Harry was wowed by the complexity and robustness of these routines. Let's take a look at what he uncovered from the back alleys and trenches of the AutoCAD world.
Tip 2243: Complex Tile Hatch Pattern
First up is a hatch pattern from one of Harry's favorite pattern makers, Watson Kilbourne. This one is for laying out a complex tile pattern of nine small tiles surrounding a larger one. Copy the pattern file (PAT) into a folder searched by AutoCAD. Next, start the hatch command by selecting the custom hatch pattern option. Pick the 9x9lines pattern and proceed as usual. The resulting hatch pattern can be used to lay out tile for a room. Great stuff, Watson! As always, Harry is impressed.
Tip 2244: Polyline Subtract
Polyline Subtract came in from Peter Kitter -- with a little help from some online friends. The purpose of this routine is to automate the editing of a closed polyline border by subtracting regions defined by other closed polylines -- extremely useful for mapping and layout work. The result is a new polyline border comprised of the original border with modifications. The modifications are the intersecting closed borders broken apart and attached toward the inside of the original border. Thus, one polyline area is subtracted from another to create a new polyline. To use this tip, load the LISP code into AutoCAD and type Pls. First select the outside border polyline. You can select multiple polylines as outside borders. Next select the inside border polylines. The rest is automatic, although the process can take a few seconds depending on the complexity of the geometry. This problem isn't easy to define, yet the code is very straightforward. Nice job.
Tip 2245: Date Reminder
Ramakrishna Acharya's Date Reminder is an example of how you can use Visual LISP to help you remember task deadlines and other important dates. AutoCAD will present the reminders you specify on the dates that you define. In the file download, you will find a DOC file that describes how to integrate the program into your environment for automatic operation. Or, you can manually load the LSP source file, then type Reminder to display a list of upcoming important dates. A sample file of dates, DATE.REM, is supplied for you to expand and change using Notepad. Each line in the file is a date of interest, with the date listed in DD.MM.YYYY format followed by the reminder note that you want to display automatically. This is a wonderful tool for personalizing AutoCAD. Thanks for the tip, Ram!
Tip 2246: UCS Made Easy
UCS Made Easy from Andrew Siddeley is a power tool that you can adapt to your own needs. The idea is to make flipping from one standard UCS to another quick and easy. After the LISP code has been loaded into AutoCAD, enter the command UZ. A dialog box appears and shows a series of possible angles rotated about the z-axis for a new UCS. Pick one, and it is set up for you. Inside this tip you will find a very interesting approach to dynamic dialog box creation. Andrew set up a series of functions to define dialog box components that are used to create a massive string with the entire dialog definition. When ready, the dialog box definition is written to a file ready for use inside the application. This function set also has some clever list manipulations going on inside. All in all, it's a brilliant tip -- useful as is for many -- and an interesting approach to coding.
Tip 2247: Lines from a Point
Subash Babu Podichetty created the utility Lines from a Point. Have you ever wanted to draw a series of lines with a common endpoint? If so, this utility is exactly what you have been looking for. Load the LISP code and type PTLines to activate the function. The first point you select will become a common origin point for a series of lines defined by subsequent point entries. Press Esc to quit defining lines from the common origin point. This tool is handy for a variety of drawing disciplines, and it's something to consider as a menu addition for custom work.
Tip 2248: Layer Manipulation
Robert Gardner's Layer Manipulation is a solution for "getting rid of those pesky layer-name prefixes" when xref objects are inserted in a drawing. This function will read through each layer name in the layer table, and any found with the string "$0$" will be truncated to remove the string of text that appears before the "$0$" as well as the "$0$." For example, a layer named Test$0$mytest is changed to Mytest. If a matching layer name already exists, then an "X" is added to the beginning of the layer name. To use this tip, load the LISP code, then type Xreflay. The rest is automatic. This utility is a great example of the power of Visual LISP to make AutoCAD work the way you want.
Tip 2249: Force All to Layer Zero
Force All to Layer Zero comes from a Hot Tip Harry Discussion Forum guru, Leonid Nemirovsky. Other functions out there let you change layers, but this one goes one step further by attaching the original layer as extended data to the entity object. The attached information then can be used to undo the layer change. Using this utility set is easy. An associated DCL file should be placed in an AutoCAD folder. Load the LISP code and type XD. A dialog box appears with the option for you to name a layer. If nothing is supplied, then layer 0 will be used. Select the Attach Layers option to shift all the entities to the same layer. Select Restore Layers to reverse the process using the extended data to restore the original layer settings. Here's a tip of the hat from Harry for delivering yet another interesting solution for all. Thanks, Len!
Tip 2250: Batch Plot Manager
This month's top tip, Batch Plot Manager by Terry Miller, is designed to let users plot a series of drawings such as all the currently open drawings, an entire folder of drawings, or a set of layouts. The code will require revisions before it will be useful for you. (Knowledge of Visual LISP isn't required to make the needed changes, but it's helpful.) At a minimum, you'll need to change embedded details regarding plotters, printers, and users. You may want to make other changes as well, depending on your needs. The real gem here is deep inside the function set. The source code details a lot of options and includes comments to assist in controlling your plotters. Also intriguing here, you'll find that VBA runs and controls Visual LISP to allow the function to run across multiple drawings. I highly recommend that anyone thinking about writing a customized plot-management tool start with this tool as a base. It's well structured and easy to read and modify. Terry, congratulations on earning this month's $100 top tip award -- great job!
Until next month, keep on programmin'.
Join the Hot Tip Harry Challenge
Harry needs your tips! Do you have an original routine written in VBA, Visual LISP, or even ObjectARX for AutoCAD customization? Send it in, with all the source code, to firstname.lastname@example.org. Your tip may be needed by others now, so don't delay!
Subscribe to Harry's Code Class
Cadalyst's Hot Tip Harry helps programmers and programmer wannabes learn the ins and outs of AutoCAD customization in his monthly e-newsletter, Harry's Code Class. Subscribe today and start building your programming expertise.
Hot Tip Harry Discussion Forums
Harry is standing by online to aid AutoCAD users and programmers. Cadalyst's Hot Tip Harry -- Help! forum offers assistance with AutoCAD programming and customization problems. Hot Tip Harry -- Requests can help you locate a specific LISP or VBA routine for AutoCAD. Participation in Cadalyst Discussion Forums requires registration, but it's free.
Get Your Weekly Fix of AutoCAD Tips
Cadalyst's Tips & Tools Weekly e-newsletter mails each Monday, delivering AutoCAD tips from readers -- all reviewed by Cadalyst's volunteer Tip Patrol. Plus, you'll also receive a rundown of new online CAD resources, deals and freebies, the past week's new CAD-related hardware and software products, and more. View the archives and subscribe today!
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor and Autodesk Technical Evangelist 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!