AutoCAD – Drawings

Attribute blocks in AutoCAD: create them with ATTDEF, insert with prompts, and why EXPLODE loses the text — with a sample library

Create attribute blocks in AutoCAD with ATTDEF; ATTREQ decides if inserting asks for values. EXPLODE leaves only the tag, BURST keeps the text. Library.

  • TS. Đỗ Quốc Hoàng
  • 8 min read
Three sample attribute blocks for room name, grid bubble and level in AutoCAD, and what EXPLODE and BURST leave behind Photo: AutoCAD 2027 screenshot and diagram by the Institute of Information Technology in Civil Engineering

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:

StepThe promptExample answer
1Enter an option to change [Invisible/Constant/Verify/Preset/Lock position/Annotative/Multiple lines] <done>:Enter to keep the defaults
2Enter attribute tag name:TEN_PHONG, the tag, no spaces
3Enter attribute prompt:Ten phong, the question asked on insert
4Enter default attribute value:PHONG, the default value
5Specify start point of text or [Justify/Style]:J, MC, then the middle point
6Specify height, Specify rotation angle of text250, 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.

PartExampleRole
TagTEN_PHONGInternal name, used for data extraction
PromptTen phongThe question shown on insert
DefaultPHONGUsed if nothing is typed

Building the attribute block

Draw the graphics, place the attribute, then group both into a block:

  1. Draw the room tag frame with RECTANG, 3000 × 1000.
  2. Create the attribute with -ATTDEF as above, centred in the frame.
  3. Type -BLOCK, name it O_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:

ATTREQAutoCAD asksValue of the insert
1Enter attribute values, then Ten phong <PHONG>:What you type, e.g. KHACH
0NothingThe 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:

CommandLeft after explodingText shown
EXPLODEFrame + an AttributeDefinitionTEN_PHONG, the tag; the value NGU 1 is gone
BURST (Express Tools)Frame + a TextNGU 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.

BlockAttributes (tag · prompt · default)
TEN_PHONGTEN · Tên phòng · PHÒNG; DIEN_TICH · Diện tích (m2) · 0.00
TRUCSO_TRUC · Số trục · A
CAO_DOCAO_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

  1. Type ATTREQ and set it to 1, so every insertion asks for values.
  2. Open the library and copy one TEN_PHONG into the plan; the definition comes with it.
  3. -INSERT, name TEN_PHONG, click in each room; answer the room name, then the area.
  4. Take the areas from room boundaries; see the BOUNDARY command.
  5. Never EXPLODE tagged blocks. If you must break them, use BURST.
  6. 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:

HabitWhy
Keep tags short, in capitals, without spacesThe tag is the name tools use to find each value
Write prompts as questions a colleague understandsThe prompt is all they see when inserting
Give every attribute a sensible defaultWith ATTREQ at 0, the default is what ends up on the drawing
Use a TrueType text styleAccented text only displays correctly with such fonts
Keep the library in its own fileCopying one insert brings the definition into any drawing

Three things often repeated that are not true

Often repeatedWhat holds on the 2027 release
Inserting an attribute block always asks for valuesOnly when ATTREQ is 1
EXPLODE keeps the attribute textThe tag is shown; the value is lost
After BLOCK the original objects stay looseThe 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.

About the author

TS. Đỗ Quốc Hoàng — Vice Director of the Institute of Information Technology in Civil Engineering, Hanoi University of Civil Engineering, and a specialist in software development for construction