Tips from Our Readers -- July 2007 (Hot Tip Harry AutoCAD Tutorial)30 Jun, 2007 By: Bill Kramer
One programmer with two great tips: flip linetypes and repair blocks.
Let's take a look at the tip sheet for this month.
Tip 2219: Section Lines
Section Lines by Steve Schenck creates section lines defined by a quadrilateral. The four-sided figure is divided into four equal sections along each side with lines drawn that connect the edges. The result is a grid fashioned along the four sides. This tool is great for maps that have keystone shapes and other areas that can be defined using four linear edges. Load up the LISP code and type the command name QUADLINE to start the function. Next, you'll be asked to locate the four corner points defining the region. An option is presented to draw the section boundary before the automatic part takes over drawing the lines on different layers for easy identification and use. This approach to coding is very practical and straightforward. Nice job, Steve.
Tip 2220: Change Text Properties
Change Text Properties by Joseph J. Floss, simplifies basic edits to text properties to just those you might need. Adjust text size, width, content or case one line of text at a time after loading the LISP code. At the AutoCAD Command prompt, type Chgtxt to start the function. First, you will be asked to pick a text object. A menu of options at the Command line presents choices for text height, width, uppercase conversion, lowercase conversion or typing in a new string. This function shows that sometimes dialog boxes just slow you down when you know what you're doing.
Tip 2221: Copy Objects to Layer
Theodorus Winata wrote Copy Objects to Layer, which does two things at once -- and with a nice style, too. The tip contains a dialog box file (DCL) as well as the LISP source code, so place the DCL file somewhere in the normal AutoCAD search path. After loading the LISP code, type Cpl at the Command prompt to activate the command. A dialog box appears, displaying a list of the current layers in the drawing. Select one of the layer names or the button to pick from an object in the drawing. When ready, select OK to continue to the copy portion of the command function. Select objects to be copied in the normal manner inside AutoCAD. Next, pick the base point and the displacement point. The objects will be copied, and the layer value changed to the layer name that you selected in the dialog box at the start of the command. This tip is a nicely coded example of how to manipulate the layer table, use a custom dialog box, and work the AutoCAD commands. A tip of the hat to Theodorus.
Tip 2222: Adjust Polyline Width
To use Adjust Polyline Width by Brian Benton, load the LISP code and type the name PLWS at the command prompt to start the edit utility. The first order of business is to type in the new width value you want to apply to the polyline. Next, select the polyline and the width changes. This utility is another great example of how you can streamline drawing cleanup and edit work with LISP in AutoCAD.
Tip 2223: Block Detail Extraction
Harry reports there were recent discussions on the Hot Tip Harry Discussion Forums concerning dynamic blocks and how to obtain details out of them. As if by magic, Block Detail Extraction by Tormod Sunne showed up with the cryptic name Drbln. When loaded, this function lets you select a block insertion, then displays the name and any details for dynamic blocks. This utility is a fantastic example that clearly shows how to dig into a dynamic block, get the details and present them to the operator. Nicely done.
Tip 2224: Automating Xclip
Automating Xclip by Raymond Rizkallah automates the Xclip command by creating a new block name on the fly and skipping all the prompts. Load the LISP code and type Xcc at the Command prompt. Pick the objects to be included in the Xclip result, then either supply a pair of corner points or type S to select a closed polyline that will serve as the clipping boundary. The rest is automatic, and the entities selected are turned into a block and then clipped using Xclip. This just goes to show that even a cool command like Xclip can use some customization to make it work even faster.
Tip 2225: Block Repair Block Repair is one of two gems this month from Michael Kolomiyets. This utility repairs blocks by going through selected block definitions and changing the properties of the objects inside back to the basics. The basics consist of layer "0," no special colors and no special linetypes. You are given the chance to tell the routine not to change these values when running. With a little tweaking, you can make this function automatically detect and correct other standards inside block definitions based on your rules. Load the LISP code and type Brp to run the Block Repair utility. This tip demonstrates some top-flight programming.
Tip 2226: Complex Linetype Flip
It was only by a flip of his trusty silver 50-cent piece that Harry was able to choose between the two tips submitted by Michael Kolomiyets and name this month's top tip. Complex Linetype Flip won the call. This routine is a fascinating utility that works most of the time inside AutoCAD 2008. (Although programmed, the edit commands didn't work properly because of set creation option used. This is a good exercise for advanced programmers.) The idea behind this program is that lines created using complex linetypes might appear backward based on the way they were defined. When active, this routine will flip the lines around so that the text and blocks in the middle of the complex linetype appear properly oriented. The functionality activates upon loading the LISP code. It automatically starts by correcting any complex lines it finds. Then it continues to stick around and automatically correct lines after you draw them. It's a very nice set of functions and worth studying. Reactors are not difficult to program, but they can be interesting to debug as you fine-tune your coding. Harry appreciates Michael's support and willingness to share his great programming prowess with others. Thanks, Michael -- and please, 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!