Room tags, grid bubbles, level markers, title blocks: symbols repeated hundreds of times across a set, each time with different text. A separate block for each is too many; one block exploded and edited each time loses consistency. Attribute blocks in AutoCAD solve that: the block keeps the fixed graphics, while the text is an "attribute" filled in at every insertion.
This article covers creating attributes with ATTDEF, putting them in a block, inserting with prompts, and the trap when exploding, in AutoCAD 2027. At the end there is a sample library of three attribute blocks to download. Editing values and definitions of existing attributes is covered in editing blocks. For blocks and drawing standards taught properly, the Institute runs an advanced AutoCAD course.
The ATTDEF command: creating one attribute
The attdef command opens a dialog; -ATTDEF, the command-line version, asks in turn. Quoted from 2027:
| Step | The prompt | Example answer |
|---|---|---|
| 1 | Enter an option to change [Invisible/Constant/Verify/Preset/Lock position/Annotative/Multiple lines] <done>: | Enter to keep the defaults |
| 2 | Enter attribute tag name: | TEN_PHONG, the tag, no spaces |
| 3 | Enter attribute prompt: | Ten phong, the question asked on insert |
| 4 | Enter default attribute value: | PHONG, the default value |
| 5 | Specify start point of text or [Justify/Style]: | J, MC, then the middle point |
| 6 | Specify height, Specify rotation angle of text | 250, 0 |
Before step 1 AutoCAD prints the current modes: Invisible=N Constant=N Verify=N Preset=N Lock position=Y Annotative=N Multiple line=N. The result is an AttributeDefinition object showing TEN_PHONG on screen. The Autodesk documentation on ATTDEF describes an attribute as an object included in a block definition to store data such as part numbers or product names.
The mode line is worth one careful read. Invisible=N means the attribute shows on the drawing; Constant=N means a value is entered at each insertion rather than fixed; Lock position=Y means the attribute text stays put inside the block. To change a mode, type its capital letter at step 1, for example I for Invisible, before pressing Enter to move on to the tag. For room tags, grid bubbles and levels the defaults are fine.
| Part | Example | Role |
|---|---|---|
| Tag | TEN_PHONG | Internal name, used for data extraction |
| Prompt | Ten phong | The question shown on insert |
| Default | PHONG | Used if nothing is typed |
Building the attribute block
Draw the graphics, place the attribute, then group both into a block:
- Draw the room tag frame with
RECTANG, 3000 × 1000. - Create the attribute with
-ATTDEFas above, centred in the frame. - Type
-BLOCK, name itO_PHONG, pick the base point, select both the frame and the attribute.
At step 3 the command line reports Current settings: Object conversion=Convert: the original objects are immediately replaced by an insert of the new block, the object count dropping from 2 to 1. In this mode AutoCAD opens the Edit Attributes dialog to ask for that insert's values. If you do not want an insert left in place, change the mode with the mOde option in the same command.
Inserting: ATTREQ decides whether you are asked
Insert O_PHONG with -INSERT. Whether AutoCAD asks for the attribute value depends on ATTREQ:
| ATTREQ | AutoCAD asks | Value of the insert |
|---|---|---|
| 1 | Enter attribute values, then Ten phong <PHONG>: | What you type, e.g. KHACH |
| 0 | Nothing | The default PHONG |
On the machine used for this article ATTREQ was 0, a value that may differ from yours, so attribute blocks were inserted silently with their defaults. You only notice afterwards that every room is called "PHONG". If that happens, type ATTREQ and set it to 1. With ATTDIA at 0, as here, the question appears on the command line, as in the table.
Explode attributes or burst them
An insert of O_PHONG holds the value NGU 1. Two ways to break it apart:
| Command | Left after exploding | Text shown |
|---|---|---|
EXPLODE | Frame + an AttributeDefinition | TEN_PHONG, the tag; the value NGU 1 is gone |
BURST (Express Tools) | Frame + a Text | NGU 1, the value kept |
This is the biggest trap. When you explode attributes with EXPLODE, they revert to definitions, so the drawing shows the tag instead of the content. A plan with twenty rooms, exploded, shows twenty identical TEN_PHONG labels. To break a block apart and keep the text, use BURST from Express Tools. On first use in a session it prints Initializing... while Express Tools loads, then asks Select objects: like EXPLODE. It needs a normal pick on the block; the block's frame is the easiest part to click. After bursting, the frame is an ordinary polyline and the text an ordinary Text object, so they can be edited like any other geometry, but the link to the block definition is gone for good. Burst only the inserts you really need to turn into plain geometry, and keep the rest as blocks so that their values can still be extracted.
A block attribute library to download
The Institute has prepared a file of three attribute blocks common on architectural and structural drawings, all using an Arial text style so accented Vietnamese can be typed. Their contents are below.
| Block | Attributes (tag · prompt · default) |
|---|---|
TEN_PHONG | TEN · Tên phòng · PHÒNG; DIEN_TICH · Diện tích (m2) · 0.00 |
TRUC | SO_TRUC · Số trục · A |
CAO_DO | CAO_DO · Cao độ · +0.000 |
The file already contains one insert of each: a living room of 18.50 m², grid 1 and level +3.600, as in the image above. To use them, open the file and copy a sample into your drawing. The block definition travels with the insert: the receiving drawing gets TEN_PHONG with both attributes, and the copy keeps its values. The file is saved in AutoCAD 2018 format, so it opens in 2018 and later.
The data in attributes can be extracted to a table; see exporting AutoCAD to Excel.
Tagging a whole plan: a worked order
- Type
ATTREQand set it to 1, so every insertion asks for values. - Open the library and copy one
TEN_PHONGinto the plan; the definition comes with it. -INSERT, nameTEN_PHONG, click in each room; answer the room name, then the area.- Take the areas from room boundaries; see the BOUNDARY command.
- Never
EXPLODEtagged blocks. If you must break them, useBURST. - Extract all names and areas to a spreadsheet for the room schedule.
Done this way, the room schedule comes straight from the drawing rather than being retyped by hand. That is the real payoff of attribute blocks in AutoCAD: the text on the drawing and the numbers in the schedule are the same data, so they cannot drift apart the way a hand-typed table and a hand-edited drawing do.
A few habits keep the library useful over time:
| Habit | Why |
|---|---|
| Keep tags short, in capitals, without spaces | The tag is the name tools use to find each value |
| Write prompts as questions a colleague understands | The prompt is all they see when inserting |
| Give every attribute a sensible default | With ATTREQ at 0, the default is what ends up on the drawing |
| Use a TrueType text style | Accented text only displays correctly with such fonts |
| Keep the library in its own file | Copying one insert brings the definition into any drawing |
Three things often repeated that are not true
| Often repeated | What holds on the 2027 release |
|---|---|
| Inserting an attribute block always asks for values | Only when ATTREQ is 1 |
| EXPLODE keeps the attribute text | The tag is shown; the value is lost |
| After BLOCK the original objects stay loose | The Convert mode replaces them with an insert |
Frequently asked questions
Which command creates block attributes?
ATTDEF, or -ATTDEF on the command line. Create the attribute first, then group it with the graphics using BLOCK.
Why does inserting not ask for values?
ATTREQ is 0. Set it to 1, and the next insertion asks for each attribute in turn, showing its default in angle brackets.
Why did the text turn into the tag after exploding?
EXPLODE reverts attributes to definitions. Use BURST to keep the values as plain text instead.
How do tag, prompt and default differ?
The tag is the internal name, the prompt is the question on insert, and the default is the value used when nothing is typed.
Is there a ready-made attribute block library?
Yes, a three-block sample file is available in the download section: room tag, grid bubble and level marker.
Can attributes hold accented text?
Yes, if the attribute's text style uses a TrueType font such as Arial; the sample blocks are already set up that way, and the sample room tag reads PHÒNG KHÁCH with its accents intact.