Hot Tip Harry: Tips from Our Readers -- October 20067 Oct, 2006 By: Bill Kramer
Use these tips to manipulate images, match and replace blocks, explode groups and more.
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.
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!