Detailing thermal or acoustic batting insulation in architectural wall sections is notoriously finicky in AutoCAD. Standard custom insulation linetypes rarely scale correctly—they often leave awkward empty gaps at wall intersections or distort when wall cavity widths change. Copying and stretching individual polyline arc loops manually takes up way too much drafting time during detail preparation.
The BAT.lsp (Batting Insulation Generator) routine replaces those finicky linetypes with a clean, dynamic polyline pattern. By picking two diagonal points across any wall cavity, the script automatically calculates the cavity thickness and length, then draws perfectly proportioned insulation loops seamlessly from end to end.
Why Standard Insulation Linetypes Cause Problems
Distorted Endpoints: Standard AutoCAD insulation linetypes depend on global linetype scaling (
LTSCALE), which frequently cuts off mid-loop at wall corners.Manual Re-scaling: Changing stud cavity widths (e.g., switching from 100mm to 150mm framing) forces you to recalculate linetype scales manually.
Single Continuous Polyline Output:
BAT.lspgenerates the entire insulation sequence as a single polyline entity, making it easy to select, mirror, or move without leaving stray arcs behind.
How to Use BAT.lsp
Load
BAT.lspinto your AutoCAD drawing session using theAPPLOADcommand.Type
BATin the command prompt and hit Enter.Click the first diagonal corner point of your target wall cavity or frame space.
Click the opposite diagonal corner point.
The script temporarily adjusts snap settings, calculates loop density automatically, and draws perfectly fitted batting insulation instantly.
AutoLISP Code (BAT.lsp)
Copy the code below and save it as BAT.lsp inside your AutoCAD support folder:
(defun c:BAT ( / os bl cm pt1 pt3 x1 y1 x3 y3 minx maxx miny maxy dx dy thk len pt_start pt_end sc_x sc_y n seg_len b1 b2 b3 b4 p1 p2 p3 p4 p5 p6 p7 p8 ag1 ag2 old_error)
(setq old_error *error*)
(defun *error* (msg)
(if cm (setvar "cmdecho" cm))
(if os (setvar "osmode" os))
(if bl (setvar "blipmode" bl))
(if command-s
(command-s "_.undo" "_end")
(command "_.undo" "_end")
)
(setq *error* old_error)
(princ "\nCAD Lisp [www.daolpro.com]")
(princ)
)
(setq os (getvar "osmode") bl (getvar "blipmode") cm (getvar "cmdecho"))
(setvar "cmdecho" 0)
(if command-s
(command-s "_.undo" "_begin")
(command "_.undo" "_begin")
)
(setvar "blipmode" 0)
(setvar "osmode" 1)
(setq pt1 (getpoint "\nSpecify first diagonal corner point: "))
(if pt1
(progn
(setq pt3 (getpoint pt1 "\nSpecify second diagonal corner point: "))
(if pt3
(progn
(setvar "osmode" 0)
(setq x1 (car pt1) y1 (cadr pt1) x3 (car pt3) y3 (cadr pt3))
(setq minx (min x1 x3) maxx (max x1 x3) miny (min y1 y3) maxy (max y1 y3))
(setq dx (- maxx minx) dy (- maxy miny))
(if (> dx dy)
(setq thk dy len dx pt_start (list minx miny 0.0) pt_end (list maxx miny 0.0))
(setq thk dx len dy pt_start (list minx maxy 0.0) pt_end (list minx miny 0.0))
)
(setq sc_y (/ thk 50.0))
(setq n (fix (+ 0.5 (/ len (* sc_y 25.0)))))
(if (< n 1) (setq n 1))
(setq seg_len (/ len n))
(setq sc_x (/ seg_len 25.0))
(setq ag1 (angle pt_start pt_end) ag2 (+ ag1 (/ pi 2.0)))
(command "_.pline" pt_start)
(repeat n
(setq b1 (polar pt_start ag2 (* sc_y 4.32))
b2 (polar pt_start ag2 (* sc_y 13.55))
b3 (polar pt_start ag2 (* sc_y 36.45))
b4 (polar pt_start ag2 (* sc_y 50.00)))
(setq p1 (polar b1 ag1 (* sc_x 8.23))
p2 (polar b2 ag1 (* sc_x 9.35))
p3 (polar b3 ag1 (* sc_x 3.15))
p4 (polar b4 ag1 (* sc_x 12.50))
p5 (polar b3 ag1 (* sc_x 21.85))
p6 (polar b2 ag1 (* sc_x 15.65))
p7 (polar b1 ag1 (* sc_x 16.77))
p8 (polar pt_start ag1 (* sc_x 25.00)))
(command "A" "S" p1 p2 "L" p3 "A" "S" p4 p5 "L" p6 "A" "S" p7 p8 "L")
(setq pt_start p8)
)
(command "")
)
)
)
)
(if command-s
(command-s "_.undo" "_end")
(command "_.undo" "_end")
)
(if bl (setvar "blipmode" bl))
(if os (setvar "osmode" os))
(if cm (setvar "cmdecho" cm))
(setq *error* old_error)
(princ "\nCAD Lisp [www.daolpro.com]")
(princ)
)
Architectural Detailing Tip
The script automatically determines whether your insulation cavity runs horizontally or vertically based on your two diagonal selection points. You can use it seamlessly for both wall partitions and roof/ceiling insulation details.

Post a Comment