When drafting architectural floor plans in AutoCAD, creating wall boundaries from layout centerlines is usually done with the standard OFFSET command. But doing it manually means selecting a line, offsetting to one side by half the wall thickness, offsetting to the other side, and repeating that process line by line across an entire sheet.
The WAD.lsp (Wall Draw) utility streamlines this into a single selection. Enter your target wall thickness once, select all your centerlines at once—whether they are lines, polylines, arcs, or circles—and the script automatically generates parallel offset lines on both sides in your active layer.
What Makes WAD.lsp Better Than Manual Offsetting?
Batch processing: Select dozens of grid lines, wall partitions, or curved boundaries simultaneously instead of offsetting entity by entity.
Automatic math: Type in your total wall thickness (e.g.,
200or150), and the routine handles the half-width offset calculations internally.Smart thickness memory: Remembers your previously entered wall thickness so you don't have to re-enter it when drawing same-thickness partitions later in the session.
Multi-entity support: Works on straight lines, 2D polylines, arcs, and closed circles without breaking geometry.
Step-by-Step Guide
Load
WAD.lspinto AutoCAD using theAPPLOADcommand.Type
WADin the command line and press Enter.Enter your total wall thickness (default is set to 200). Press Enter to accept or type a new value.
Select all centerline objects (Lines, Polylines, Arcs, or Circles) you want to convert into wall outlines.
Press Enter to confirm. Parallel wall lines will instantly generate on both sides of every selected object.
AutoLISP Code (WAD.lsp)
Copy the code below and save it as WAD.lsp inside your AutoCAD support folder:
(defun c:WAD(/ os cl ch d1 a d2 d3 ss k ssn en obj v1 v2 *error*)
(vl-load-com)
(defun *error* (msg)
;; 에러 발생 및 취소 시 안내 메시지 없이 깔끔하게 처리하기 위해 command-s 사용
(command-s "_.undo" "_end")
(setvar "osmode" os)
(setvar "cmdecho" ch)
(princ "\nCAD Lisp [www.daolpro.com]")
(princ)
)
(setq os (getvar "osmode") cl (getvar "clayer") ch (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command-s "_.undo" "_group")
(princ "\n--- Wall Drawing Tool ---")
(setq d1 200)
(if (= dwwa nil) (setq dwwa d1))
(setq a (strcat "\nEnter wall thickness <" (rtos dwwa 2 0) ">: "))
(setq d2 (getdist a))
(if (= d2 nil) (setq d2 dwwa) (setq dwwa d2))
(setq d3 (/ d2 2.0))
(setq ss (ssget '((0 . "LINE,LWPOLYLINE,ARC,CIRCLE"))))
(if ss
(progn
(setq k 0)
(setq ssn (sslength ss))
(repeat ssn
(setq en (ssname ss k))
(setq obj (vlax-ename->vla-object en))
(setq v1 (vl-catch-all-apply 'vlax-invoke (list obj 'Offset d3)))
(setq v2 (vl-catch-all-apply 'vlax-invoke (list obj 'Offset (- d3))))
(if (not (vl-catch-all-error-p v1))
(foreach o v1
(vla-put-layer o cl)
(vla-put-color o 256)
)
)
(if (not (vl-catch-all-error-p v2))
(foreach o v2
(vla-put-layer o cl)
(vla-put-color o 256)
)
)
(setq k (+ k 1))
)
)
(princ "\nNo valid objects selected.")
)
(command-s "_.undo" "_end")
(setvar "osmode" os)
(setvar "cmdecho" ch)
(princ "\nCAD Lisp [www.daolpro.com]")
(princ)
)
Helpful Tip for Clean Floor Plans
For complex wall intersections, run the TRIM or FILLET (with Radius set to 0) command right after executing WAD to quickly clean up overlapping wall corners across your layout.

Post a Comment