AutoCAD 2013/2014/2015

Posts: 201
Registered: ‎10-08-2011
Message 1 of 7 (619 Views)
Accepted Solution

tolal length

619 Views, 6 Replies
04-23-2013 07:51 AM
Is there any easy way to get the total lenght of selected lines (even if they are not "connected") ?
Thank you
*Expert Elite*
Posts: 6,238
Registered: ‎09-16-2009
Message 2 of 7 (605 Views)

Re: tolal length

04-23-2013 08:10 AM in reply to: faisal.aaouatif

Yes, by using free autolisp from web.

Other than dataextraction that takes ten pages to get total length, I still don't see why autodesk not making this an option in PROPERTIES.

*Expert Elite*
Posts: 2,001
Registered: ‎12-15-2006
Message 3 of 7 (591 Views)

Re: tolal length

04-23-2013 08:35 AM in reply to: Patchy



You can find a lot of them ...

But here is a French routine (in Pure Lisp) to get the Total Length any standard entities ...

Routine : TL   ( Loading with APPLOAD )


Bye, Pat



;; Totaux Longueur : ligne, arc, polyligne, cercle, spline, ellipse
;; par MNT Reponse No 18

(defun C:TL (/ 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= " (rtos tl)))


Bye, Pat

Posts: 15
Registered: ‎01-31-2011
Message 4 of 7 (554 Views)

Re: tolal length

04-23-2013 02:15 PM in reply to: braudpat

Be careful with routines depending on the _AREA command - they may report wrong lenghts on self-intersecting polylines. Try e.g. the AddLen utility from (free)


Vladimir Michl,

*Expert Elite*
Posts: 1,023
Registered: ‎03-25-2009
Message 5 of 7 (546 Views)

Re: tolal length

04-23-2013 02:51 PM in reply to: faisal.aaouatif

You can try attached routine as well.

*Expert Elite*
Posts: 3,336
Registered: ‎11-13-2006
Message 6 of 7 (538 Views)

Re: tolal length

04-23-2013 03:37 PM in reply to: faisal.aaouatif
*Expert Elite*
Posts: 2,001
Registered: ‎12-15-2006
Message 7 of 7 (516 Views)

Re: tolal length

04-24-2013 12:54 AM in reply to: rkmcswain




The French routine TL, is in fact the TLEN routine coming from

(So using TL or TLEN, it's exactly the same Lisp - Sorry the real author has been omitted on

and it uses the .AREA which can (I agree) in some seldom case gives false results with the AREA

but I have never seen any error with the LENGTH !


ADDLEN.vlx (Command: ADDLEN) from www_cadstudio_cz

gives you the result in a SDF file (layer by layer) which is not very useful !?


Please find attached : DWG to test TL/TLEN/ADDLEN and the SDF coming from ADDLEN ...


I think that TL or TLEN is OK for the job required ...


Bye, Pat


Bye, Pat

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.