AutoCAD

Editing Your Attributes

1 Feb, 2000 By: Lynn Allen


Last month, I showed you how to increase the intelligence of your blocks with Attributes by adding a variety of different types of attributes to a block and saving it. I also explored the options available to you upon insertion of your blocks. If you missed last month's column (Circles & Lines: "Are Your Blocks Smart?") and can't find that issue lying around, you might consider visiting the Cadalyst Web site at where you'll find my past columns. This month, let's continue down Attribute road and investigate your options should you need to edit your attributes (which inevitably you will).

So, you've inserted a variety of blocks with attributes, and you want to edit the actual attribute values. DDATTE to the rescue! You can key in DDATTE at the command prompt or grab it from the pulldown menus. For Release 14, go to Modify>Object=>Attribute=>Single...; AutoCAD 2000 users should select Modify=>Attribute=>Single ....

DDATTE will prompt you to select a block after which a dialog similar to that shown in Figure 1 will appear. You'll see that I'm still using the Sofa block definition I created last month. DDATTE is simple enough to figure out, simply key in any attribute values that need to be changed. If you have more than eight attributes in a block, you'll need to page through them. You'll also find that you cannot edit attribute values that reside on locked layers. Note that Constant attributes can never be changed-they're pretty much cast in concrete!

Global Editing
So what if you need to change all of the Ethan Allen sofas from $375 to $475? It would take a great deal of time to comb all of the sofa blocks and change them all using DDATTE. But what if you need to change an attributes height, layer, color or placement? Then you'd need to use a more stellar (but somewhat archaic) command called ATTEDIT.

ATTEDIT hasn't changed much over the years, so it has unfortunately been left behind somewhat technically (which you'll see shortly). But it does the job and that's all that matters. If you're in AutoCAD Release 14 or earlier, all you need to do is key in the command at the command prompt or use the pulldowns (Modify=>Object=>Attribute=Global). AutoCAD 2000 users can grab it from the pulldowns as well (Modify=> Attribute=>Global) or key in -ATTEDIT. Unfortunately ATTEDIT was mapped to the DDATTE dialog in AutoCAD 2000, so you'll need to key in the extra dash to use the command. Let's look at the command:

Command: -attedit
Edit attributes one at a time?
[Yes/ No] <Y>:

figure
Figure 1. You can easily edit attribute values by using the DDATTE command.
This is the first fork in the ATT-EDIT road. If you choose No, you may edit your attribute values globally. You can replace one text string with another text string in as many blocks as you like. If you needed to change all of your manufacturer attributes from "Ethan Allen" to "Levitz," this would be the perfect means for doing so. Let's take a look at this route:

Edit only attributes visible on screen? [Yes/No] <Y>:
Do you want to be prompted to manually select the attributes you want to edit (Y), or do you want AutoCAD to take a look at all of the attributes, visible or not (N)?

The next three questions have to do with narrowing down the field of attributes for editing using a variety of filters.

Enter block name specification <*>:
Would you like to narrow down the blocks you're interested in? The asterisk default indicates that all blocks are possible candidates.

Enter attribute tag specification <*>:
Would you like to narrow down the attribute tags you're interested in editing?

Enter attribute value specification <*>:
Would you like to further narrow down the candidates by keying in attribute values you're interested in editing?

Select Attributes: Specify opposite corner: 8 found
Select Attributes:

8 attributes selected.
Enter string to change: Ethan Allen
Enter new string: Levitz

The end result is that all of the attribute text that read "Ethan Allen" has been replaced with "Levitz." Keep in mind that Attribute values are case sensitive, so you must enter the identical text case found in the attribute text in order to edit it. If you have any null attributes [no value assigned], you cannot select them for editing. To select a null attribute value, simply enter a backslash (\).

One at a Time
So that's the method used for global attribute editing. Let's take Route Number 2-editing the attributes one at a time. You'll find these first three prompts familiar; you were asked them when you chose to go the global route.

Enter block name specification <*>:
Enter attribute tag specification <*>:
Enter attribute value specification <*>:

Select Attributes: 8 found
(Manually select the attributes you're interested in editing using the usual object selection techniques. The selected attributes must be on a UCS parallel to the current UCS.)

Select Attributes:
8 attributes selected.
Enter an option [Value/Position/ Height/Angle/Style/Layer/Color/Next] <N>:

Look what's hidden in the ATTEXT command! The ability to edit the attribute value, position, height, rotation angle, text style, layer and color.

After selecting the attributes you want to edit, AutoCAD will step through the attributes one at a time. An "X" will appear on the current attribute. Select the option you need, make the necessary edit and the change will appear instantly. When you're finished making edits to the current attribute, "Next" will take you to the next attribute for editing.

ATTEDIT lets you step your way through each selected attribute, making the necessary modifications along the way.

So what if you need to add a couple more attributes to a block? Can you just explode the block, add the attributes and redefine as usual? You would think so, but you'd be very wrong. Unfortunately redefining blocks with attributes has always been a thorn in AutoCAD's side. The Attribute Redefine command (ATTREDEF) was added as a bonus routine many releases ago and has now made it's way into core product. This, along with several of the fantastic Express Tools, has made redefining a block with attributes somewhat easier. Here's how it works.

Let's say you want to remove the Cost attribute and add a Model Number attribute. You insert an exploded SOFA block, delete the Cost attribute and enter the ATTDEF command to add a new attribute for Model Number. You then enter the BLOCK command, reselect all the attributes and redefine the block. What happens? You'll notice that all of the existing blocks remain just as they were, and you'll find that new block insertions will reflect the changes you just made to your SOFA block. This is actually bad news since now you have two different types of the same block residing in you drawing. Fortunately ATTREDEF can come to the rescue. Be sure you have the exploded block SOFA before you enter the command. You'll find that you need to key it in since it's Top Secret and doesn't reside in any of the menus.

Command: ATTREDEF
Enter name of the block you want to redefine: SOFA
Select objects for new Block...
Select objects: Specify opposite corner: 14 found
Select objects:
Specify insertion base point of new Block: end of

You'll find that all of your existing SOFA blocks have updated as well as any new insertions you choose to add. In fact, there is no need to use the BLOCK command at all to redefine blocks with attributes; ATTREDEF will do it all for you.

What happens if you need to explode a block with attributes? You'll find that the attribute values return to their original tag values


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
At your company, who has the most say in CAD-related software purchasing?
CAD manager
CAD users
IT personnel
vice-president/department manager
CEO/company owner
Submit Vote