AutoCAD

Tips from Our Readers -- September 2007 (Hot Tip Harry AutoCAD Tutorial)

1 Sep, 2007 By: Bill Kramer

This month's winner lets users create an automated drawing process by connecting blocks.


GET THE CODE
Download code for this and all articles. Look for SEP07.exe in Get the 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 Challenge
Calling all tip writers! The Hot Tip Harry Challenge is under way for 2007 and is sponsored by Autodesk.
Share your hot tips and tricks to win an official Cadalyst t-shirt and a chance to win a trip to Autodesk University 2007 and cash prizes. Click here for more details.
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 latest batch of tips exposed the wide breadth of AutoCAD customization going on out there. Do you have more to add? If so, please send your solutions to harry@cadalyst.com and be sure to include your full name as well as all the source code -- Harry checks the sources closely. This month's tips include some heavy metal hatch patterns, command-based macros, object-level examples, VBA, LISP, and a very nice utility to connect block inserts with lines.

Tip 2235: Offsets Joined by Fillet
Offsets Joined by Fillet, one of two submissions this month from Patrick Evangelista, lets users offset two objects and have the new offsets joined using a Fillet command with the current default fillet radius. This LISP program is a single function definition named C:OF. After loading the LISP code, type Of at the command line to start the process. The first prompt will be for an offset amount, followed by a request for two object selections and the sides to apply the offsets. When the second offset is generated, a Fillet command then joins the two in the drawing. Combining common AutoCAD commands in this manner can directly affect productivity by making CAD systems work in the same manner that you are thinking.

Tip 2236: Continued Copy
Another little gem from Patrick Evangelista, Continued Copy, is a variation of the Copy command that will continue to apply the same copy parameters (distance and direction) to an object just created, resulting in a continuous series of copies. After loading the LISP code, type CPC at the Command prompt to get it started. First, you need to select an entity to copy and then show the base point and displacement point. The object selected now will be copied as per the parameters defined. Press Enter to have the newly created object copied once again in the same direction and distance. When you have enough copies, type X to exit the routine. This great tip shows how you can continuously add new features to existing commands with a little LISP creativity!

Tip 2237: Metal Hatch Patterns
Carter D. Heaner sent Metal Hatch Patterns. He offers expanded metal, bar grating, and two kinds of diamond plate hatch patterns -- all in one file. If you work with metal, download the pattern file and take a look inside. The pattern file is a text file that can be viewed and manipulated using a common text editor. Hatch patterns aren't easy to create, and Cadalyst readers, Harry, and I greatly appreciate this addition to our collection.

Tip 2238: Enhanced Attribute Editor Tool
The Enhanced Attribute Editor Tool comes from Michel Chayer. The LISP code in this file is a programmer's tool for creating an attribute editor system. The application for this utility involves blocks with attached attributes for which you want to edit the value and location of the attribute objects. Function ECED defined in the LISP file accepts two parameters: the value to place in the attribute and the tag name. Inside the function, you are prompted to locate one block at a time. That block is then checked for attributes and, if the named tag is found, the value is changed. At the same time, AutoCAD's Attedt command is used to relocate the attribute in the drawing. It's a clever combination of AutoCAD command manipulation and LISP. Merci, Michel!

Tip 2239: Layer Table to Excel
Pedro Ferreira's Layer Table to Excel utility creates a Microsoft Excel worksheet that contains a complete dump of the current drawing's layer table. For this custom command to work, you must have Excel installed on your computer, and it should be up and running with a new, blank worksheet. Load the LISP file, then type L2X to activate. The rest is automatic. In the LISP code, Excel is connected and a new worksheet started. Visual LISP VLAX object access is used to retrieve the layer table details, and those details are written directly to the worksheet cells using Excel object access. This utility is a great example of how to connect object systems such as Excel to AutoCAD through Visual LISP.

Tip 2240: Block Scale Editor
Block Scale Editor by Raymond Foren allows you to quickly rescale inserted blocks in the current drawing. Load the LISP code, then type B2S at the Command prompt of AutoCAD to activate the command. The routine prompts you to select blocks to be rescaled, then you must specify the new scale factor to be used. As a default, the Dimscale system variable is tapped for a value. After the scale factor is in hand, each block is reset to the new scale through an automated Scale command. Block Scale Editor is a handy power-edit tool for those who work with drawings, such as maps, in which the block-insert scale needs to be adjusted.

Tip 2241: Locate Multiple Intersections
Locate Multiple Intersections by Vinayan Parameswaran is a VBA program that will locate all the intersection points of multiple entities. The intersection points then are marked with a point object that is colored green. To run this tip, load the VBA program using VBAMAN, then start the macro Inter_with_multiple. You will be asked to select objects for intersections to be located. The rest is automatic. The program loops through the objects selected and finds all intersections between the objects. These intersection points are then marked with a point object that can be viewed by setting the PDMode system variable to a non-zero value (my personal favorite is to use mode 3, X marks the spot). This program is a nice example that shows how to manipulate objects in VBA and exposes some of the powerful methods available to object-level programmers.

Top Tip Tip 2242: Connect the Blocks
This month's top tip is Connect the Blocks by Paul Martinez. Connect the Blocks automates the drawing process for irrigation plans by drawing lines between the insert points of selected blocks. After loading the LISP code, type ConnectBlocks to operate this power tool. You first must draw blocks that you want connected, because the first prompt in ConnectBlocks will be to select the blocks you want connected. The LISP subr SSGET is used in this function with a filter to make sure you can select only block inserts. After you have selected the blocks, the insertion points are gathered into a list and sorted in ascending order. This list provides the points that will be connected by lines automatically. This function is useful in a variety of disciplines, and it can save a lot of time for those who are currently generating this type of drawing manually. Great work, Paul; this is well deserving of this month's top tip award and the $100 prize.

That wraps up this edition of "Hot Tip Harry," but there are plenty more great tips and tricks out there. Send in your tips and become eligible to win some great prizes, including Cadalyst t-shirts, the $100 monthly top tip prize, and a trip to Autodesk University in Las Vegas -- not to mention the honor of sharing your creative work with thousands of other AutoCAD users! Until next month, keep on programmin'.


Join the Hot Tip Harry Challenge
Calling all tip writers! The Hot Tip Harry Challenge is under way for 2007, sponsored by Autodesk. Share your hot tips and tricks for a chance to win a trip to Autodesk University 2007, a $100 cash prize each month and an official Cadalyst t-shirt. For more details, click here.

Subscribe to Harry's Code Class: Tips for Programmers
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: Tips for Programmers. Subscribe 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! forum offers assistance with AutoCAD programming and customization problems. Hot Tip Harry -- Requests 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 from readers -- all reviewed by Cadalyst's volunteer Tip Patrol. Plus, you'll also receive a rundown of new online CAD resources, deals and freebies, the past week's new CAD-related hardware and software products, and more. View the 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