CADLISPMASTER
Stop wasting time on repetitive AutoCAD tasks. CAD LISP Master provides free, efficient AutoLISP codes and clear tutorials designed to automate your workflow and speed up your drafting.

Draw Walls Instantly from Lines

Stop manual offsets! Use this AutoCAD LISP to create wall thickness from lines and arcs in seconds.

 [AutoCAD LISP] Draw Walls Instantly from Lines (WAD.lsp)

Draw Walls Instantly from Lines
If you are still offsetting every single centerline manually to draw walls in AutoCAD, you are losing valuable design time. Doing this one by one for complex floor plans is tedious, repetitive, and prone to simple calculation errors.

The WAD (Wall Draw) LISP solves this problem instantly. With just a few clicks, it takes your centerlines and automatically draws parallel wall lines on both sides according to your specified thickness.

Why You Should Use the 'WAD' LISP

  • Massive Time Savings: No more running the OFFSET command over and over. It processes multiple selected lines, polylines, arcs, and circles all at once.
  • Automatic Center-Line Calculation: Simply enter the total wall thickness (e.g., 200). The LISP automatically divides it by 2 to offset both sides perfectly.

How It Works (Step-by-Step Guide)

  1. Load the LISP: Load the WAD.lsp file into AutoCAD using the APPLOAD command.
  2. Run the Command: Type WAD in the command line and press Enter.
  3. Set Wall Thickness: Enter your desired total wall thickness. (The default value is set to 200, and it remembers your last input for the next use).
  4. Select Objects: Select the centerlines (Lines, Polylines, Arcs, or Circles) that you want to turn into walls, then press Enter.
  5. Complete: The LISP instantly generates the wall lines on both sides, matching your current layer.

Wrapping Up

Drawing walls is a foundational yet repetitive task in architectural drafting. By automating this process with the WAD LISP, you can focus more on the actual design rather than fighting with the OFFSET command. Give it a try and streamline your AutoCAD workflow today!

The LISP Code

(defun c:WAD(/ os cl ch d1 a d2 d3 ss k ssn en obj v1 v2)
  (vl-load-com)
  (defun *error* (msg)
    (setvar "osmode" os)
    (setvar "cmdecho" ch)
    (command-s "_.undo" "_end")
    (if (not (member msg '("Function cancelled" "quit / exit abort" "기능을 취소함")))
      (princ (strcat "\nError: " msg))
    )
    (princ)
  )
  (setq os (getvar "osmode") cl (getvar "clayer") ch (getvar "cmdecho"))
  (setvar "osmode" 0)
  (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 "\nWall drawing completed successfully.")
  (princ)
)

Post a Comment