AutoCAD

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.


GET THE CODE
Download code for this month's tips at Cadalyst's CAD Tips site. Search for the tip of your choice by tip number or keyword. Code downloads are free and are provided as is without warranty or support.
Tips are tested using AutoCAD 2008, 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 in AutoCAD. Tips that are missing functions or other necessary elements will not be considered.
Join the Hot Tip Harry Hot Code Contest
Calling all tip writers! The Hot Tip Harry Hot Code Contest is under way for 2008.
Share your hot tips and tricks and you could win an official Cadalyst t-shirt or the $100 monthly top tip prize!
E-mail those tips and tricks to harry@cadalyst.com.
For More AutoCAD Tips More Often: Check out Cadalyst's free Tips & Tools Weekly e-newsletter. View the archives and subscribe today!
Harry's Code Class Free E-Newsletter:
Learn from the master himself. "Hot Tip Harry" author Bill Kramer offers monthly lessons in customization programming for AutoCAD. View the archives and subscribe today!
As Harry rushed in carrying his tattered briefcase, the cold air sucked the door shut behind him. Tossing a disk in my direction, he said quickly: "Got some more loose ends cleared up here plus a real treat for your automatic dimensioning library." I couldn't wait to see what he'd brought.

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

Extra! Extra!
Hot Tip Harry finishes off 2008 with an big bang. Visit the CAD Tips site after December 1 to check out a supersized batch of tips from our readers.
rows in a grid. After loading the LSP file, type Counter to activate the text edit tool. Enter an increment value (default value is 1). Next, select a starting base text. If the first character is a number (0 . . . 9), the counter will convert the string to a number. Otherwise, the next character will be used. (For example, if you pick text containing the value A with the default increment of 1, the next text item you pick will be changed to B and then to C and so forth.)

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
Top TipTerry 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 harry@cadalyst.com. 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!


About the Author: Bill Kramer


AutoCAD Tips!

Lynn Allen

Autodesk Technical Evangelist Lynn Allen guides you through a different AutoCAD feature in every edition of her popular "Circles and Lines" tutorial series. For even more AutoCAD how-to, check out Lynn's quick tips in the Cadalyst Video Gallery. Subscribe to Cadalyst's free Tips & Tools Weekly e-newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!
Follow Lynn on Twitter Follow Lynn on Twitter


Poll
Which file format do you use most often for CAD drawing/model exchange?
Native format
PDF
3D PDF
DWF
STEP or IGES
JT
IFC
Other
Submit Vote