Skip to content
Tutorials Center
My learning

Topics

Lesson 22 of 38 ยท Layers, Blocks and Annotation

AutoCAD Block Attributes, ATTDEF and Data Extraction

Add data to AutoCAD blocks with attributes: define tags with ATTDEF, edit values with EATTEDIT and BATTMAN, then export schedules and bills of materials with DATAEXTRACTION.

A block shows a shape. An attribute adds information to it: a room number on a room tag, a part number on a valve, a drawing title in a title block. Attributes are text fields stored inside the block that you can fill in at insertion time, edit later, and extract into a spreadsheet. This is how a drawing becomes a small database.

AutoCAD cannot run here, so the dialogs are described as they appear in the program and the runnable examples are JavaScript stand-ins that model the same data.

Defining an attribute with ATTDEF

Attributes are defined before the block is made, together with the shapes.

  1. Draw the symbol, for example a circle for a room tag.
  2. Run ATTDEF (alias ATT) or Insert > Block Definition > Define Attributes.
  3. Fill in the dialog:
    • Tag: the internal name, no spaces (ROOM_NO). It is the column header when you extract data.
    • Prompt: the question shown when inserting ("Room number?").
    • Default: the value used when you accept the prompt.
    • Text settings: justification, text style, height, rotation.
    • Insertion point: where the value appears.
  4. Click OK and the tag appears as text. Add more attributes for more fields (ROOM_NAME, AREA).
  5. Run BLOCK and select the circle and the attribute definitions, so they travel together.

On the Mode side of the dialog:

Mode Effect
Invisible The value is stored but not shown (good for part numbers)
Constant Same value for every insertion, never prompted
Verify AutoCAD asks you to confirm each value
Preset Uses the default, no prompt, but editable later
Lock position The value cannot be moved with grips
Multiple lines The value may be multi-line text

When you insert the block, AutoCAD asks for each non-constant attribute. In the Blocks palette workflow, the Enter Attributes dialog appears instead, or the command line prompts (set ATTREQ to 0 to skip the prompts and ATTDIA to 1 to use a dialog).

JS Stand-in: attribute prompts and defaults

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Editing attribute values

  • Double-click a block with attributes to open the Enhanced Attribute Editor (EATTEDIT): change values, text options and properties of one block.
  • ATTEDIT (the older command) edits many blocks in sequence; -ATTEDIT can do global edits (every block, by tag or value).
  • BATTMAN (Block Attribute Manager) edits the attribute definitions of a block: reorder tags, change prompts, defaults and modes. Press Sync or run ATTSYNC afterwards so existing references pick up the changes.
  • ATTDISP controls visibility: Normal, On (show all, even invisible ones) or Off (hide all).

Be careful when you change the definition: editing in the Block Editor does not always update values already inserted. Use ATTSYNC and check.

Fields: values that update themselves

A field is text that calculates its own content: the file name, today's date, the area of a polyline, the value of another attribute. Insert one with FIELD or inside MTEXT (right-click > Insert Field). Fields appear with a gray background (FIELDDISPLAY) and update on UPDATEFIELD, REGEN, SAVE or plot. A title block commonly uses fields for the drawing number, sheet number and total sheets (see title blocks).

A typical area label: insert a field, choose Object > pick a closed polyline > property Area, set the format and a unit conversion (square millimeters to square meters by a factor of 0.000001). When the room is stretched, the label follows.

Data extraction

DATAEXTRACTION (alias EATTEXT in older releases; Insert > Linking & Extraction > Extract Data) is a wizard:

  1. Create a new extraction or use a template (.dxe), and save the file.
  2. Choose the drawings or folders to scan.
  3. Select the object types: blocks, dynamic blocks, attributes and other drawing information.
  4. Pick the properties to export (block name, attribute tags, layer, position, count).
  5. Refine and sort the table, add formulas (sums) and columns, combine identical rows with Show count column.
  6. Output to an AutoCAD table in the drawing, an external .xls/.csv file, or both.

The result is the foundation of door and window schedules, equipment lists and bills of materials. Extracted tables can link to the data so you can Update after the drawing changes.

JS Stand-in: build a schedule from attribute data

Press Run (or Ctrl + Enter) to see the console output here.

No output.

From shape to schedule

Define ATTDEF adds tags
Block Shape plus tags
Insert Answer prompts
Extract Table or CSV

Four steps turn a drawing into data.

1 / 2

Common mistakes

  • Making the block before defining attributes, so they are missing.
  • Typing tags with spaces or different spellings across drawings (ROOMNO versus ROOM_NO), which splits columns.
  • Exploding an attribute block: the values turn into attribute definitions (tags) again and the data is lost.
  • Forgetting ATTSYNC after redefining a block.
  • Extracting from drawings with stale xrefs or frozen layers; check that the scan includes what you need.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the Tag of an attribute used for?

    The tag identifies the attribute. The prompt is the question, and the default is the pre-filled value.
  2. 2. Which attribute mode stores a value but hides it from view?

    Invisible attributes hold data such as part numbers without displaying it. ATTDISP can still show them.
  3. 3. You changed attribute definitions in BATTMAN. Existing blocks still show the old setup. What should you run?

    ATTSYNC (or Sync in BATTMAN) updates all references to match the revised definition.
  4. 4. Which command exports block and attribute data to a table or spreadsheet?

    DATAEXTRACTION (formerly EATTEXT) is the wizard that builds tables and .csv/.xls files. BCOUNT only reports counts.

Summary

  • Attributes add named data to a block; define them with ATTDEF before running BLOCK.
  • Modes control visibility, prompting and editing.
  • Edit values with the Enhanced Attribute Editor, definitions with BATTMAN, then ATTSYNC.
  • Fields calculate their own text from properties and system values.
  • DATAEXTRACTION produces tables and spreadsheets for schedules and bills of materials.

Next: Text, MText and multileaders