0% found this document useful (0 votes)
20 views

S 1

Uploaded by

Suresh Veigandla
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

S 1

Uploaded by

Suresh Veigandla
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

(defun C:GetArea()

(setvar "cmdecho" 0)

;set up a variable to hold the accumulated areas


(setq myArea 0)

;while the user keeps making a selection


(while(setq ent(entsel))

;if an entity was selected and not a point in space


(if(car ent)
(progn

;let AutoCAD get the area of the object...cheap yet effective way out.
;Note: AutoCAD stores the area in the system variable "Area"
(command "area" "Object" (car ent))

;print the area to the command line


(princ

(strcat "\n Total Area for this Object = " (rtos (getvar "Area")))

;accumulate the area if it exist


(if (getvar "Area")(setq myArea(+ myArea (getvar "Area"))))
)
)
)

;ask for a text insertion point


(setq pt1(getpoint "\n Insertion Point: "))

;print the area in the drawing


(command "text" pt1 "" "" (strcat "Total Area: " (rtos myArea)))

;print the exit message to the command line


(princ "\n ...GetArea.lsp Complete. \n ")

;suppress the last echo


(princ)

;end of program

You might also like