Tips from our readers: control your layers, date your drawings, and more

CADalyst, August, 2004 by Bill Kramer

As I walked out of a cafe in Athens, Greece, I noticed the sun shining brightly off a little car. Who was leaning against it? Harry, of course. "Ever seen one of these?," he asked. "Little sucker gets 100 kilometers to the liter." I wasn't sure how he fit into it, let alone the ton of tips he carries around with him. I didn't have to ask what Harry was doing in Athens. There on the car seat was an envelope marked Olympics. Harry said, "That's for your readers--some great stuff once again."

LAYER CONTROL

First event up in the Tip Olympics is layer control. Everyone has a better way of doing layers. That's what makes them great--they're so adaptable. Of course, that means you need to be able to track them. That brings us to Get Object Color Relationship (Tip #1968) from Walt Bedinger. This utility lets you check the color and layer relationship for entity objects. After loading the function, type Getcolor at the Command prompt and select an object in the drawing. A prompt appears with the object's color and layer assignments. This is a friendly function that lets you know if a color assignment is by block, layer, or the object. It also clearly demonstrates how the color code and layer name system are used in entity data lists.

Theodorus Winata's Copy to Layer (Tip #1969) lets you select a layer name from a dialog box. After you pick the layer name, an object selection prompt appears for objects to be copied. You can select multiple objects. Next the routine requests a base point plus displacement point. It copies the selected objects to the new location with the layers changed. Combining multiple steps into a single command is what it's all about. Excellent tip!

The leader in complexity for the layer events is Layer Display Suite (Tip #1970) from Rechen Nan. This suite of commands is supplied as a pair of files zipped together. Unzip the files and place the LSP and DCL files in the standard AutoCAD search path. Once the LSP file is loaded, you can select from six commands that control the display of layers (by hiding or showing them). The commands in this suite are:

* Ho: hide selected objects

* Show: show all objects

* Hexp: hide all objects except those selected

* Sbl: show objects on layers selected

* Hbl: hide layer based on object selection

* HBLE: hide all objects except those on layers of selected objects

How useful is a function set like this? That depends how many layers you have.

SIMPLE WINS THE PRIZE

As you know, an elegant and simple combination of commands to accomplish a task is often best. Date Stamp (Tip #1971) from Leonid Nemirovsky is a great example of this concept. The date stamp program (type DST after loading the LSP file) asks for a location, then inserts the current drawing name, along with the date and time the drawing was last saved. This routine takes advantage of the field feature in text inside AutoCAD 2005, resulting in a short and succinct function. It won't work with earlier releases of AutoCAD.

Quick Area (Tip #1972) from Bryan Bobrick provides a quick answer to the question: What is the area of that object? After the LSP file is loaded, start the Quickarea command. The function prompts you to select a closed object such as a circle or a polyline. After you select the object, the routine executes the Area command and shows the value in the AREA system variable. Quickarea displays the value from the system as square feet and other units of measure, although you may be using different units. This function is a great example of how to exploit information inside AutoCAD with AutoLISP.

Watson Kilbourne supplies us with another hatch pattern, Arched Tiles (Tip #1973). This hatch pattern looks like a tiled roof. Watson's genius for patterns knows no parallel. This one makes you want to start tiling every roof.

THE COUNTDOWN BEGINS!

Harry reminded me that we're in the closing stretch for the $1,000 grand prize in our own Code Olympics. Some readers have contributed great code so far, but it's not over yet. Visit the Cadalyst Web site (www.cadalyst.com) and send us your best work to review for inclusion in Hot Tip Harry's library.

GET THE CODE Download free code for this and all articles at www.cadalyst.com. Look for aug04.exe in Get the Code.

Tips are tested with AutoCAD 2005, 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. All published tips are entered into the annual Hot Tip Harry Contest. Find out more online, and e-mail your tips and tricks to harry@cadalyst.com. Vote for your favorite tip this month at: www.cadalyst.com

Bill Kramer, president of AUTO-CODE MECHANICAL,

contributing editor for Cadalyst, former headmaster of the Wizard's Lab at pointA, and refugee scribe from Cadence, is a programmer and writer with more than 20 years of experience in the field of CAD/CAM/CAE.

COPYRIGHT 2004 Questex Media Group, Inc.
COPYRIGHT 2008 Gale, Cengage Learning

 

BNET TalkbackShare your ideas and expertise on this topic

Please add your comment:

  1. You are currently: a Guest |
  2.  

Basic HTML tags that work in comments are: bold (<b></b>), italic (<i></i>), underline (<u></u>), and hyperlink (<a href></a)

advertisement
CXO UnpluggedSmart Business interviews on BNET

See and hear how senior level executives across the Asia Pacific are developing smart business ideas across a variety of sectors. The focus is on the future, and on how businesses need to evolve.

advertisement
  • Click Here
  • Click Here
  • Click Here
advertisement

Content provided in partnership with Thompson Gale