Total Area Autocad Lisp

Create text that updates automatically if you stretch the polyline.

(defun c:TOTALAREA (/ ss count total i obj) (setq ss (ssget '((0 . "CIRCLE,HATCH,POLYLINE,LWPOLYLINE")))) (setq total 0.0) (if ss (progn (setq count (sslength ss)) (setq i 0) (while (< i count) (setq obj (vlax-ename->vla-object (ssname ss i))) (setq total (+ total (vla-get-area obj))) (setq i (1+ i)) ) (alert (strcat "Total Area of " (itoa count) " objects is: " (rtos total 2 2))) (princ (strcat "\nTotal Area: " (rtos total 2 2))) ) (princ "\nNo valid objects selected.") ) (princ) ) (vl-load-com) Use code with caution. How to Install and Run the Script above into Notepad.

as TotalArea.lsp . Ensure the extension is .lsp and not .txt . In AutoCAD, type APPLOAD and press Enter. Locate your TotalArea.lsp file, click Load , and then Close. Type TOTALAREA in the command line to run it. Key Features to Look For in Advanced Area LISPs total area autocad lisp

By default, AutoCAD’s MEASUREGEOM or AREA commands require you to select points or objects one by one. A custom LISP routine offers several advantages:

Using a is one of the easiest ways to transition from a "CAD Drafter" to a "CAD Power User." It moves the burden of calculation away from your brain and onto the software, where it belongs. Create text that updates automatically if you stretch

Select hundreds of polylines, circles, or hatches at once.

No more "did I already click that one?" moments. The Code: A Simple "Total Area" LISP Script How to Install and Run the Script above into Notepad

Advanced scripts can detect a "hole" inside a larger polyline and subtract that area automatically. Common Troubleshooting Tips