Hot Tip Harry: Tips from Our Readers -- October 200514 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.
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.
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!
Poll not yet available.