Hot Tip Harry: Tips from Our Readers -- October 2005

13 Oct, 2005 By: Bill Kramer Cadalyst

A fun clock, plus tips for substituting text in objects, correcting elevations, personalizing your settings, finding 3D solid interference and creating your own hatch patterns.

Download code for this and all articles. Look for OCT05.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 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

Our hearts go out to the victims of the recent hurricane and flooding. We all hope for a speedy recovery, and Harry calls on the troops to bring forward the construction and building macros! He passed along a nice set of routines this month for us all to share and once again regretted to say that he could not use some of the submissions because they were compiled FAS files and were missing specialized routines. He was wondering if the missing parts were washed away in the winds.

The first tip of the month comes from in Q. J. Chen of China. Clock (Tip #2060) is a clever set of functions to draw an analog clock on the graphic screen using GRDRAW. There really is no productivity gain in this function unless you want to program the delay counter to indicate your computer is not available for a set time period. For that you'll need to dig into the source code. To use, load the LSP file and type Clock at the Command line in AutoCAD. The rest is automatic. A fun routine!

GF Text Substitution (Tip #2061), also from Q. J. Chen, lets you substitute text object contents with a value selected from another text object. Load the LSP code and type GF at the Command line to activate the function. First select the text object containing the text you want to copy to the other text objects. Then select the other text objects. When you are done selecting text objects, the function changes all the text to match the first one selected.

Paul Graf supplied Elevation Corrector (Tip #2062). This simple routine solves a specific problem involving maps and plan views with contours. Load the LSP file and type AEL at the Command line. The program asks you to select a polyline or group of polyline objects that represent contour lines. When you are finished selecting the polylines, the routine asks for a text representing the elevation. The text is converted to a numeric value and used as the Z-coordinate in each of the polylines selected. The color of the polyline is changed to yellow so that you know which polylines were converted. The modified contours are now ready for use in elevation plans and other tasks. This tip is a very simple, yet effective, example of LISP in action -- a tip of the hat to Paul for his entry!

If you work with drawings from a variety of sources, then Personalize (Tip #2063) is just what you need. Nathan Withers sent Harry a function that serves as a fine example of the Autorun feature of LISP in AutoCAD for starting a program every time AutoCAD starts a drawing. This function is used to control the drawing settings conversion for drawings with settings you may not prefer to use. There are two LSP files in this set. The first is named ACADDOC.LSP, which is a simple series of expressions that will load and evaluated every time you start a drawing. You must place this file in the AutoCAD support search path. Note that if you already have an ACADDOC.LSP file present, you should append the contents of the new one to the existing one and not just replace it blindly. The second function is activated by loading the Personalize LSP file and then typing PERSONAL at the Command line. You must place an associated DCL file in the AutoCAD support search path for the function to run properly. You then can assign your personal settings to be saved in the AutoCAD registry. See figure 1 for an example of the dialog box running. This tip is a very useful set of functions, and Harry thanks Nathan for sharing them with us.

Figure 1. Personal Settings dialog box.

Find 3D Solid Interference (Tip #2064) by Andrzej Gumula is a clever routine that exploits the powerful Visual LISP object manipulators. This function locates the interference between solid objects and creates an interference object for you to view. For those looking to do advanced 3D work inside AutoCAD, this is a nice utility. Load the LSP code and type FIN to activate. Select the 3D solid objects to check, and the rest is automatic except for a slight pause to let you step through viewing the interference objects created. Harry's first reaction was this tip is really cool. And that was before he ran the code. Thanks to frequent tipster Andrzej for this gem!

Our last tip of the month is Hatch Maker (Tip #2065) from Lanny Schiele. Hatch Maker is a nifty utility for the creation of hatch patterns. If you have tried to create a hatch pattern by hand, you know that it's not that easy to make anything interesting. Larry just changed that for you. Load the LSP file and type DrawHatch at the AutoCAD Command line to start things up. This function prepares a drawing area and sets the grid snap mode in AutoCAD for creation of a hatch pattern. Draw lines and points to make up the hatch pattern cell. When you are finished, type SaveHatch and follow the directions on screen to create a custom PAT file. Harry was quite taken with this routine and gave it double thumbs up. I think I know why (figure 2). Thanks, Larry!

Figure 2. Harry's first custom hatch pattern.

Thanks for the tips everyone! And keep them coming in. Your tips make Hot Tip Harry great.

About the Author: Bill Kramer

More News and Resources from Cadalyst Partners

For Mold Designers! Cadalyst has an area of our site focused on technologies and resources specific to the mold design professional. Sponsored by Siemens NX.  Visit the Equipped Mold Designer here!

For Architects! Cadalyst has an area of our site focused on technologies and resources specific to the building design professional. Sponsored by HP.  Visit the Equipped Architect here!