Tips From Our Readers15 Jul, 2004 By: Bill Kramer
Draw rigid insulation, line up text, measure areas, and more.
First up was a tip from the Pattern Man, Watson Kilbourne. "He's at it again," Harry said. "This guy is amazing." This month, Watson sent another of his elegant hatch pattern descriptions-this one for roofing shingles (Shingle Hatch, Tip #1961). Copy the PAT file into AutoCAD's support directory and select it inside the Bhatch command as a custom pattern.
Another familiar name was next on the list. Theodorus Winata submitted a utility that makes life easy when drawing rigid insulation along a line or arc. Rigid Insulation (Tip #1962) is an AutoLISP function that lets you select a graphic object for insulation hashes to follow. After you load the LSP file, type RAL at the Command line to start the command.
It asks you to select an arc, a line, or a polyline. Then choose or type the size and the side where the hatches should appear. This tip demonstrates the power of blending parameter and entity data with commands to create powerful tools.
Tommy Teague supplied a great example of combined parameter input with repeated AutoCAD commands in his Cut Window (Tip#1963) utility. This handy function lets you cut and trim objects inside a closed boundary by repeating the Trim command. Load the LSP file and type in CA or Cleararea to activate the command. Select a series of boundary objects and an inside point-the rest is automatic.
This clever routine leverages the AutoCAD commands inside AutoLISP and lets you open up a window for placing other graphics or text. Note that objects you want to trim out of the enclosed area must be the kind that can be trimmed.
Text Spacing (Tip#1964) from Tracey Richmond lets you quickly move text objects so that they line up in a neat paragraph. After loading the LSP file, type TS to start the command. The first text string you select is the top of the paragraph. Each text string you select after that is placed below the first. It's important to make drawings neat, and this tool makes that task easy when working with sporadically placed text objects.
Autodesk Architectural Desktop users should take a look at AEC Extract Automation (Tip #1965) from Dina Jacobson. This utility automates the schedules extraction process for a project. This nice, well-written routine shows the use of extensions in AutoCAD that relate to Architectural Desktop. This is also worth looking at as an example of good error processing.
Harry was reluctant to show the next tip. "This one is dangerous-I wasn't sure if you'd want to see it." Sure enough, he was right. I knew this guy, a parentheses slinger out of the South with a thick accent and a love for surf and turf. Master programmer Will DeLoach supplies us with a way to access a plot object inside AutoCAD. Plot Object Select (Tip#1966) contains a set of AutoLISP functions and a dialog box definition. As with all DCL files, place it in a directory that AutoCAD automatically searches.
Load the function set and type the command Change_page_setups. A dialog box appears in which you can select from the different plotter setups. This is an advanced function set that demonstrates how to access AutoCAD's application object and plot object system from inside Visual LISP. Very nice, Will. Your work is inspiring-as in the next tip.
Dean Langmaid saw an earlier tip from Will for measuring line distances and wondered if it could be adapted to measure the area property instead. Sure enough, his curiosity paid off. Object Areas (Tip#1967) calculates land use, so the output values are in acres. You can adjust that to match you own requirements.
BRING ON THE VBA
Harry appreciates all code submissions. Are there any VBA or ARX tips out there you'd like to share? Remember to add comments and use meaningful variable names when possible. Other people will be reading the tips submitted to Harry, so keep it neat and clean.
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!