Hot Tip Harry: Tips from Our Readers--April 200612 Apr, 2006 By: Bill Kramer
Visual LISP tips still rule the day for Harry's readers, including a great tip for an AutoCAD and Excel interface.
Message Box Utility (Tip #2102) from Lloyd Beachy demonstrates how to activate VBA features from inside Visual LISP. Lloyd's message box function calls up VBA's MsgBox routine and returns a string answer based on the operator selection. This tip is for programmers only and allows you to set the response options as well as the icons displayed for the message. Not only is this utility useful, it makes for an excellent example of exploiting VBA inside Visual LISP.
Rescale Multiple Blocks (Tip #2103) comes from Theodorus Winata. This combination of LISP and DCL creates a new command named RMB when loaded into AutoCAD. RMB allows you to select one or many block inserts and then presents a dialog box where you can enter a new scale factor for the x,y and z components. The selected blocks then are regenerated.
Jeffery Sanders sent Attribute to Text Explode (Tip #2104), a well-documented utility for operators. After loading the LISP code into AutoCAD, type SAFEX at the Command line and select the inserted blocks you want exploded. SAFEX only explodes blocks that were inserted with attributes. The normal operation of the AutoCAD Explode command reduced attributes back to attribute definitions and lost any values that you may have supplied in the attribute input. SAFEX converts the exploded attribute definitions to text and inserts the attribute value. This tip is a very clearly documented example of how you can use LISP to make AutoCAD your own.
Area Field Duplication (Tip #2105) comes from Jeff White. Start by creating a field linked to the area property of a polyline object in a drawing. Load the LISP code sent by Jeff and type AF at the Command line when you want to duplicate the area field for another polyline. Select the field object as a master (the command SM allows you select a new master), and then locate a different polyline that needs an area field. This function reduces the work when you need to have multiple areas in a drawing represented as field objects. A very nice and clean approach was used in the coding of this macro, making it not only useful, but a great example for learning more.
Mike Fettkether sent Harry a pair of nice Hatch Patterns (Tip #2106). The two patterns are for diamond tread and spanded metal flooring. Just copy the PAT files into the standard AutoCAD search folder and then select a custom type in the Hatch dialog box of AutoCAD. Pick the hatch pattern desired from the custom pattern list (you may need to do a file search the first time), and you're into some heavy metal! Thanks, Mike. Harry thinks creative hatch patterns are neat.
AutoCAD Excel Interface (Tip #2107) comes from Q.J. Chen of China and is the perfect answer for a topic that appeared just recently in the Hot Tip Harry forum. The purpose of this utility is to transfer text information stored in a grid layout (table) into an Excel worksheet by just locating the corners of the table. Load the LISP code and type B2E to activate the function. It will request two points representing the corners of the table (upper left and lower right). The rest is automatic. The text inside the grid is selected and sent to an Excel worksheet. This function works best when Excel is already open and running before starting the command. An animated GIF shows the operation of the function set included with the download file for this tip. The animated GIF is very interesting to watch because it shows the Chinese versions of AutoCAD and Excel. Harry picked this one as the top tip of the month right away!
Thanks for the great tips everyone! Keep them coming in and visit Harry's online forums where you can suggest ideas for tips and discuss the use of the tips with other users. As a note to those folks who send complex or involved programs to Harry for consideration and then don't see them listed: you may need to supply some extra documentation with the upload describing what the program does and, if it modifies AutoCAD in any way, how to undo the modifications.