because i am in a good mood today, hope it works
just copy the atteched file in one of your search paths of acad
(load "sumarea.lsp")
and than start it with
sumarea
If you want to change the displayed accuracy of the area, just change
the (setq GEN 2) line to the desired digits of your area
(defun c:sumarea (/ GEN SS GIDX GSUMAREA GELEMENT CMDOLD)
(setq CMDOLD (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(prompt "\n Calc the sum of all closed Polylines and lw polylines")
(setq GEN 2)
(setq GFILTER '((-4 . "
"LWPOLYLINE") (-4 . "OR>") (70 . 1) (-4 . "AND>")))
(setq SS (ssget "_X" GFILTER))
(if SS
(progn
(prompt (strcat "\n Found " (itoa (sslength SS)) " closed
Polylines, LWPolylines."))
(setq GIDX 0)
(setq GSUMAREA 0)
(repeat (sslength SS)
(setq GELEMENT (ssname SS GIDX))
(setq GIDX (1+ GIDX))
(command "_area" "_o" GELEMENT)
(prompt (strcat "\n Area (" (itoa GIDX) "):" (rtos (getvar
"AREA") 2 GEN)))
(setq GSUMAREA (+ GSUMAREA (getvar "AREA")))
)
(prompt "\n ----------------------")
(prompt (strcat "\n Sum-Area:" (rtos GSUMAREA 2 GEN)))
)
(prompt "\n No closed Polylines or LWPolylines found.")
)
(setvar "CMDECHO" CMDOLD)
(princ)
)
lsaapedd wrote:
> As stated, I have a LOT of polylines in a drawing that I need the sum of the areas for. I don't care how it is displayed, I just need the number so I can put it elsewhere and use it.
>
> I know nothing at all about programming in Acad. If someone has a lisp or other program, I would be grateful for it.
>
> TIA,
>
> Jerry