Better Living with Objects and Smart Entities (Hot Tip Harry AutoCAD Tutorial)31 Jul, 2008 By: Bill Kramer
Top Tip is a VBA routine for copying attributes from block to block.
Tip 3000: Leader to Multileader
Lyle Hardin created Leader to Multileader to update basic leaders and text into a single multiple-leader entity object. To use this utility, load the LISP code and type LeaderToMLeader at the AutoCAD Command prompt. You'll be prompted to select a leader and then the text. Those elements will be erased from the drawing and replaced with a multiple-leader object that contains both the leader geometry and text as a single entity. Harry appreciates these quick and easy tools for upgrading your drawings to new and improved entity types.
Tip 3001: Move Objects Along Axis
Move Objects Along Axis by Ren Smith is a 3D editor tool that makes moving objects along the x-, y-, or z-axis a snap. Load the LISP code and type MPF at the AutoCAD Command prompt to start the routine. It will ask which direction you want to use. Enter x, y, z, or nothing to exit. If you enter x, y, or z, you will be asked to select entity objects for the move, the base point, and the destination point along the specific axis. AutoCAD's Move command then moves the selected objects to the new location of your choice. This tool makes sliding objects along an axis easy.
Tip 3002: Perpendicular Line from a Curve
Bill Gilliss submitted two great tips this month; the first is Perpendicular Line from a Curve. This utility allows you to draw a line or polyline starting in a perpendicular direction relative to an existing curved object. To use this utility, load the LISP code and type Perpl at the AutoCAD Command prompt. Next you will be asked to select a point on an existing entity object. The default operation is to start the Line command; however, you can type Polyline to have the program switch to polyline mode. The line or polyline will be started at the point selected with the direction vector set to move away from the object. All you need to supply is the distance for the first segment. The Line or Pline command then continues as it normally would. What a great example of how to use the first-derivative method for entity objects in your Visual LISP programming.
Tip 3003: System-Variable Set-Up Tool
The LISP code for System-Variable Set-Up Tool, sent by Raymond Foren, includes a function named R4N:SV that changes a system variable, but only if a change is needed based on in-house standards that you can define. The LISP source code contains the definition of the function as well as examples of it being used to set up a few system variables. You can see how Raymond uses it in his production environment - you might find is useful for your own, just like Harry did.
Tip 3004: Move or Copy with Rotation
Move or Copy with Rotation is the second productivity tool from the library of Bill Gilliss. These new commands are just like Move and Copy - but with a twist. After moving or copying the entities you select, you're given an opportunity to rotate the objects about a chosen base point. Load the LISP code for this tip to add two new commands: RMove and RCopy. The nicely structured functions serve as good programming examples, as well as being quite useful. Nice and handy!
Tip 3005: Copy Attributes Block to Block
John Walker created this month's top tip: Copy Attributes from Block to Block. These well-crafted VBA functions let you move attribute values from one block to another. Attribute tags of two blocks are compared to determine where to place the attribute values, which means the blocks don't have be an exact match. To use this utility, you will need to load the BAS source code into a VBA project. (From AutoCAD type VBAide. Inside the Visual BASIC editor, select File, then Import. Navigate to SCBLOCKATTRIB.BAS and open it. Press F5 to run the macro.) A tip of the fedora to John for a great example showing the raw power of object manipulations.
Until next month, 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!
AutoCAD Users: Check out Cadalyst Tips & Tricks Tuesdays
All it takes is a minute or two, and you could be off to more productive use of AutoCAD. Cadalyst announces Tips & Tricks Tuesdays with worldwide AutoCAD Technical Evangelist Lynn Allen. Each Tuesday, Lynn and Cadalyst bring a new, super-quick tip to the Cadalyst Video Gallery. Subscribe to Tips & Tricks Tuesdays and receive an e-mail notification every time a new tip goes live in the Cadalyst Video Gallery.
About the Author: Bill Kramer
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!