cadguy68 Posted December 23, 2009 Posted December 23, 2009 Hi All, I'm looking for some advice please, a while ago I came across the Lisp routine below while using AutoCAD 2007 which allowed me to measure the total length of all polylines on any particular layer and work perfectly but now i've upgrade to AutoCAD 2010 the Lisp routine dosen't seem to be working properly and I get the follwing errors either it wont register any length or I receive the follwing error message Area calculation failed. Select objects: _.AREA *Invalid selection* Expects a point or Last ; error: Function cancelled Any help or advice would be most gratefull Many Thanks Paul (defun c:zone ( / ss la rv i tv op en) (while (not ss) (princ "\nPick any object on the required layer") (setq ss (ssget))) (initget "Length Area") (setq rv (getkword "\nWould you like to measure Length/ : ")) (and (not rv) (setq rv "Area")) (setq la (cdr (assoc 8 (entget (ssname ss 0)))) ss (ssget "X" (list (cons 0 "*POLYLINE") (cons 8 la))) i (sslength ss) tv 0 op 0) (while (not (minusp (setq i (1- i)))) (setq en (ssname ss i)) (command "_.AREA" "_E" en) (cond ((= rv "Length") (setq tv (+ tv (getvar "PERIMETER")))) (T (setq tv (+ tv (getvar "AREA"))) (if (/= (logand (cdr (assoc 70 (entget en))) 1) 1) (setq op (1+ op)))))) (princ (strcat "\nTotal " rv " for layer " la " = " (rtos tv 2 2) " in " (itoa (sslength ss)) " polylines\n" (if (/= rv "Length") (strcat (itoa op) " with open polylines") ""))) (prin1)) Quote
David Bethel Posted December 23, 2009 Posted December 23, 2009 Paul, That is actually a very old routine. David Watson wrote and it has been updated a couple of times. http://www.cadtutor.net/forum/showthread.php?t=1375&highlight=c:zone I would think that it should run in 2010. I have no real idea as to why it wouldn't. Sorry. -David Quote
cadguy68 Posted December 24, 2009 Author Posted December 24, 2009 Hi David, Thank you for your help. Regards Paul Quote
cadguy68 Posted December 24, 2009 Author Posted December 24, 2009 Hi Lee, I will give this a try. Thank you for your help Regards Paul Quote
Lee Mac Posted December 24, 2009 Posted December 24, 2009 Hi Lee, I will give this a try. Thank you for your help Regards Paul Not a problem, let me know how you get on Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.