AutoCAD – Drawings

Fast dimensioning in AutoCAD: a whole chain in a single pass

Fast dimensioning in AutoCAD in one pass, in the order you pick, with an overall line underneath. A free lisp, plus four built-in tools most people miss.

  • TS. Đỗ Quốc Hoàng
  • 14 min read
The four fast dimensioning commands already built into AutoCAD, with each one's real prompt Photo: Diagram by the Institute of Information Technology in Civil Engineering

Dimensioning eats more time than anything else when finishing a sheet, so fast dimensioning in AutoCAD is the first thing drafters go looking for a lisp to solve. Before downloading one, though, it is worth knowing that AutoCAD already has four ways to dimension in bulk, and most users know only one.

This article covers both sides. For the whole dimensioning and documentation workflow, see the AutoCAD for Construction course.

Qdim and the other three built-in commands

Each command typed on AutoCAD 2027, with the prompts copied verbatim.

QDIM is the one that actually means fast dimensioning. Autodesk's QDIM page says what it suits: "This command is particularly useful for creating a series of baseline or continued dimensions, or for dimensioning a series of circles and arcs". Select a whole group of geometry and it dimensions the lot:

Select geometry to dimension:

Miss the selection and it says so plainly: No objects found to dimension.

The DIM command on modern releases is broader still. Its prompt shows how much it gathers into one place.

Select objects or specify first extension line origin or [Angular/Baseline/Continue/Ordinate/aliGn/Distribute/Layer/Undo]:

The two classics are still there. DIMCONTINUE asks Select continued dimension: and continues along the same dimension line. DIMBASELINE asks Select base dimension: and works from one shared origin, each dimension on its own level.

The spacing between those levels is not arbitrary: it is the DIMDLI variable multiplied by the dimension scale, DIMSCALE. Set it once and the whole drawing follows.

Inside QDIM there are nine further options few people ever open: Continuous, Staggered, Baseline, Ordinate, Radius, Diameter, Datum Point, Edit and Settings. Staggered steps the dimensions in and out, which suits a plan with several wall layers. Edit lets you add or drop points while the command is still running, instead of starting over.

Knowing all four changes how fast dimensioning in AutoCAD actually feels. Most drafters place every dimension one at a time with the plain linear command, then wonder why the sheet took all afternoon. Ten minutes spent learning which of the four suits which situation pays for itself on the first floor plan.

A lisp for the dimension chain

Those four are powerful but miss one thing Vietnamese documentation work needs: dimensioning a chain in exactly the order you pick, then adding an overall dimension below it. QDIM is quicker but the order is AutoCAD's, and it adds no overall level.

Download DNH-IIC.lsp8 KB, two commands.
CommandWhat it does
DNHpick a chain of points, set one dimension line level, and it dimensions each span in turn
DNHPtakes every vertex of a polyline instead, so there is nothing to click twice

Both ask whether to add an overall dimension. That level is pushed away from the chain at a right angle, far enough that the two lines of text never overlap.

Why does the order matter? Because a construction sheet is read as a sequence. A run of piers and openings has to appear in the order a worker walks the wall, not the order AutoCAD happened to find the linework. Add a few stray lines in between and the machine's order becomes unpredictable, at which point fixing each dimension takes longer than placing them by hand.

The second reason is the overall level. Vietnamese documentation practice nearly always wants a total below the detail chain so a reader can check the arithmetic at a glance. No built-in command adds that line for you, so it is a separate step either way. The file here folds it into one question.

;;; ==================================================================
;;;  DNH-IIC.LSP  -  ghi ca chuoi kich thuoc trong mot luot
;;;  Vien Tin hoc Xay dung (IIC) - Truong Dai hoc Xay dung Ha Noi
;;;  https://iic.huce.edu.vn  -  Tel: 0989 427 809
;;; ------------------------------------------------------------------
;;;  Lenh:
;;;    DNH    bam lan luot cac moc theo dung thu tu muon doc, dat mot
;;;           muc duong kich thuoc, may ghi lien tiep tung doan.
;;;    DNHP   lay san moi dinh cua mot duong da tuyen, khoi bam lai.
;;;
;;;  Ca hai deu hoi co ghi them mot lop kich thuoc TONG hay khong.
;;;
;;;  Hai dieu da do tren AutoCAD 2027 va lam theo:
;;;    - lop tong bi day ra theo phuong VUONG GOC voi chuoi, chu khong
;;;      theo huong tu diem dau toi diem vua bam; chuoi nam xien thi
;;;      cach kia cho lop tong di cheo.
;;;    - khoang cach giua hai lop lay so LON HON giua DIMDLI x DIMSCALE
;;;      va 2,2 lan chieu cao chu. Tren ban ve mau cua Vien DIMDLI = 8
;;;      con DIMTXT = 180, lay DIMDLI khong thi hai dong chu chong nhau.
;;;
;;;  Nap tep: go APPLOAD, chon tep nay, bam Load.
;;;  Tep luu bang ma UTF-8. Sua bang Notepad thi nho luu lai dung UTF-8.
;;; ==================================================================

(vl-load-com)

;;; ------------------------------------------------------------------
;;;  Phan chung
;;; ------------------------------------------------------------------

(defun iic-bang-ten ()
  (princ "\nLisp được lập trình bởi RDSIC - Viện Tin học Xây dựng")
  (princ "\nwebsite: https://iic.huce.edu.vn")
  (princ "\nTel: 0989 427 809")
  (princ)
)

;; Gop ca lenh vao MOT buoc undo. Dung danh dau cua ActiveX chu khong
;; dung (command "_.UNDO" ...): ban 2027 CAM goi (command) tu trong ham
;; bay loi *error*, con danh dau nay thi goi duoc o moi noi.
(defun iic-tai-lieu () (vla-get-ActiveDocument (vlax-get-acad-object)))
(defun iic-mo-undo () (vla-StartUndoMark (iic-tai-lieu)) (princ))
(defun iic-dong-undo () (vla-EndUndoMark (iic-tai-lieu)) (princ))

;; Khoi chua doi tuong moi: dang o to giay thi la paper space.
(defun iic-noi-ve (/ tl)
  (setq tl (vla-get-ActiveDocument (vlax-get-acad-object)))
  (if (and (= 0 (getvar "tilemode")) (= 1 (getvar "cvport")))
    (vla-get-PaperSpace tl)
    (vla-get-ModelSpace tl)
  )
)

;;; ------------------------------------------------------------------
;;;  Hinh hoc
;;; ------------------------------------------------------------------

;; Vec to don vi vuong goc voi huong g.
(defun iic-phap-tuyen (g) (list (- (sin g)) (cos g) 0.0))

;; Tich vo huong cua hai vec to phang.
(defun iic-nhan-vo-huong (a b) (+ (* (car a) (car b)) (* (cadr a) (cadr b))))

;; Diem p day di mot doan d theo vec to v.
(defun iic-doi-cho (p v d)
  (list (+ (car p) (* d (car v))) (+ (cadr p) (* d (cadr v))) (caddr p))
)

;; Khoang cach giua lop chuoi va lop tong.
(defun iic-cach-lop (/ a b ty)
  (setq ty (getvar "dimscale"))
  (if (<= ty 1e-8) (setq ty 1.0))
  (setq a (* (getvar "dimdli") ty)
        b (* 2.2 (getvar "dimtxt") ty))
  (max a b)
)

;;; ------------------------------------------------------------------
;;;  Ve mot kich thuoc thang, quay theo huong cua chuoi
;;; ------------------------------------------------------------------

(defun iic-ghi-doan (kg p1 p2 pd g)
  (if (> (distance p1 p2) 1e-8)
    (progn
      (vla-AddDimRotated kg (vlax-3d-point p1) (vlax-3d-point p2)
                            (vlax-3d-point pd) g)
      T
    )
  )
)

;;; ------------------------------------------------------------------
;;;  Ghi ca chuoi. Tra ve so doan ghi duoc.
;;; ------------------------------------------------------------------

(defun iic-ghi-chuoi (ds pd co-tong / kg g n con pd2 huong lech)
  (setq kg (iic-noi-ve)
        g  (angle (car ds) (last ds))
        n  0
        con ds)
  (while (cdr con)
    (if (iic-ghi-doan kg (car con) (cadr con) pd g) (setq n (1+ n)))
    (setq con (cdr con))
  )
  ;; lop tong: day tiep ra xa chuoi, theo dung phia ma nguoi dung da bam
  (if (and (> n 1) co-tong)
    (progn
      (setq huong (iic-phap-tuyen g)
            lech  (iic-nhan-vo-huong (mapcar (function -) pd (car ds)) huong)
            pd2   (iic-doi-cho pd huong (* (if (minusp lech) -1.0 1.0) (iic-cach-lop))))
      (iic-ghi-doan kg (car ds) (last ds) pd2 g)
    )
  )
  n
)

;;; ------------------------------------------------------------------
;;;  Hoi cho het phan chung cua hai lenh
;;; ------------------------------------------------------------------

(defun iic-hoi-muc-va-tong (/ pd tl)
  (if (setq pd (getpoint "\nVị trí đường kích thước: "))
    (progn
      (initget "Co Khong")
      (setq tl (getkword "\nGhi thêm kích thước tổng? [Co/Khong] <Co>: "))
      (list (trans pd 1 0) (/= tl "Khong"))
    )
  )
)

;;; ------------------------------------------------------------------
;;;  Lenh DNH
;;; ------------------------------------------------------------------

(defun c:DNH (/ *error* cu-error ds p pd n)

  (setq cu-error *error*)
  (defun *error* (m)
    (if (and m (/= m "Function cancelled") (/= m "quit / exit abort"))
      (princ (strcat "\nIIC lỗi: " m)))
    (iic-dong-undo)
    (setq *error* cu-error)
    (princ)
  )

  (iic-bang-ten)
  (setq ds (list))
  (while (setq p (getpoint "\nChọn điểm theo thứ tự (Enter để dừng): "))
    (setq ds (cons (trans p 1 0) ds))
  )
  (setq ds (reverse ds))

  (if (< (length ds) 2)
    (princ "\nCần ít nhất hai điểm.")
    (if (setq pd (iic-hoi-muc-va-tong))
      (progn
        (iic-mo-undo)
        (setq n (iic-ghi-chuoi ds (car pd) (cadr pd)))
        (iic-dong-undo)
        (princ (strcat "\nĐã ghi " (itoa n) " đoạn."))
      )
    )
  )

  (setq *error* cu-error)
  (princ)
)

;;; ------------------------------------------------------------------
;;;  Lenh DNHP - lay dinh tu duong da tuyen
;;; ------------------------------------------------------------------

;; Moi dinh cua duong cong nam o tham so nguyen. Lay theo vlax-curve
;; thi duoc luon toa do WCS, dung cho ca LWPOLYLINE lan POLYLINE cu.
(defun iic-dinh-cua (e / het i ds)
  (setq het (vl-catch-all-apply (function vlax-curve-getEndParam) (list e)))
  (if (or (vl-catch-all-error-p het) (null het))
    nil
    (progn
      (setq i 0 ds (list))
      (while (<= i het)
        (setq ds (cons (vlax-curve-getPointAtParam e i) ds) i (1+ i))
      )
      (setq ds (reverse ds))
      ;; duong khep kin tra ve dinh cuoi trung dinh dau: bo bot mot cai,
      ;; neu khong thi huong cua chuoi tinh ra bang khong.
      (if (and (cdr ds) (< (distance (car ds) (last ds)) 1e-8))
        (setq ds (reverse (cdr (reverse ds))))
      )
      ds
    )
  )
)

(defun c:DNHP (/ *error* cu-error ch ds pd n)

  (setq cu-error *error*)
  (defun *error* (m)
    (if (and m (/= m "Function cancelled") (/= m "quit / exit abort"))
      (princ (strcat "\nIIC lỗi: " m)))
    (iic-dong-undo)
    (setq *error* cu-error)
    (princ)
  )

  (iic-bang-ten)
  (setq ch (entsel "\nChọn đường đa tuyến: "))

  (if (null ch)
    (princ "\nKhông chọn được đường nào.")
    (progn
      (setq ds (iic-dinh-cua (car ch)))
      (if (or (null ds) (< (length ds) 2))
        (princ "\nĐường này không đủ hai đỉnh.")
        (if (setq pd (iic-hoi-muc-va-tong))
          (progn
            (iic-mo-undo)
            (setq n (iic-ghi-chuoi ds (car pd) (cadr pd)))
            (iic-dong-undo)
            (princ (strcat "\nĐã ghi " (itoa n) " đoạn từ "
                           (itoa (length ds)) " đỉnh."))
          )
        )
      )
    )
  )

  (setq *error* cu-error)
  (princ)
)

(princ "\nDNH-IIC.LSP: go DNH de ghi chuoi kich thuoc, DNHP de lay dinh duong da tuyen.")
(princ)
A wall 9300 long with three 1500 openings and four 1200 piers. Seven spans plus an overall level, all placed by the DNH command in a single pass. The wall sits on the wall layer, the openings on the opening layer, and the dimensions on the DIM layer Photo: AutoCAD 2027

Using it, step by step

Step 1 — Load the file

Type APPLOAD, point at the file, click Load then Close. To avoid loading it again on every start, add it to the Startup Suite in that same dialog.

Step 2 — Pick the chain

Type DNH and press Enter. The prompt reads:

Chọn điểm theo thứ tự (Enter để dừng):

Click each station in the order it should read, usually left to right. Turn on endpoint snap to be safe. Press Enter when done.

Step 3 — Set the dimension line level

Vị trí đường kích thước:

Click a point at the level you want the whole chain to sit on. You do not have to hit an object.

Step 4 — Choose whether to add the total

Ghi thêm kích thước tổng? [Co/Khong] <Co>:

Enter means yes. AutoCAD reports Đã ghi 7 đoạn. and the overall level lands below the chain.

The gap between the two levels is where the correction has to be made. The textbook answer is DIMDLI times DIMSCALE, but in the Institute's sample drawing DIMDLI is 8 while DIMTXT is 180, so the overall level sat 8 units from the chain and the two lines of text overlapped. The file you download takes the larger of DIMDLI × DIMSCALE and 2.2 times the text height. It also offsets the overall level perpendicular to the chain, rather than along the direction from the first point to the point you clicked. With a slanted chain the old way sent it off at an angle.

When a dimension has lines but no number

Three reasons a dimension draws every line but loses its figure, in the order worth checking Photo: Diagram by the Institute of Information Technology in Civil Engineering

This cost us half a day while building the example for this very article, so it is worth telling in full.

The most common cause is the dimension style's text style. The sample drawing carries five dimension styles, and all five point at one text style. Every dimension came out with full extension lines, dimension line and ticks, and not a single figure.

The test that found it: write four lines of text in four different styles and look. Three rendered normally; one drew nothing at all — even though its font file was sitting in the AutoCAD 2027 Fonts folder, and even though another style using that same font worked fine. Pointing the dimension style at a working text style fixed it.

The second cause is a span too narrow for the text. Text 250 units tall will not fit between extension lines 600 apart. AutoCAD pushes it outside, where it collides with the level below. That is exactly why the example in this article keeps its shortest span at 1200.

The third is multiplying twice. DIMTXT is multiplied by DIMSCALE. Set DIMTXT to 250 and leave the scale at 100 and the text comes out 25,000 units tall, bigger than the wall. We walked into that one too.

One more habit worth building: dimension while the geometry is still simple. A wall with its openings cut but no hatching, no furniture and no notes is far easier to pick points on than the finished sheet, and the dimensions then move with the drawing as it fills up. Leaving dimensioning to the end is what makes people reach for a lisp in the first place.

Set the layer and the style before you start

Two things to settle before clicking the first point, both of which save a lot of correction later.

The first is the layer. Dimensions belong on a layer of their own, usually called DIM. Whatever layer is current when you call the command is the layer they land on, so dimensioning while still on the beam layer buries the whole chain among the beams. After that you cannot switch them off or change their plot colour separately.

The second is the dimension style. Do not rely on whatever came with someone else's drawing, because you do not know which scale it was built for. Pick a standard of your own and check three figures: text height, arrow size, and the spacing between levels. All three are multiplied by DIMSCALE, so one variable moves the whole drawing to the right plot scale.

In the example above the wall sits on the wall layer, the openings on the opening layer, and the dimensions on a red DIM layer. The three groups are distinguishable at a glance, which is how a set that leaves the office should look.

Three things often repeated that are not true

Often repeatedWhat the 2027 release does
Bulk dimensioning needs a lispQDIM does it, and the DIM command gathers Baseline and Continue too
A dimension with no figure means a corrupt drawingUsually the style's text style, or a span too narrow for the text
Level spacing has to be set by eyeIt is DIMDLI multiplied by DIMSCALE, set once for the whole drawing

Frequently asked questions

Does a lisp replace QDIM?

It complements it. QDIM is quicker when you simply want a group of geometry dimensioned. A lisp suits the case where reading order matters, or where an overall level is required.

What is the continuous dimension command?

DIMCONTINUE, whose first prompt is Select continued dimension:. On modern releases you can also reach it from the Continue option inside DIM.

The levels came out too far apart, or too close.

Change DIMDLI. The real distance is DIMDLI multiplied by DIMSCALE, so count both.

I picked the wrong point in the chain.

Type U once. The whole pass is wrapped as a single undo step.

Why did the text jump outside the extension lines?

Because the span is narrower than the text. Widen the span, reduce DIMTXT, or allow text outside with the DIMTIX variable.

Which layer should dimensions go on?

A layer of their own, usually DIM, so they can be switched off or replotted as a group. Layer management is covered in our article on layers in AutoCAD, and text height and extension lines in our article on dimensions in AutoCAD.

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