Wanting to shorten extension lines in AutoCAD is something nearly everyone who draws technical sheets runs into. The feet end at random heights, they run into the outline, and the sheet stops looking tidy. The Institute wrote a small file for exactly that, and its full source is printed here so you can read it before running it.
This article also covers what the other pages skip: AutoCAD already has commands for two of the jobs people go hunting for a lisp to do. For the whole dimensioning and sheet workflow, see the AutoCAD for Construction course.
Two different jobs hide behind one phrase
Two quite different requests get the same name, which is why the advice you find online so often misses.
The first: the extension line length varies because each dimension attaches to a feature at a different height. You want the feet to stop at one level. This is the job the lisp file solves.
The second: the dimension line runs across other linework, and you want a gap exactly where the two cross. AutoCAD does that one itself, with no external file.
Both of the command names that Vietnamese tutorials quote, typed on AutoCAD 2027. Neither belongs to the software:
Unknown command "CUTDIM". Press F1 for help.
Unknown command "BD". Press F1 for help.
They are function names inside a community lisp file. Without loading that file, typing them returns the line above.
Knowing which of the two jobs you have decides everything that follows. If the feet are ragged, you want to shorten extension lines in AutoCAD, and either the style or the lisp will do it. If the line is simply crossing other geometry, no length setting helps and you want a break instead.
The top three search results all teach the same three button presses: type AP, point at the file, click Load. None says what the file does inside, and none mentions that the software already handles the second job.
The Institute cut dim lisp: full source, ready to download
CD. The source stays in the article, because running unknown code on your own machine deserves care.;;; ==================================================================
;;; CD-IIC.LSP - cat chan dim cho thang hang
;;; Vien Tin hoc Xay dung (IIC) - Truong Dai hoc Xay dung Ha Noi
;;; https://iic.huce.edu.vn - Tel: 0989 427 809
;;; ------------------------------------------------------------------
;;; Lenh:
;;; CD chon cac dim, roi chon MOT diem. Chan cua moi dim se dung
;;; lai o ngang diem do. Con so do KHONG doi.
;;;
;;; Cach lam: dat rieng cho tung dim hai bien DIMFXL (chieu dai co
;;; dinh cua duong giong) va DIMFXLON (bat che do do). Chi hai muc
;;; nay bi dong vao, moi thu khac cua dim giu nguyen.
;;;
;;; Da do tren AutoCAD 2027: duong giong ve ra dai dung bang
;;; (DIMFXL + DIMEXE) x DIMSCALE, nen muon chan dung o dung cho thi
;;; phai CHIA cho DIMSCALE cua chinh dim do.
;;;
;;; 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, de Ctrl+Z mot cai la tra lai het.
;; 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))
;;; ------------------------------------------------------------------
;;; Hinh hoc cua dim
;;; ------------------------------------------------------------------
;; Huong cua duong kich thuoc, tinh bang radian.
;; dim thang (AcDbRotatedDimension) goc nam san o ma nhom 50
;; dim xien (AcDbAlignedDimension) lay theo hai goc gong 13 - 14
(defun iic-huong-dim (dl dt / ten)
(setq ten (vla-get-ObjectName (vlax-ename->vla-object dl)))
(cond
((= ten "AcDbAlignedDimension")
(angle (cdr (assoc 13 dt)) (cdr (assoc 14 dt))))
((assoc 50 dt) (cdr (assoc 50 dt)))
(T 0.0)
)
)
;; Khoang cach do theo phuong duong giong, tu duong kich thuoc toi diem p.
;; Duong giong vuong goc voi duong kich thuoc, nen day chinh la chieu
;; cao con lai cua chan dim sau khi cat.
(defun iic-cao-chan (dl p / dt g v)
(setq dt (entget dl)
g (iic-huong-dim dl dt)
v (mapcar '- p (cdr (assoc 10 dt)))
)
(abs (- (* (car v) (sin g)) (* (cadr v) (cos g))))
)
;;; ------------------------------------------------------------------
;;; Cat chan MOT dim. Tra ve T neu cat duoc.
;;; ------------------------------------------------------------------
(defun iic-cat-mot (dl p / dtg ty cao)
(setq dtg (vlax-ename->vla-object dl))
(if (vlax-property-available-p dtg "ExtLineFixedLen" T)
(progn
(setq ty (vla-get-ScaleFactor dtg))
(if (<= ty 1e-8) (setq ty 1.0))
(setq cao (/ (iic-cao-chan dl p) ty))
(if (> cao 1e-6)
(progn
(vla-put-ExtLineFixedLen dtg cao)
;; Ten thuoc tinh la "Suppress" nhung do tren may 2027 thi
;; :vlax-true moi la BAT (DIMFXLON = 1). Dat nham :vlax-false
;; la dim khong doi gi ca.
(vla-put-ExtLineFixedLenSuppress dtg :vlax-true)
(vla-Update dtg)
T
)
)
)
)
)
;;; ------------------------------------------------------------------
;;; Lenh CD
;;; ------------------------------------------------------------------
(defun C:CD (/ *error* cu-error bo p i n bo-qua)
(setq cu-error *error*)
(defun *error* (m)
(if (and m (/= m "Function cancelled") (/= m "quit / exit abort"))
(princ (strcat "\nLỗi: " m))
)
(iic-dong-undo)
(setq *error* cu-error)
(princ)
)
(iic-bang-ten)
(princ "\n")
(setq bo (ssget '((0 . "DIMENSION"))))
(cond
((null bo)
(princ "\nKhông chọn được dim nào."))
((null (setq p (getpoint "\nĐiểm cắt chân dim: ")))
(princ "\nĐã huỷ."))
(T
(setq p (trans p 1 0) i 0 n 0 bo-qua 0)
(iic-mo-undo)
(while (< i (sslength bo))
(if (iic-cat-mot (ssname bo i) p)
(setq n (1+ n))
(setq bo-qua (1+ bo-qua))
)
(setq i (1+ i))
)
(iic-dong-undo)
(princ (strcat "\nĐã cắt chân của " (itoa n) " dim."))
(if (> bo-qua 0)
(princ (strcat " Bỏ qua " (itoa bo-qua) " dim không có chân để cắt."))
)
)
)
(setq *error* cu-error)
(princ)
)
(princ "\nCD-IIC.LSP: go CD de cat chan dim.")
(princ)
The idea is small. Every dimension carries its own setting for a fixed extension line length. The command measures the distance from the dimension line to the point you pick, then writes that figure into that setting for each dimension. The extension line shortens to exactly that distance, and nobody touches the measured value.
Using the command, step by step
Step 1 — Load the file into AutoCAD
- Type
APPLOADand press Enter. TheLoad/Unload Applicationsdialog opens. - Leave
Files of typeonAutoCAD Apps, since.lspbelongs to that group. - Browse to the folder you downloaded the file into, select
CD-IIC.lsp, and clickLoad. - Click
Close. The file is now loaded for this session.
To avoid loading it again on every start, stay in that dialog, look at the Startup Suite panel in the lower right, click Contents... and add the file to the list. AutoCAD then loads it at startup.
Step 2 — Select the dimensions to change
Type CD and press Enter. Three credit lines from the Institute appear, then the prompt:
Select objects:
Select however you prefer: click each one, drag a window, drag a crossing window. Catching other linework does no harm, because the command only accepts dimension objects. Press Enter when done.
One thing to watch when dragging left to right: AutoCAD only takes objects that sit entirely inside the box. The extension lines reach all the way to the feature they attach to, so the box has to cover that too. Otherwise you get 0 found and assume the command is broken.
Step 3 — Pick the level where the feet should stop
Điểm cắt chân dim:
Click a point at the height you want every foot to stop at. You do not have to hit any object; the command only takes the distance from the dimension line to that point. AutoCAD then reports:
Đã cắt chân của 3 dim.
If it goes wrong, type U
One U puts everything back. The whole pass is wrapped as a single undo step, so you do not have to press it repeatedly. The number of dimensions carrying the override runs none before the pass, three after it, and none again after U.
Check one more thing after running any file of this kind: select a dimension, open the Properties palette and read its measured value again. It must be exactly what it was. If it changed, the file is dragging the origin points rather than shortening the extension lines, and you should undo before saving.
The point to notice is in those three figures. Before and after, the measurement is still 1800, 1200 and 1200. The command only moves where the extension line is drawn. That is the difference between shortening extension lines and dragging the origin, which quietly corrupts a whole quantity schedule.
Three ways a downloaded file gets this wrong
The first is scale. The fixed length setting maps to the DIMFXL variable, and the number in it is multiplied by the dimension scale, DIMSCALE. On a drawing set to 100, writing 150 straight in becomes 15,000 units, longer than the extension line itself, so the command appears to do nothing at all. The mistake is easy to make and hard to see: it shows up only when the before and after screenshots are compared pixel by pixel.
The second is worse: overrides. Every per-dimension setting lives in one shared block of data. Writing over the whole block wipes the text height, colour and scale set on that dimension. Our first attempt did that, and the figures and arrowheads vanished from the drawing. The published file no longer edits that block by hand: it sets the ExtLineFixedLen and ExtLineFixedLenSuppress properties on the dimension object itself, so AutoCAD adds exactly the two entries and leaves every other one alone. Read back before and after a run on a dimension carrying its own text height of 199 and a red text colour, all six existing entries survive, two new ones appear, and the dimension still measures 2000.
The third trap is the property name itself. ExtLineFixedLenSuppress reads like "switch the fixed length off", but on the 2027 release it is the other way round: setting it to :vlax-true switches the fixed length on and writes DIMFXLON as 1, while :vlax-false writes 0 and switches it off. Get it backwards and nothing warns you: the command finishes, reading the property back gives the expected 300, not one of the three dimensions on screen changes, and no error is reported. Only reading the raw block showed DIMFXLON sitting at 0.
One more measured figure, because it explains why a setting of 300 draws a 370-long line: the extension line comes out at exactly (DIMFXL + DIMEXE) × DIMSCALE. The part above the dimension line is DIMEXE; only the part hanging below it is DIMFXL. That is why the command divides the distance you pick by the DIMSCALE of that particular dimension before writing it.
The fourth is security. If AutoCAD shows a Security - Unsigned Executable File box and then ; error: File load canceled:, the file is not broken. That is the SECURELOAD variable refusing to load code from a folder you have not declared as trusted. The fix and the full mechanism are in our article on calculating area in AutoCAD.
Dimension break: cutting the line where it crosses the drawing
This is the second job, and the software does it. The DIMBREAK page at Autodesk describes the command in one sentence: "Breaks or restores dimension and extension lines where they cross other objects".
Type DIMBREAK, and the prompt on the 2027 release, copied from the screen, reads:
Select dimension to add/remove break or [Multiple]:
Pick the dimension, then pick the object crossing it. The gap that appears is associative: move the geometry or the dimension and the gap follows, delete the geometry and the gap disappears. No lisp file can follow the drawing like that.
Two further details of DIMBREAK in AutoCAD are worth knowing, both listed on the Autodesk page above. The Multiple option breaks several dimensions in one pass, and the Auto option keeps the gap updated whenever the dimension or the crossing object is edited. No lisp file offers either, because only the program itself can keep a gap tied to the geometry.
Its sibling is DIMSPACE, which spaces parallel dimension lines evenly. Its first prompt is Select base dimension:. That is precisely the job the BD command does in the community files.
Fixed length extension lines, no lisp needed
If every dimension in the sheet should have the same foot length, you need no command at all. Open the dimension style dialog, go to the Extension lines tab, tick Fixed length extension lines and put a figure in the Length box. From then on every dimension carrying that style has exactly that length.
If you need to shorten extension lines in AutoCAD across a whole set of sheets, do it in the style rather than one drawing at a time. Transfer the style into the other files, or put it in the template you start from, and the question stops coming back.
Which route to take depends on the job. One convention across a whole set is better handled in the style, because new dimensions then come out right on their own. A handful of places, or several different levels, is much faster with the lisp.
The lisp wins in one respect only: it sets the value for the group you select, at a level you point at with the mouse, instead of changing the style for everything. The dialog route, and the trap that makes that box look broken, are in our article on dimensions in AutoCAD.
Three things often repeated that are not true
| Often repeated | What the 2027 release does |
|---|---|
CUTDIM is an AutoCAD command | Typing it returns Unknown command "CUTDIM". It is a function name inside a lisp file |
| Shortening the feet corrupts the measurement | Measured before and after: still 1800, 1200, 1200. Only the drawn geometry moved |
| Breaking a dimension where it crosses needs a lisp | DIMBREAK does it, and the gap even follows the geometry when you move it |
Frequently asked questions
Does a cut dim lisp change the dimension value?
Not if the file is written properly. The Institute file only writes into the fixed extension line length setting of each dimension. All three values read back unchanged before and after running it.
The file will not load at all. What now?
Look for a Security - Unsigned Executable File box. That is AutoCAD refusing unknown code, not a broken file. Adding the folder holding the file to the trusted list lets it load.
The command ran but nothing changed. Why?
Almost certainly the drawing uses a dimension scale other than 1 and the lisp forgot to divide by it. Try again with the file from this article, which reads each dimension's own scale before writing.
Do I have to do this on every drawing?
No. If a whole set follows one convention, set it once in the dimension style. The lisp suits the case where only a group of dimensions needs shortening.
How do CD and BD differ?
CD shortens the extension lines, BD lines the dimension lines up with each other. Both are names inside community lisp files. AutoCAD has DIMSPACE for the job BD does.
Does this file work on AutoCAD LT?
This article was measured on the full AutoCAD 2027 release. Lighter editions have their own policy on running code, so test on the exact edition you use before relying on it.