AEC

Hot Tip Harry: Tips from our Readers -- March 2005

15 Mar, 2005 By: Bill Kramer Cadalyst

Automatic call-out numbering, object shadowing, copying objects to the Windows clipboard and three drawing management tips.


GET THE CODE
Download free code for this and all articles. Look for MAR05.exe in Get the Code.

Tips are tested with AutoCAD 2005, 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. Downloads are provided "as is" without warranty or support.

All published tips are entered into the annual Hot Tip Harry Contest. From a pool of reader-selected monthly winners, our judges will pick the Top Tip for 2005. The first prize is $1,000. Second place wins $500, and third place, $250. E-mail those tips and tricks to harry@cadalyst.com.

The rain was coming like sheets of icy glass. It was cold and storming as I stood at the bus stop. Why was I here? Oh, yeah, Harry said that he had an extra special set of tips, but that they were too hot to be passed over in the more casual manner to which I'd become accustomed. No, instead he insisted on the melodrama. He picked the stormiest night of the month and had me standing outside in it. Another bus pulled up. A couple people got on and a few got off. After what seemed an eternity I was the only one there and was feeling peeved. Turning to leave, I stuck my hand in my pocket -- and found a CD. "Where did that come from?" I wondered. It had no label, but I had a suspicion. Harry must have done the old "reverse pickpocket" routine when one of the buses unloaded. I took a less than direct route home to make sure I wasn't followed and eagerly booted up the computer to see what was so hot I had to freeze my buns off.

Sure enough, the CD was from Harry. His image blurred onto the screen as an MPG. "Make sure these get to your readers. They are important. No time to explain." In the background I heard a foghorn and the bell of a streetcar. "What was he up to now?" I wondered. I didn't find as many tips as usual; were things drying up out there?

Creating Order out of Call-Outs
The first tip came in from Scott Restmeyer. Automatic Numbering (Tip #2018) is a very useful tool for maintaining drawings that contain labels. If you have lots of call-outs in your drawings that consist of a standard prefix string followed by an incrementing number and a possible suffix string, then this utility is great. It quickly replaces the existing text with new text using the sorting option of your choice. Place the LSP and DCL files in a folder that AutoCAD can locate, then load the LSP file. Once loaded, type DDNUMB and a dialog box will appear. Follow the directions in the dialog box, fill in the blanks where you want, press the OK button and the results appear as in figures 1 and 2.

figure
Figure 1. Running the Automatic Numbering tool.

figure
Figure 2. Results of running the Automatic Numbering tool.

The ZIP file contains a document (and PDF) detailing how the program works, along with the LISP source code, a dialog box, an icon to use in a menu and instructions of how to build the utility into your current menu system. That's quite a bit more than you will normally find! Thanks, Scott, for a nice function set.

Lurking in the Shadows
Our next tip is not a difficult programming trick but instead a simple yet powerful utility. Shadow Fade (Tip #2019) from Roy Lackey makes copies of objects along a given direction as if they were attached to a cylindrical object, such as this simple shaft representation (figure 3).

figure
Figure 3. This simple shaft representation is a result of running the Shadow Fade utility.

To create this drawing, all I did was draw a series of rectangles, then add lines from the midpoint of one base to the midpoint of the next. The next step was to run the macro. Load the FADE.LSP file to access the FADE function from the Command line. Type FADE, then select one of the centerlines. Indicate the start and stop as being from the base of the centerline to the base of one edge, then input the number of copies to make. I used 35 copies to achieve a nice-looking 3D effect. Nice and useful, Roy.

A Clip Tip You'll Flip For
Did you ever wish you could clip parts out of a drawing just by selecting a rectangle? Cut a Hole (Tip #2020) from Tommy Holder may be just what you are looking for. Load and run this utility and you'll see the amazing results (figure 4).

figure
Figure 4. The results of running the Cut a Hole utility.

You can cut a hole into the drawing and place the entities elsewhere via the clipboard. Load the LSP file then type CCNA at the AutoCAD Command prompt. The function prepares a couple of layers, then asks if you'd like some instruction on using the utility. The default answer is No, and after pressing the enter key you are asked to select the two points defining the rectangular cut-out section. You can copy the objects to the clipboard only for use in other Windows applications or use the Paste option to insert them back into your drawing. This function draws a rectangle where the cut is made and performs a variety of AutoCAD commands automatically to achieve a very useful result. A tip of the hat from Harry to Tommy for a job well done.

Manage Those Drawings
The next three tips all deal with the same subject, drawing management. Drawing management is more than keeping track of where everything is stored. It is also about keeping things trim, clean and to the standards in use by you and your organization. Starting simple, AEC Point Change (Tip #2021) from Leland P. Leahy changes the point inserts used in Autodesk's Land Development package to point blocks. Although this function may be of use only to those using the Land Development system and desiring an interface to the older style of data storage, it does serve as a worthwhile example of how easy it is to write an level substitution in LISP.

As to keeping the drawings trim and lean, Drawing Clean Up (Tip #2022) from James Ozburn shows the simple and direct approach. His function, named (C:PA), is stored in CLEANUP.LSP and is very simple. In fact, all it does is run a stream of commands to change the current drawing to match the standards employed where James works. You can quickly modify the simple code to match your own standards. This sort of utility is very handy when accepting drawings from outside sources that may contain embedded settings you normally do not use.

Taking the clean-up operations to the directory level is Directory Clean Up (Tip #2023) by Andrzej Gumula. This function is really a great example of how objects in Windows and AutoCAD can be exploited by Visual LISP. There are demonstrations of using the SHELL application to display a dialog box for selecting a folder, loading drawings for manipulation while not loosing Visual LISP control and much more. To run this utility, load the LSP file, then type PurgeFiles at the AutoCAD command line. A dialog box appears. Select the folder that holds the drawings. The program then asks if you would like to include subfolders with the default answer as Yes. From there, the rest is automatic as the program loads each drawing in the folder selected and performs a purge all. Fantastic work Andrzej -- a tip from a master, indeed!

Harry concluded his CD with another MGP video telling me to let you all know that he really needs those tips. The boss is offering up the big bucks again: $1,000 for the best tip of the year. Send in the LISP, VBA or ARX source code for consideration.

Submission Guidelines
When submitting tips for Hot Tip Harry, please remember that source code must be provided. You also should try not to use any programming tools other than those provided in the standard AutoCAD package. By following these simple guidelines, you increase the chances of your tip being included in Harry's library, and you increase the number of downloads your tip will have from all AutoCAD users.

Thanks to everyone who submitted tips -- and keep on programming!


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
Which file format do you use most often for CAD drawing/model exchange?
Native format
PDF
3D PDF
DWF
STEP or IGES
JT
IFC
Other
Submit Vote