cadalyst
AutoCAD

Hot Tip Harry: Tips from Our Readers--April 2006

11 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.


Great News for Harry Tipsters!Hot Tip Harry Challenge 2006, sponsored by Autodesk, just got better with even bigger prizes. You already know that the author of each published tip will receive a Cadalyst t-shirt, and the author of each month's best tip will receive $100 cash. Now, authors of all tips published in 2006 also will be entered into two year-end drawings. One lucky winner will receive a copy of AutoCAD 2007, courtesy of Autodesk, and a second winner will receive a trip to Autodesk University 2006 in Las Vegas, Nevada. For contest details and rules or to submit your tip, go to www.cadalyst.com/harry2006.

GET THE CODE
Download code for this and all articles. Look for APR06.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 earn the author a Cadalyst
t-shirt, and the tip judged best each month earns the author $100. Click here for details about the Hot Tip Harry Challenge 2006.

E-mail those tips and tricks to harry@cadalyst.com.

Wither the future of Visual LISP? Not based on the input that Harry sees from the Web. Harry says that people ask him about the future of LISP inside AutoCAD all the time. He finds that hard to fathom given the number of LISP tips and tricks that keep arriving. In fact, LISP is a very powerful solution-oriented language for computer graphics, once you master the concept of list processing. But enough preaching to the choir, let's get to those tips! No April fools here, just some cool tips and tricks.

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.


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!