Tips from Our Readers -- August 2007 (Hot Tip Harry AutoCAD Tutorial)31 Jul, 2007 By: Bill Kramer
This month's winning tip converts AutoCAD tables into comma-delimited text for spreadsheet import.
Tip 2227: Incrementing Text Label
Incrementing Text Label by Julio Monge is a handy tool for labeling a series of points with numbers. After loading the LISP code, type Count at the Command line. The function will ask you to select an existing text object. If the text object selected can be converted to a numeric value, then the converted value will be used to seed the number generator. Otherwise, the function will start with a value of 1. After obtaining the text entity details, the original text object selected remains untouched as the program prompts you for more points. As you select more points, a text object will be inserted that has the same properties as the one originally selected with an incrementing number value for the text. This utility is an excellent productivity tool for those needing to place a large number of numeric labels on a drawing. The code itself is a good example for those learning LISP.
Tip 2228: Trim Inside or Outside a Box
Trim Inside or Outside a Box by Raymond Rizkallah automates the process of trimming around a rectangular area. The LISP source code includes two command functions: Ti for Trim Inside and To for Trim Outside. Trim Inside allows you to define a box area (two corner picks) and then takes it from there. Objects inside the box area will be trimmed out of the drawing, leaving a rectangular hole in the drawing. Trim Outside does the opposite by trimming all the objects outside the rectangular region. This function set can be used to cut details out of a design or to make room for annotations to be placed on top of graphics. You may need to play with the offset values (select P when asked for the first point) to achieve the desired results, but once mastered, this routine can save lots of time. Nice job, Raymond.
Tip 2229: Perpendicular Line Drawing
The Perpendicular Line Drawing utility by Jimmy D'Hondt is a simple routine that makes it easier to draw a perpendicular line. After loading the LISP module, type Perpline at the Command line of AutoCAD to activate the function. The first prompt will ask for a point on the object from which a perpendicular will be determined. Next, supply a point to the side at the distance you want the perpendicular line to start. The function then takes the second point entered and starts the Line command with a perpendicular object snap back to the first point selected. This function demonstrates how you can use LISP to manipulate the command sequence into something that makes more sense to you.
Tip 2230: End Snap Toggle
End Snap Toggle by Ron Filiatrault is designed for swapping the Object Snap mode between two different modes. After loading the LISP file, type (Endsnap) to toggle between mode 33 (end point and intersection) and mode 72 (insert point and node). This handy utility demonstrates how easily you can set up a LISP function that enables you to select the type of object snaps you want to use in your drafting work. Armed with a library of tools such as this one, you can move quickly through the drawing process without having to think about mode numbers.
Tip 2231: Rotate Text to Match Line
Rotate Text to Match Line by David Whitlow allows you to adjust existing text in a drawing to align with an existing line. Load the LISP code and type Rt at the Command line in AutoCAD to activate the utility. You will first be prompted to locate a line object. Next, you will be asked to locate a text object. The text object will be rotated in place so that its angle matches that of the line. This tool is very handy when labeling linear shots in a drawing, because you don't waste time aligning text each time you create a new line. You can quickly add text without regard to the rotation. After completing a few or all of the text annotations, Rotate Text to Match Line can rotate them to match the lines in your drawing. A tip of the hat to David for this efficient production tool.
Tip 2232: Object Thickness Clean-Up
Object Thickness Clean-Up from Gary Fisher is a VBA macro that zeros out the thickness setting of standard AutoCAD entities. Gary receives drawings that contain 2D objects with thickness, and he created this simple gem to remove the clutter. With this utility, he demonstrates how to manipulate AutoCAD entity objects using VBA programming tool. To use the tip, load the DVB inside AutoCAD and run the macro Vportcheck. A dialog box with one button will appear. Press the button, and the 2D objects lose their thickness values, if they have any. This is a nice little macro set for those who are just learning VBA and want more examples of how to manipulate drawing objects.
Tip 2233: Add Bullets to Text
Add Bullets to Text is a cool utility from Ramakrishna Acharya. After drawing text objects, load the LISP code and type Bullet at the AutoCAD Command prompt. Select the text where you want to add bullets and then select the type of bullet you want to add: arrows, circles, donuts, lines, or squares. The bullets are created to the scale of the selected text objects. The bullet objects created by the function are regular AutoCAD objects and aren't attached to the text. Thus if you make a mistake, it's easy to correct and the original text is never compromised. This elegantly programmed solution shows how easy it is to make your own smart drafting tools. Nice job -- a tip of the hat from Harry for a well-written program.
Tip 2234: AutoCAD Tables to Excel
And finally, the top tip of the month is AutoCAD Tables to Excel by Doug Barnes. This utility quickly converts tables of text in an AutoCAD drawing to a comma-delimited file suitable for loading directly into Microsoft Excel and other spreadsheet programs. After loading the LISP code into AutoCAD, type Bom at the Command line. You will be prompted to locate corner points surrounding the table of text, and the rest is automatic. If text is found, the utility creates a file named BOM.CSV in the same folder as the drawing. This file is an ASCII text file in which each column is separated by a comma and each row appears as a new line -- perfect for importing into a spreadsheet. If you want to see how to sort data points and use filters, open the code to take a look under the hood in this function set. Great stuff, Doug!
Harry says he can never have too many tips and tricks to share with others. When you send in a tip, make sure it's your original work and has all the necessary elements to run on Harry's test machine: It must run using AutoCAD 2008, it must include the source code, and make sure all files needed are included. By sharing your tips and tricks, you help others learn new things. Many of Harry's favorite tips over the years have come from those who learned to program by studying previous tip submissions. All Harry has to say is: Keep on programmin'!
Join the Hot Tip Harry Challenge
Calling all tip writers! The Hot Tip Harry Challenge is under way for 2007, sponsored by Autodesk. Share your hot tips and tricks for a chance to win a trip to Autodesk University 2007, a $100 cash prize each month and an official Cadalyst t-shirt. For more details, click here.
Subscribe to Harry's Code Class: Tips for Programmers
Cadalyst's Hot Tip Harry helps programmers and programmer wannabes learn the ins and outs of AutoCAD customization in his monthly e-newsletter, Harry's Code Class: Tips for Programmers. Subscribe today and start building your programming expertise.
Hot Tip Harry Discussion Forums
Harry is standing by online to aid AutoCAD users and programmers. Cadalyst's Hot Tip Harry -- Help! forum offers assistance with AutoCAD programming and customization problems. Hot Tip Harry -- Requests can help you locate a specific LISP or VBA routine for AutoCAD. Participation in Cadalyst Discussion Forums requires registration, but it's free.
Get Your Weekly Fix of AutoCAD Tips
Cadalyst's Tips & Tools Weekly e-newsletter mails each Monday, delivering AutoCAD tips from readers -- all reviewed by Cadalyst's volunteer Tip Patrol. Plus, you'll also receive a rundown of new online CAD resources, deals and freebies, the past week's new CAD-related hardware and software products, and more. View the archives and subscribe today!