0% found this document useful (0 votes)
295 views2 pages

POLYAREA

This document contains Lisp code to calculate the total area of one or more selected polylines in AutoCAD. It loops through any selected polylines, calculates the area of each using the _.area command, sums the areas, and displays the total in an alert window in square units, inches, or feet depending on the user's dimension units setting. It also handles displaying an alert if no polylines are selected.

Uploaded by

Vaibhav Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
295 views2 pages

POLYAREA

This document contains Lisp code to calculate the total area of one or more selected polylines in AutoCAD. It loops through any selected polylines, calculates the area of each using the _.area command, sums the areas, and displays the total in an alert window in square units, inches, or feet depending on the user's dimension units setting. It also handles displaying an alert if no polylines are selected.

Uploaded by

Vaibhav Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

;;POLYAREA.

LSP - (c) 1997-2001 Tee Square Graphics


;;
;; Calculates the area of one or more closed polylines and
;; displays the result in an AutoCAD Alert Window.
;;
(defun C:POLYAREA (/ a ss n du)
(setq a 0
du (getvar "dimunit")
ss (ssget '((0 . "*POLYLINE"))))
(if ss
(progn
(setq n (1- (sslength ss)))
(while (>= n 0)
(command "_.area" "_o" (ssname ss n))
(setq a (+ a (getvar "area"))
n (1- n)))
(alert
(strcat "The total area of the selected\nobject(s) is "
(if (or (= du 3)(= du 4)(= du 6))
;
;The following 2 lines translate the area to square inches and feet
;for users using US engineering or architectural units:
;
(strcat (rtos a 2 2) " square inches,\nor "
(rtos (/ a 144.0) 2 3) " square feet.")
;
;In the following line, change the word "units" to whatever units
;you are using - meters, millimeters, feet, etc.
;
(strcat (rtos a 2 3) " square units.")))))
(alert "\nNo Polylines selected!"))
(princ)
)
(alert
(strcat "POLYAREA.LSP (c) 1997-2001 Tee Square Graphics"
"\n\n Type POLYAREA to start"))
(princ)
;|

TLEN.LSP - Total LENgth of selected objects

|;

(defun C:TLEN (/ ss tl n ent itm obj l)


(setq ss (ssget)
tl 0
n (1- (sslength ss)))
(while (>= n 0)
(setq ent (entget (setq itm (ssname ss n)))
obj (cdr (assoc 0 ent))
l (cond
((= obj "LINE")
(distance (cdr (assoc 10 ent))(cdr (assoc 11 ent))))
((= obj "ARC")
(* (cdr (assoc 40 ent))
(if (minusp (setq l (- (cdr (assoc 51 ent))
(cdr (assoc 50 ent)))))
(+ pi pi l) l)))
((or (= obj "CIRCLE")(= obj "SPLINE")(= obj "POLYLINE")
(= obj "LWPOLYLINE")(= obj "ELLIPSE"))
(command "_.area" "_o" itm)
(getvar "perimeter"))
(T 0))
tl (+ tl l)
n (1- n)))
(alert (strcat "Total length of selected objects is " (rtos tl)))
(princ)
)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy