Hot Tip Harry: Tips from our Readers -- June 200514 Jun, 2005 By: Bill Kramer Cadalyst
Customize your system to eliminate repetition
An expert system tip isn't always complex or tricky. It's merely customizing AutoCAD to make the system behave more like an expert in your field. Think about AutoCAD customization from this perspective: you hire a new engineer fresh from college with a current education in math and science. But you still must train that engineer to do whatever it is your company does. The same is true with AutoCAD. You buy AutoCAD and maybe some additional customization software, but it doesn't know how you need to do things. Not until you teach it, and that's customization. Harry gets goose bumps just thinking about the possibilities.
Mtext Line Note
We begin with a notation tool from Andy Lawniczak for placing callout symbols next to specific lines in an Mtext object with Mtext Line Note (Tip #2034). The file contains drawings that you must place in a folder in the AutoCAD search directories list. Type MN at the command line after loading the LSP file named MULTILINENOTE.LSP . You have a choice of symbol types based on the type of drawings that Andy does, so adjust them to fit specific application needs. Andy labeled them as New Construction (default), Casework, Demo and Toilet assembly. The symbols are a square, diamond, circle and triangle, and you can rename them by changing the LSP source code. Nice job, Andy. This tip is just the type that makes the job easier every day.
Pipe Break Symbol and Slot Drawing Utility
Another tool for creating symbols in a drawing comes from Thomas Christman. Pipe Break Symbol (Tip #2035) draws a broken pipe symbol given the outer wall size of the pipe and the orientation. Once drawn, you can attach or break the pipe graphics, allowing for the representation of an extended length in a drawing with other objects that are not as long. The file contains three drawings that you should place in a folder that AutoCAD will search, as well as a LSP module. Load the LSP module into AutoCAD and type BREAKER at the command line to activate. Select the size of the outer pipe wall, the center point for placement and the orientation to be represented for the blocks to be scaled and placed. This tip is a time saver when you have a lot of broken pipes to draw.
Another tip from Thomas is Slot Drawing Utility (Tip #2036). A slot is a cut into the material normally made by a milling tool or the combination of a drill and a mill/router type tool. These types of shapes are rectangles with rounded ends, but they are defined by size and center location, not the corner points. Thomas uses Visual LISP to input the size parameters from the keyboard, a center point plus an angle, which then generates a polyline slot. This tip improves communication between the CAD operator and the computer for these types of drawings. Thanks for both tips, Thomas!
For a different twist on a popular theme of placing a frame around text objects, Frame Text (Tip #2037) from Alex Borodulin uses a simple LISP routine to insert a block containing a complex AEC dimension object. The result is a frame around some MTEXT. Copy the DWG file provided to a folder that AutoCAD can locate, and then load the LSP file. Type FX at the command line. It asks for a placement point and an orientation angle. The next thing is the MTEXT entry for the annotation. Cleverly, the AutoCAD commands are stored in a drawing as a block. After insertion, the block is exploded and automatically called up for edit. Thanks, Alex.
Get Excel Data
Jeff Sanders supplied Get Excel Data (Tip #2038), which is a wonderful utility for programmers to obtain data from an Excel spreadsheet. The self-contained utility is supplied in a single LSP file and contains the definition of a function named getCells. This function has three parameters. The first is a list of strings containing the cell names you want to read, e.g., A1, A2, B1 and B2. The second parameter is the file name of the XLS spreadsheet. The full path and file extension should be supplied, as in C:\myFiles\theData.XLS. The last parameter is the sheet name, e.g., SHEET1. When successful, the utility returns an association list with the cell number as the key to the contents of the cell as the second member (access using CADR with the result from ASSOC of the cell name in the data list). Jeff hopes others can use this routine to quickly get into Excel and use it as a data engine for AutoCAD. Thanks, Jeff.
Spline to Polyline Conversion
The last tip of the month is another specialty tool that not everyone needs, but when you do, it saves a lot of time. Lloyd Beachy provides Spline to Polyline Conversion (Tip #2039) to change AutoCAD spline objects into lightweight polylines. This conversion facilitates the transfer of continuous spline objects into other applications that do not support that kind of object. If you are using additional analysis, design or post-processing software in conjunction with AutoCAD, you may have transferred data that cannot be processed. The Spline to Polyline utility solves one of the conversion issues. Harry wonders what other tips might be lurking around to solve this type of problem. By the way, this function set is an excellent example of how Visual LISP and objects open the door for many solutions. Just load the LSP file into AutoCAD and type S2P at the command line to activate. Select the spline objects you want converted, and then specify the number of segments in which to break the object. The result is a lightweight polyline where the spline used to be. Thanks for the tip, Lloyd!
Time to Send in Your Code
It's been a dry season for Harry. He is wondering if no one can find him out here in cyberspace. But alas, you're reading this article, so you did find him! Share your clever tips and tricks with Hot Tip Harry and you have a chance at some serious money! He's waiting to hear from you.