TzV5laRyzIFExM7bghzH2YzXZgfj4xc8paleSd48
Bookmark

Total | Area Autocad Lisp

;; Calculate area based on object type (cond ;; For objects with direct Area property ((member obj-name '("CIRCLE" "ELLIPSE" "HATCH" "LWPOLYLINE" "POLYLINE" "REGION" "SPLINE")) (command "._AREA" "_O" obj) (setq area (getvar "AREA")) (if (> area 0) (progn (setq total-area (+ total-area area)) (setq obj-list (cons (list obj-name area) obj-list)) ) ) )

Some advanced routines can even write the total to a text file, insert a multiline text object with the sum, or export a schedule. total area autocad lisp

It turns a tedious, manual accounting task into an automated process. The ability to select 100 rooms and instantly know the total square footage allows designers to make faster decisions and produce accurate BQs (Bills of Quantities) without hesitation. ;; Calculate area based on object type (cond

(defun C:AT ( / ss area_list total sf) (setq sf (getreal "\nConversion factor (1 drawing unit = ? feet): ")) (if (= sf nil) (setq sf 1.0)) (setq ss (ssget '((0 . "LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE,REGION")))) (if ss (progn (setq total 0.0) (repeat (setq i (sslength ss)) (setq ent (ssname ss (setq i (1- i)))) (setq area (vlax-curve-getArea ent)) (setq total (+ total area)) ) (setq total_sqft (* total sf sf)) (setq total_acres (/ total_sqft 43560.0)) (alert (strcat "Total Area: " (rtos total_acres 2 2) " Acres")) ;; Optional: Insert text (command "_.MTEXT" (getpoint "\nPick text insertion point: ") "J" "TL" "W" "0" (strcat "TOTAL AREA = " (rtos total_acres 2 2) " ACRES") "") ) (princ "\nNo objects selected.") ) (princ) ) (defun C:AT ( / ss area_list total sf)

Posting Komentar

-->