AutoCAD

Hot Tip Harry: Tips from Our Readers -- October 2006

7 Oct, 2006 By: Bill Kramer

Use these tips to manipulate images, match and replace blocks, explode groups and more.


Great News for Harry Tipsters! Hot Tip Harry Challenge 2006, sponsored by Autodesk, just got better with even bigger prizes. You already know that the author of each published tip will receive a Cadalyst t-shirt, and the author of each month's best tip will receive $100 cash. Now, authors of all tips published in 2006 also will be entered into two year-end drawings. One lucky winner will receive a copy of AutoCAD 2007, courtesy of Autodesk, and a second winner will receive a trip to Autodesk University 2006 in Las Vegas, Nevada. For contest details and rules or to submit your tip, go to www.cadalyst.com/harry2006.

GET THE CODE
Download code for this and all articles. Look for OCT06.exe in Get the Code. Downloads are free and are provided "as is" without warranty or support.

Tips are tested using AutoCAD 2007, 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 using AutoCAD 2006. Tips that are missing functions or other necessary elements will not be considered.

All published tips earn the author a Cadalyst
t-shirt, and the tip judged best each month earns the author $100. Click here for details about the Hot Tip Harry Challenge 2006.

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!

This month, Harry reports that blocks and other productivity tools are on the minds of power users. Plus, a couple of CAD managers and programmers kicked in some helpful tips. As the autumn leaves begin to fall, it's time to dig into some really useful stuff!

Image Clip Using Lightweight Polyline (Tip #2151) from Pedro Ferreira is a very handy tool for manipulating images inside AutoCAD. Insert an image into a drawing as an external reference, and then draw a polyline over the top of it. Load the LISP code for this tip and type XIC to activate the command function. First select the image object, then the polyline, and the rest is automatic. Ferreira's functions grab the points from the polyline and clip the image reference in the drawing. The code is very well written and exploits the object handling features of Visual LISP. A tip of the hat from Harry on this one -- nice work!

Explode All Groups (Tip #2152) was sent to us by Julio Monge. This short function demonstrates the raw power of Visual LISP object manipulation by referencing all the groups defined in a drawing and then removing each group. Load the LISP code and then type XAGROUPS to activate the command. The result is that the groups are exploded back to individually selectable elements, and all group references are lost. This tip can be quite handy when working with drawings created using too many groups.

Match Block Properties (Tip #2153) comes in from regular contributor Theodorus Winata. Load the LISP code and then start the function by typing MB. First, select a control block and the program extracts the block's basic properties. Then, select the blocks you want changed using normal selection set tools. Press Enter and the others all adjust to match the first block selected. This is nice to have around when adjusting scales and other parameters on maps and details, plus this function is well written. Great tip!

Re-insert a Block from a File (Tip #2154) was supplied by power programmer Will DeLoach. If you have blocks in drawings that must be replaced with ones from disk, then you need this tip. Load the LISP code, then type RIB. First, select the block that you want to replace, and the program presents a file selection dialog box from which you select the replacement block. All occurrences of the block insert are replaced in the current drawing. This is another very well-written tip that's extremely useful when working with dynamic blocks.

Tree Shading (Tip #2155) is an interesting function from Jay Thomas. Included in the tip is a drawing with blocks that represent trees. Load the drawing, and then the LISP code, before typing TRSH. Select the tree blocks (all blocks must be named with a prefix of TREE), and press Enter to use the defaults for the shading. Enjoy the cool shade from the trees -- neat and very creative tools.

Increment and Decrement Functions (Tip #2156), revised by Rodney Thomas, is a set of new functions for LISP programmers who want C-like syntax. Rodney provides the functions '++ and '- which increases or decreases an integer value in the place given the symbol. For example, if you set the value of variable AA to 100 using (setq AA 100) you can use Rodney's routines as (++ 'AA) to add one to AA and then store the result back in AA. The quote mark is needed to pass the reference of the symbol. Thanks for a great tip that LISP programmers can use to see the dynamic power of the language.

Horizontal Rotation (Tip #2157) by Bob Larsh is a variation of AutoCAD's Rotation command. This version lets you select two points representing the desired horizontal. Load the LISP code and type HROTATE to start the function. First, select the objects to be rotated. Next, pick two points representing the desired x-axis for the objects. They are then rotated into position around the first point selected. Great for mapmakers and detail drawings, this is a handy tip when the angle of rotation is not quickly available.

Directory and Bigpurge (Tips #2158 and #2159) come from CAD manager Mark Newman, who has quite a job on his hands wrangling variably skilled CAD users onto the same page. CAD standards and practices aside, the only way to be successful is to automate the job -- and that's exactly what Mark's done with utilities. Both of these are simple functions that demonstrate how easy it is to achieve solutions to regular problems. Directory displays the Windows Explorer program with the default folder the same as the current drawing. When working with large directory structures that can save a lot of clicks, Bigpurge runs the Purge command several times and saves the drawing in 2004 format. Mark discovered this as a potential solution to corrupted drawings across the network and different versions of AutoCAD. Thanks for sharing your solutions!

Top Tip of the Month
This month's top tip award goes to Tip #2154, Will DeLoach's function for redefining blocks in the drawing. This is a very useful tool, and an example of great programming. Soon, Will will be sporting a Cadalyst Hot Tip Harry T-shirt.

Keep those tips coming in! Just remember to supply everything needed and in source code format. In the mean time, I'll see you on the Hot Tip Harry forums.


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
At your company, who has the most say in CAD-related software purchasing?
CAD manager
CAD users
IT personnel
vice-president/department manager
CEO/company owner
Submit Vote