RecipesDraw and lay out
How do I put a bill of materials table in an AutoCAD drawing?
Type "Put a bill of materials on this sheet: block name, count, PART_NO and DESCRIPTION, next to the title block". cadssistant counts the block references by name, reads their PART_NO and DESCRIPTION attributes and draws a real AutoCAD table in the current table style: a title row, a header row and one row per block. It is a table object, not lines and text, so it edits like any other table. The same rows come back as a table in the chat, where Copy and Excel export them. For the chat table alone, see Make a bill of materials from blocks. By hand, it's DATAEXTRACTION with the output set to a table.
Checked 2026-10-30 · one of the tasks cadssistant's models are benchmarked on
Put a bill of materials on this sheet: block name, count, PART_NO and DESCRIPTION, next to the title block
What cadssistant does
- Counts the block references by block name, the way the drawing's block list reports them, and reads each one's PART_NO and DESCRIPTION.
- Draws one AutoCAD table in the current table style: a title row, a header row, then a row per block with name, count, part number and description. Column widths follow the longest text in each column.
- Puts the table's top-left corner where you asked. On a layout tab it goes on the sheet, in sheet units, so it plots at the size you see.
- Replies with the same rows as a table in the chat, with Copy and Excel buttons.
The same task in AutoLISP
(progn
(vl-load-com)
(setq ss (ssget "_X" '((0 . "INSERT"))) i 0 tally nil)
(if ss
(repeat (sslength ss)
(setq nm (cdr (assoc 2 (entget (ssname ss i)))) i (1+ i))
(setq tally
(if (assoc nm tally)
(subst (cons nm (1+ (cdr (assoc nm tally)))) (assoc nm tally) tally)
(cons (cons nm 1) tally)))))
(setq sp (vla-get-Block (vla-get-ActiveLayout (vla-get-ActiveDocument (vlax-get-acad-object))))
tb (vla-AddTable sp (vlax-3d-point (getpoint "\nTop-left corner: ")) (+ 2 (length tally)) 2 8.0 40.0)
r 2)
(vla-SetText tb 0 0 "BILL OF MATERIALS")
(vla-SetText tb 1 0 "Block")
(vla-SetText tb 1 1 "Qty")
(foreach p tally
(vla-SetText tb r 0 (car p))
(vla-SetText tb r 1 (itoa (cdr p)))
(setq r (1+ r)))
(length tally))Counts the blocks by name and builds a two-column table at the point you pick, on the current layout or in model space. Read attribute columns the way the routine in Make a bill of materials from blocks does.
Good to know
- The table is a snapshot, not a data link: after the drawing changes, send the sentence again for a fresh one.
- It uses the current table style, so set your office style current first if the sheet has one.
More in draw and lay out
Command: CADSSISTANT
Works in AutoCAD 2024 and newer on Windows. Free trial, no card, no API key.
Get cadssistant