cadalyst
AutoCAD

Shortcuts and Solutions (Hot Tip Harry AutoCAD Tutorial)

30 Apr, 2008 By: Bill Kramer

Harry's top tip helps you manage xref block layers.


GET THE CODE
Download code for this and all articles. Look for MAY08.EXE or MAY08.ZIP 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 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, $100 monthly cash prize, and a chance to win a trip to Autodesk University 2008 in Las Vegas!
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!
Harry peered into the window with a smile on his face. As he slipped in the envelope with this month's top tips, he said, "I've got some great shortcuts and a few solutions for those pesky xrefs." And with that, he was gone - off searching for more tips to make AutoCAD work better. Let's take a look at this month's eclectic collection.

Tip 2285: Automatic XLines
Automatic XLines by Jon Jonas simplifies the creation of a horizontal or vertical construction line (xline) at selected points. Load the LISP code and type XHH at the Command prompt to create a horizontal construction line at a selected point. You can use XVV in the same way to create a vertical construction line. This nifty little tip makes horizontal and vertical construction lines a breeze. Nice job, Jon!

Tip 2286: Reset Path for Xref Blocks
Reset Path for Xref Blocks comes to us from frequent contributor Leonid Nemirovsky. This routine solves a relatively common problem for those who use externally referenced blocks - path changes. When you encounter a problem with lost xref blocks, copy all the external files into one folder that is part of the AutoCAD search path. Then load the LISP code and type XrefRel at the Command prompt. The rest is automatic, as the routine ripples down the blocks table and looks for externally referenced blocks. When found, it rebinds them to the drawing using the new folder location. It's a very useful routine when accepting drawings from outside sources.

Tip 2287: Convert Text to Standard Notes
Ravi Prakash sent in the Convert Text to Standard Notes utility, which includes LISP code for a series of simple functions that change existing text objects into standard drawing notes. Some simple fabrication notes are provided as examples in the code, and they can be adjusted to your own needs (see the SetQ assignments at the beginning of the code). The basic operation is to load the code and then type N1 (or N2, N3, . . . ) for the various notes. (Six are supplied in the tip.) When the command functions run, they ask you to select an existing text object in the drawing. The text data is then updated from the standard note text for the given N function and variable assignment. This tip is simple yet useful. Thanks for sharing, Ravi!

Tip 2288: DIMLFAC Quick Setting
DIMLFAC Quick Setting, submitted by Matt Sibum, is a very fast way to set the DIMLFAC system variable (linear dimension scale factor) when using nonassociative dimensions in a viewport. After loading the LISP code, type DF at the Command line. The macro prompts you to select a viewport, from which it grabs the height of the viewport in both paper space and model space units. The model space height is divided by the paper space height to produce a new scale factor for linear dimensioning in the viewport. This quick utility can be a significant time saver when dimensioning detail views.

Tip 2289: Layer Creator
Layer Creator from Timothy Spangler is a comprehensive application for managing a variable layer standards set. This utility lets you select from a library of predefined layer tables (maintained as ASCII text files) to quickly set up the layers, linetypes, and similar relationships in a drawing. Included is a TXT file that describes how to set up or edit any of the layer files. To use this utility, place the files in a path searched by AutoCAD and load the LISP code. Type LC at the AutoCAD Command prompt to launch the dialog box and select the layer setup you need. Nice programming!

Tip 2290: Tangent Arc Generators
Submitted by Rogelio Bravo, Tangent Arc Generators is a small set of utilities for generating arcs tangent to other objects. The tip includes four LISP files and one DCL file. Copy these files into a folder searched by AutoCAD and then load the ARCTOD.LSP file. Type Arctod at the AutoCAD Command line to activate the dialog box, where you can select from the arc generator options. Bravo, Bravo!

Tip 2291: Xref Block Layer Cleanup
Top Tip This month's top tip, Xref Block Layer Cleanup from Michael Kolomiyets, is a reactor-based solution for handling layers from xref blocks. This routine runs behind the scenes after it is loaded through the use of reactors. The goal is to add the letters "xref-" plus the block name to the start of all layers created through the inclusion of an externally referenced block. When the xref block is removed from the drawing, all the layers containing the letters "xref-" plus the block name at the beginning are removed from the drawing. This very elegant solution helps keep your layers straight and demonstrates the raw power of reactors in Visual LISP. Great job, Michael. This utility is a great example of reactor-based programming that is useful too!

Got some code you want to share? Harry is always looking for new AutoCAD tricks and tips to share. The global programmer community depends on your support. 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 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!

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


More News and Resources from Cadalyst Partners

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!