RecipesExport to Excel and PDF

How do I make a bill of materials from the blocks in an AutoCAD drawing?

Type "make a bill of materials: block name, count, and the PART_NO and DESCRIPTION attributes". cadssistant reads every block reference and its attributes, groups by block name and part number, and replies with a table of name, part number, description and quantity; Copy or Excel exports it. Say "only layer P-FIXT", "by effective name" for dynamic blocks, or "sorted by part number". Nothing in the drawing changes.

Checked 2026-10-30

What you typeCommand: CADSSISTANT

make a bill of materials: block name, count, and the PART_NO and DESCRIPTION attributes

Paste it into the palette, or pick it from the recipes inside the chat.

What cadssistant does

  1. Selects every INSERT with attributes and walks each one's attributes in one AutoLISP pass, reading tag and value.
  2. Groups by block name and PART_NO, counts, and replies with the table: name, part no., description, qty.
  3. Copy or Excel on the table exports it.

The same task in AutoLISP

(progn
  (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1))) i 0 rows nil)
  (if ss
    (repeat (sslength ss)
      (setq e (ssname ss i) i (1+ i) nm (cdr (assoc 2 (entget e))) part "" desc ""
            att (entnext e))
      (while (and att (= (cdr (assoc 0 (entget att))) "ATTRIB"))
        (setq tag (cdr (assoc 2 (entget att))) val (cdr (assoc 1 (entget att))))
        (cond ((= tag "PART_NO") (setq part val)) ((= tag "DESCRIPTION") (setq desc val)))
        (setq att (entnext att)))
      (setq key (list nm part desc))
      (setq rows (if (assoc key rows)
                   (subst (cons key (1+ (cdr (assoc key rows)))) (assoc key rows) rows)
                   (cons (cons key 1) rows)))))
  rows)

Returns ((name part description) . qty) pairs. Blocks without attributes are left out by the (66 . 1) filter; drop it to count them too.

Good to know

  • Attribute values are the current ones, invisible attributes included.
  • Say "and the layer" or "and the area of each" for extra columns; anything readable from the reference or its definition can be a column.
  • For the same list as a table on the sheet, see Put a bill of materials table in the drawing.

More in export to excel and pdf

Command: CADSSISTANT

Works in AutoCAD 2024 and newer on Windows. Free trial, no card, no API key.

Get cadssistant