A Closer Look at Creating and Using Attributes in AutoCAD

Attributes can be added to block definitions for making them more informative. For example, you can add an attribute to a door or window block of a drawing indicating its manufacturer’s name, size or description. You can add visible as well as invisible attribute values to the blocks. For example, the name of a manufacturer of a furniture block can be kept hidden so that it remains invisible from drawing area whereas the type of furniture can be made visible so that it appears in drawing area. In this article, I will explain methods of making, modifying and using Attributes in your AutoCAD drawing. Let’s start with defining attributes.


Defining Attributes

Let's take the example of a room tag icon that will show room number and name of occupant in your drawing using attributes as shown below.

Sample room tag.

To make this symbol, create a hexagon with a horizontal line passing through its center. Click on the Define Attributes icon on the Block Definition panel of the Insert tab. You can also use its command equivalent, ATT. A new Attribute Definition window will pop up. Select the name of the tag from the Tag field of the Attribute panel. I am naming the current tag ROOM. Make sure you enter only uppercase letters as a tag without special characters or spaces. If you enter a tag with lowercase letters, it will be converted to uppercase in the attribute definition.

In the next field, you need to enter the prompt that will appear on the command line or on the Edit Attributes window. I am using “Enter Room number” as a prompt. In the Default field, enter the default value, which will appear in the absence of any input. I am entering a default value of 00.

Now let's move to the Text Settings panel. Select Middle center in the Justification drop-down menu, and choose your preferred text style from the Text style drop-down. I am selecting Standard as the text style for this case.

From the Text height field, specify the height that you want to assign to the attribute text. You can also click on the Annotative check box if you want to make this text annotative. Make sure the “Specify on-screen” check box is selected from the Insertion Point panel. From the Mode panel, uncheck all radio buttons except the Lock position.

When all of these changes are made, click on OK to accept the changes and close the Attribute Definition window. See Figure 1 for reference.

Figure 1. Attribute Definition window.

To place a Room tag, click at a point approximately at the middle of the upper half of the hexagon. Repeat the process as explained in steps above to insert one more attribute in the geometry in the lower half of this hexagon and name it OCCUPANT.


Assigning Attributes to Block Definition

In order to make these attribute definitions useful, you need to insert them in blocks. I will convert this room tag icon and attributes into a block.

For creating a block, click on the Create Block icon on the Block Definition panel of the Insert tab. You can also use its command equivalent, B. A new Block Definition window will pop up. Let’s name this block Room Tag. Now click on the Pick point icon from the Base point panel of the Block Definition window and assign a base point for the block. I am selecting the geometric center of the hexagon as the base point. Then click on the Select objects icon from the Objects panel and select all objects that form the Room Tag block, including attributes. Once you have made these changes, click on OK to accept the changes and close the Block Definition window.


Inserting Blocks with Attributes

You can insert blocks containing attributes in the same way a normal block is inserted in the drawing. Click on the Insert icon on the Block panel of the Home tab, and select Room Tag block from the flyout. Click at a point in the drawing area to insert it.

If the ATTDIA system variable is set to 1, you will see the Edit Attributes window with all prompts as shown in Figure 2; however, if the ATTDIA system variable is set to 0, the prompts will appear on the command line.

Figure 2. Edit Attributes window.

Insert appropriate values in the fields, and click OK to add the block with the attribute in the drawing area.


Modifying Attributes

To modify an attribute definition, double-click on it. A new Edit Attribute Definition window will appear with all defined fields of the related attribute, like Tag, Prompt and Default values. You can change respective fields in this Edit Attribute Definition window, and click on OK to accept the changed values.

Edit Attribute Definition window.

Let's say that we want to modify the occupant attribute. For that, double-click on the occupant tag from the drawing area and then change the value of the tag from OCCUPANT to USER in the Edit Attribute Definition window.

You can insert fields in attributes as well. Fields are text information that can change during the design process or during the lifecycle of a drawing. To add a field in place of the default text of an attribute, click inside the box containing the text "John" in the Edit Attribute Definition window, then right click and select Insert Field from contextual menu as shown in the image below.

A new Field window will appear. From the Field category drop-down menu, select Document and then select Filename from the Field names panel and Uppercase from the Format panel. Also make sure the file name only radio button is selected. Once you have made these changes, click on OK to accept the changes and close the Field window.

You can also modify attribute definitions from the Properties palette. For modifying any attribute, select it and then right-click and select Properties from the contextual menu. A new Properties palette will appear with a list of all the defined attribute fields, which can be modified directly by entering new values in the Properties palette.

To modify common properties of multiple attributes in the drawing, select all attributes and then double-click on any one of the selected attributes. A new Attribute Definition palette will appear from this palette in which you can modify common properties like TAG, Prompt or Text height.


Editing Attribute Values

To edit an attribute value, double-click on the block containing the attribute. A new Enhanced Attribute Edit or window will appear. This window will contain a list of all defined attributes of the selected block. Click on the attribute whose value you want to modify and then enter its new value in the Value field. Click on OK to apply the changes and close the Enhanced Attribute Editor window.

Enhanced Attribute Editor window.


Explode and Burst for Attributed Blocks

If you want to return a complex geometry such as blocks or a polyline into its constituent geometries, the EXPLODE command can be used. Similarly, in case of blocks containing attributes, you can use the EXPLODE command to change a block into its constituent geometries and attribute definitions. The EXPLODE command will change the defined value of the attribute to its default tag. But if you want to explode a block containing the attribute in such a way that its assigned values are kept intact, then the BURST command can be used.

The BURST command is a part of express tools, and it’s not a native AutoCAD command. So if you don’t have express tools installed, you may need to install it before using the BURST command.

Here is an example of our sample block with attribute tag values as 00 and John. On the top, we have an original block with assigned tags. In the bottom left, we have an exploded block, and on the right, we have a block containing attributes on which the BURST command is used.

Using EXPLODE and BURST command on blocks.


Modifying Blocks Containing Attributes

In order to modify blocks containing attributes, you can use Block Editor or you can completely redefine blocks by exploding them. As an example, I will modify the Room Tag block in such a way that the hexagon is replaced with a circle.

Select an existing room tag block from the drawing area and explode it. Now make a circle using the geometric center of the hexagon as the center of the circle and delete hexagon. Click on the Create Block icon on the Block Definition panel of the Insert tab and name it Room Tag. Select the center of the circle as the base point, select all attribute tags, the circle and the central diameter line from the Select Objects panel and click on OK.

A new Block-Redefine Block message box will appear. Select Redefine block from this message box. You will notice that in all of the instances of the Room Tag block, the hexagon will be replaced with a circle.

Block-Redefine Block window.


Conclusion

Attribute definitions are a great way of storing text information as part of blocks in AutoCAD drawings. Using this feature, you can store user-defined information as well as information in the form of fields. The attributes can also be set to store invisible information in your blocks that will not appear on your drawing but can be extracted or viewed directly from the DWG file.