### Find Area in Acres

There are quite a few ways to accomplish this and I am going to show you a little trick to find area in acres quickly. The reason I am writing this is to show you some of the capabilities AutoCAD has when it comes to doing calculations.

Type AREA in the command line and you will get this prompt:

`Specify first corner point or [Object/Add/Subtract]:`

You can pick points or select an object and add/subtract to find the area you need.

NOTE: The AREA command stores the last calculation in a system variable also called AREA. To see this, type SETVAR on the command line, then type AREA. It will show you the stored value of the last AREA command calculation.

Depending on the units you are using, you will need to first find the formula 1 acre = X units. I often use Google to calculate unit conversions. Then divide the value found in the AREA command by value X shown in the conversion.

For example, if you calculated the area in feet you would divide the total area by 43560 to get the acreage.

Or…since it’s way too much work to copy & paste, let alone, type the area into a calculator (tongue-in-cheek), you could type CAL on the command line and at the Expression prompt, type:

`GETVAR(area)/43560`

Let’s break this formula down:

GETVAR(area) is an AutoLISP expression that returns the value produced by the AREA command. The forward slash (/) means “divided by”. The 43560 value is X (in this case shown in feet) in the formula 1 acre = X units.

I can hear you saying, “I’ll never remember that!” I hear you. So why not turn this into a custom macro button so you can forget this expression and still use it whenever you need it (after you run the AREA command first, of course):

`^C^Ccal;GETVAR(area)/43560;`

More on creating buttons and toolbars…

Of course there is probably a free AutoLISP program out there that could do the trick as well. If you know of any, feel free to share it with me.

1. CadKicks.com on September 3rd, 2008

Find Area in Acres…

2. Randall Culp on December 16th, 2008

(defun CalcAREA ()
(setq a 0
ss (ssget ‘((-4 . ""))
)
)
(if ss
(progn
(setq n (1- (sslength ss)))
(while (&gt;= n 0)
(command "_.area" "_o" (ssname ss n))
(setq a ( a (getvar "area"))
n (1- n))
) ;;close while
);;close progn
(alert "\nNo Objects with AREA selected!")
) ;;close if
(princ)
) ;;close defun
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun C:ListAREA ()
(calcarea)
(if (/= a 0)
(progn
(strcat "The total area of the selected object(s) is\n\n "
(strcat
(rtos a 2 2) " Sq In,\nor\n "
(rtos (/ a 144.0) 2 2) " Sq Ft, \nor\n "
(rtos (cvunit a "sq in" "Acres") 2 3) " Acres")
))
)
)
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun C:TAGAREA ()
(calcarea)
(if (/= a 0)
(progn
(setq str3
(strcat
(rtos (/ a 144.0) 2 2) " Sq Ft\\P"
(rtos (cvunit a "sq in" "acres") 2 3) " Acres"
)
)
(txstla)
(setq at2 (getpoint "\nLocation for text… "))
(command "Mtext" at2 "R" "0" "J" "MC" "W" "0" str3 "")
)
)
(princ)
)

3. Randall Culp on December 16th, 2008

oops, there is a call to (txstla) just before the MTEXT command in the function above that needs to be removed. Its a function I use to set the proper style and layer for text.

4. Michael Smith on December 16th, 2008

malformed list on input
I remarked out the (txstla) in the file.

5. Josh Jones on December 17th, 2008

I get the same “malformed list” error message in ACAD ’08.

6. Randall Culp on December 17th, 2008

(defun CalcAREA ()
(setq a 0
ss (ssget ‘((-4 . “”))
)
)
(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))
) ;;close while
);;close progn
(alert “\nNo Objects with AREA selected!”)
) ;;close if
(princ)
) ;;close defun
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun C:ListAREA ()
(calcarea)
(if (/= a 0)
(progn
(strcat “The total area of the selected object(s) is\n\n ”
(strcat
(rtos a 2 2) ” Sq In,\nor\n ”
(rtos (/ a 144.0) 2 2) ” Sq Ft, \nor\n ”
(rtos (cvunit a “sq in” “Acres”) 2 3) ” Acres”)
))
)
)
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun C:TAGAREA ()
(calcarea)
(if (/= a 0)
(progn
(setq str3
(strcat
(rtos (/ a 144.0) 2 2) ” Sq Ft\\P”
(rtos (cvunit a “sq in” “acres”) 2 3) ” Acres”
)
)
;(txstla)
(setq at2 (getpoint “\nLocation for text… “))
(command “Mtext” at2 “R” “0″ “J” “MC” “W” “0″ str3 “”)
)
)
(princ)
)

7. Randall Culp on December 17th, 2008

This reply window is truncating a line in the function. The selection set “SS” in the third line should allow collection anything that has area, circles, regions, splines, plines, ellipses.

Let me try breaking it up
(ssget
‘(
(-4 . “”)
)

8. Randall Culp on December 17th, 2008

Nope, that didn’t work either. maybe its the less-than and greater-than symbols

(ssget
‘(
(-4 . “[insert_less_than_symbol_here]OR”)
(0 . “CIRCLE”)
(0 . “region”)
(0 . “*polyline”)
(0 . “spline”)
(0 . “ellipse”)
(-4 . “OR[insert_greater_than_symbol_here]“)
)

9. Michael Smith on December 17th, 2008

10. Randall Culp on December 17th, 2008

This “reply” window dislikes less-than and greater-than symbols in lisp, sorry.

Okay in the function calcarea, third line down, we’re setting the variable SS to a Selection Set.

the reply window truncates it to (-4 . “”)
(-4 . “[insert_less_than_symbol_here]OR”)
(0 . “CIRCLE”)
(0 . “region”)
(0 . “*polyline”)
(0 . “spline”)
(0 . “ellipse”)
(-4 . “OR[insert_greater_than_symbol_here]“)

Be sure to replace [insert_less_than_symbol_here] and [insert_greater_than_symbol_here] with the real symbols.

11. Randall Culp on December 17th, 2008

Trying again with more knowledge :)

(defun CalcAREA ()
(setq a 0
ss (ssget ‘((-4 . “”))
)
)
(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))
) ;;close while
);;close progn
(alert “\nNo Objects with AREA selected!”)
) ;;close if
(princ)
) ;;close defun
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun C:ListAREA ()
(calcarea)
(if (/= a 0)
(progn
(strcat “The total area of the selected object(s) is\n\n ”
(strcat
(rtos a 2 2) ” Sq In,\nor\n ”
(rtos (/ a 144.0) 2 2) ” Sq Ft, \nor\n ”
(rtos (cvunit a “sq in” “Acres”) 2 3) ” Acres”)
))
)
)
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun C:TAGAREA ()
(calcarea)
(if (/= a 0)
(progn
(setq str3
(strcat
(rtos (/ a 144.0) 2 2) ” Sq Ft\\P”
(rtos (cvunit a “sq in” “acres”) 2 3) ” Acres”
)
)
;(txstla)
(setq at2 (getpoint “\nLocation for text… “))
(command “Mtext” at2 “R” “0″ “J” “MC” “W” “0″ str3 “”)
)
)
(princ)
)

12. Jim on December 18th, 2008

Shouldn’t the first line be:(defun C:CalcAREA ()
And I get an Unknown command when ever I enter Listarea or tagarea
Jim