Hot Tips for Cold Days (Hot Tip Harry AutoCAD Tutorial)18 Nov, 2008 By: Bill Kramer
This month's top tip winner automatically dimensions polylines.
Tip 3026: Repeat Dist Command
Azfar Mahmood sent in Repeat Dist Command, which is a new twist on the familiar Distance command in AutoCAD. The LISP command function Sum_Dist repeats the Dist command using the object snap Nea (near) for the first point and Per (perpendicular) for the second point. Given the two input points, the program displays an alert box containing the current distance, a running total, and number of the distances selected. After the alert box is closed, the loop repeats until an invalid distance entry is made or until you use the Esc key to exit. Each time the routine is restarted, the cumulative distance value is reset to zero. This is a nice combination of AutoCAD commands and basic LISP.
Tip 3022: Purge and Save or Purge and Exit
Purge and Save or Purge and Exit from Clement Yiu are two command functions to purge drawings of unused applications and table elements. PF and PX perform the same function with different outcomes. The first command is a zoom out to the far extent of a drawing. Next, the Purge command is run twice: the first time to remove unused applications and the second to remove all unreferenced, named objects (layers, linetypes, and so forth). The last common operation is a quick save of the drawing after purging. At this point PF ends, but PX will continue by closing the drawing. A handy way to keep your drawings compact.
Tip 3023: Quick Text Replacement
To use Quick Text Replacement from Matt Sibum, load the LSP file into AutoCAD, then type MPT to start the text edit tool. Select a first text object to be used as a template. That text will be copied to other text (or MText) objects selected until you exit the function by not selecting a valid object. A very useful tool if you need to change a lot of callouts containing the same text.
Tip 3024: Replace Text with Incremental Value
Replace Text with Incremental Value from Eric Lee Brown replaces text strings with an incrementing value, very useful for labeling columns and
Tip 3025: Change File System Properties
Ronald Maneja submitted Change File System Properties, a system-management tool for changing the file system properties of a current file. When used, a currently open file will be set to a read-only and hidden state. Load the LSP code and type Raise at the AutoCAD Command line. The file will be located in the file system, and the attributes will be adjusted. The routine will then ask you for a new file name, meant to be used for future revisions of the drawing. This routine uses MS Windows' file system object to access the Attributes property and change it to a value of hidden and read only (and integer code). What a great example of how easy it is to access object data using Visual LISP.
Tip 3026: Automatically Dimension Polylines
Terry Miller earns November's top tip prize for Automatically Dimension Polylines. To use this marvelous tool, draw a polyline and load the LISP code. Type DPL at the Command prompt to activate the function and pick the polyline. This routine automatically dimensions the y distances. The current dimension variables are used as defaults. Y distance dimensions are created from one vertex to the next along with a overall y distance. The program is nicely structured so you can modify it to automatically dimension other items or properties if you are inclined to play with the LISP code, like I am!
Thanks to all the tipsters for this month's submissions! Note that your code is now downloadable from the new and improved CAD Tips site. Also, be sure to stop by Cadalyst's Hot Tip Harry discussion forums where the gang hangs out. There's a lot of great advice and insight to be found. Until next time, keep on programmin'.
Join the Hot Tip Harry Challenge
Harry needs your tips! Do you have an original routine written in VBA, Visual LISP, or even ObjectARX for AutoCAD customization? Send it in, with all the source code, to firstname.lastname@example.org. Your tip may be needed by others now, so don't delay!
Subscribe to Harry's Code Class
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. Subscribe to Harry's Code Class 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! Discussion Forum offers assistance with AutoCAD programming and customization problems. Hot Tip Harry -- Requests Discussion Forum 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 by readers for readers -- all reviewed by Cadalyst's volunteer Tip Patrol. Plus, you'll receive a rundown of new online CAD resources, deals and freebies, new CAD-related hardware and software products, and more. View the Cadalyst Tips & Tools Weekly archives and subscribe today!
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor 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!