;; Step 3: Loop through each object in the selection set (repeat (sslength ss) (setq ent (ssname ss i)) ; Get entity name (setq obj_name (cdr (assoc 0 (entget ent)))) ; Get object type ;; Step 4: Calculate area based on object type (cond ;; For Polylines, Circles, Ellipses, Splines ((member obj_name '("LWPOLYLINE" "CIRCLE" "ELLIPSE" "SPLINE")) (command "_.AREA" "_Object" ent) (setq area (getvar "AREA")) ) ;; For Regions ((equal obj_name "REGION") (setq area (vla-get-area (vlax-ename->vla-object ent))) ) ;; For Hatches ((equal obj_name "HATCH") (setq area (vla-get-area (vlax-ename->vla-object ent))) ) ) ;; Step 5: Add area to total (if area (setq total (+ total area)) (princ (strcat "\nWarning: Could not compute area for object " (itoa i))) ) (setq i (1+ i)) ; Increment counter (setq area nil) ; Reset area variable ) ; end repeat ;; Step 6: Display the result (princ "\n=========================================") (princ (strcat "\n>>> TOTAL AREA: " (rtos total 2 2) " square units <<<")) (princ "\n=========================================") ) ; end progn ) ; end if (princ) ; Clean exit ) For AutoCAD 2020 and newer (including LT? Note: LT does not support Lisp ) If you are using full AutoCAD (not LT), follow these steps:
Do you have a specific requirement for your total area Lisp (e.g., export to CSV, subtract voids, or add prefixes)? Write a comment below or modify the code as shown in Part 4 – the power of open-source Lisp is that it is infinitely customizable.
Manually adding each area using a calculator is not only slow but also prone to human error. This is where the magic of comes in. A well-written "Total Area Lisp" routine can instantly sum the areas of selected objects (polylines, circles, hatches, or regions) and present the result in your desired unit—square feet, meters, or even acres. total area autocad lisp
Introduction: The Pain Point of Polyline Area Calculation
: The Lisp routine above costs $0. It runs instantly, doesn't require an internet connection, and works on any version of AutoCAD from R14 to 2026. ;; Step 3: Loop through each object in
;;; TOTAREA.LSP - Calculate total area of selected objects ;;; Command: TOTAREA ;;; Supports: LWPOLYLINE, CIRCLE, ELLIPSE, SPLINE, REGION, HATCH (defun C:TOTAREA ( / ss total area obj_name obj_list i ent) (princ "\nSelect objects to calculate total area: ")
For a professional drafter, learning to load and modify a simple Lisp like TOTAREA is a rite of passage. It is the single highest ROI automation you can implement today. The humble "Total Area Lisp" transforms a manual, error-prone chore into a one-click solution. Whether you are calculating rentable square footage for a commercial lease, seeding quantities for a golf course, or material takeoffs for flooring, this tool is indispensable. Manually adding each area using a calculator is
: This works, but it requires a 12-step wizard, creates an Excel table, and is overkill for a quick sum.