CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.
Please abide by the
rules of this forum.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
Author |
Topic Search Topic Options
|
MK2015
Newbie
Joined: 14.May.2015
Location: Canada
Using: AutoCAD Map 3D
Status: Offline
Points: 7
|
Topic: AUTOAREA LISP Posted: 15.May.2015 at 18:23 |
Thanks Robert. But ideally it would be nice if I could get my old routine to work. You see I need the area in acres and hectares simultaneously. And it's also very convenient because it does not require a closed polyline.
|
|
Robert_D
Senior Member
Joined: 21.Oct.2013
Location: United States
Using: BricsCAD v21, AutoCAD2006
Status: Offline
Points: 207
|
Posted: 14.May.2015 at 21:11 |
Also, lee-mac has a few routines which may (?) be of interest: http://www.lee-mac.com/areastofield.html http://www.lee-mac.com/arealabel.html http://www.lee-mac.com/areafieldtoattribute.html
|
|
Robert_D
Senior Member
Joined: 21.Oct.2013
Location: United States
Using: BricsCAD v21, AutoCAD2006
Status: Offline
Points: 207
|
Posted: 14.May.2015 at 21:00 |
MK2015 wrote:
1).How do I go to 2 decimal places? But again my old one was ideal as I also require area in hectares... |
Hmm, don't know about the decimal places, may play around if I get time. Hectares display correctly if you replace (getvar "area") 144)) with (getvar "area") 15500031.0001)).
|
|
MK2015
Newbie
Joined: 14.May.2015
Location: Canada
Using: AutoCAD Map 3D
Status: Offline
Points: 7
|
Posted: 14.May.2015 at 19:52 |
1) Yes, thanks. How do I go to 2 decimal places? But again my old one was ideal as I also require area in hectares. 2.) My old Autoarea.lsp doesn't require a closed polyline and that's what makes it so convenient. (It creates a temporary closed polyline by itself and then deletes it)
|
|
Robert_D
Senior Member
Joined: 21.Oct.2013
Location: United States
Using: BricsCAD v21, AutoCAD2006
Status: Offline
Points: 207
|
Posted: 14.May.2015 at 18:21 |
1) You could modify the routine. You'll notice (getvar "area") 144)) where it divides the default inches and divides by 144 for ft2. 2) I would think all routines would require a closed polyline.
|
|
MK2015
Newbie
Joined: 14.May.2015
Location: Canada
Using: AutoCAD Map 3D
Status: Offline
Points: 7
|
Posted: 14.May.2015 at 17:59 |
Robert: Thanks, but this one doesn't work for us mainly for these 2 reasons: - I need the area in Acres and Hectares, not square feet - This requires a closed polyline and we are always dealing with cadastral mapping which is made up of lines or polylines. I realize I could use the boundary command, but this creates an extra step.
|
|
Robert_D
Senior Member
Joined: 21.Oct.2013
Location: United States
Using: BricsCAD v21, AutoCAD2006
Status: Offline
Points: 207
|
Posted: 14.May.2015 at 16:53 |
A similar AREA2.LSP you can try:
;;; places area at specified point (defun c:area2 (/ olderr en el hlt areatxt pt1) (setq olderr *error*) (defun *error* (str) (if (= str "Function cancelled") (princ) (princ (strcat "Error: " str)) ) ;if (if hlt (redraw (car en) 4)) (setvar "cmdecho" 1) (setq *error* olderr) ) ;defun error (setq en 1) (setvar "cmdecho" 0) (while en (while (not ;make sure user selects an object (setq en (entsel "\nSelect object or [Escape] to quit ")) ) ) (setq hlt 1) (redraw (car en) 3) (setq el (entget (car en))) (if (or (= (cdr (assoc 0 el)) "LWPOLYLINE") (= (cdr (assoc 0 el)) "CIRCLE") (= (cdr (assoc 0 el)) "ELLIPSE") );or (progn (command ".area" "o" en) (setq areatxt (/ (getvar "area") 144)) (while (not ;make sure user selects a point (setq pt1 (getpoint "\nSelect point for text ")) ) );while (if (not (tblsearch "layer" "SQ-FT")) (command ".-layer" "m" "SQ-FT" "c" "7" "SQ-FT" "")) (setvar "clayer" "SQ-FT") (setq el (subst '(8 . "SQ-FT") (assoc 8 el) el)) (entmod el) (setvar "textstyle" "standard") (if (/= (cdr (assoc 40 (tblsearch "style" "standard"))) 0) (command ".text" "j" "mc" pt1 0 (strcat (rtos areatxt 2 1) " SF")) (command ".text" pt1 8.0 0 (strcat (rtos areatxt 2 1) " SF")) );if );progn );if (setq hlt nil) (redraw (car en) 4) );while (setvar "cmdecho" 1) (setq *error* olderr) (princ) ) ;end of function
|
|
John Connor
Senior Member
Joined: 01.Feb.2011
Location: United States
Using: AutoCAD 2018
Status: Offline
Points: 7175
|
Posted: 14.May.2015 at 16:50 |
I see what you mean as I just tried to use it in plain AutoCAD.
Edited by John Connor - 14.May.2015 at 16:58
|
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."
<<AutoCAD 2015>>
|
|
MK2015
Newbie
Joined: 14.May.2015
Location: Canada
Using: AutoCAD Map 3D
Status: Offline
Points: 7
|
Posted: 14.May.2015 at 16:35 |
It freezes AutoCAD.
|
|
John Connor
Senior Member
Joined: 01.Feb.2011
Location: United States
Using: AutoCAD 2018
Status: Offline
Points: 7175
|
Posted: 14.May.2015 at 11:59 |
What kind of error are you getting?
|
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."
<<AutoCAD 2015>>
|
|