AutoCAD 2013/2014/2015

Reply
Mentor
faisal.aaouatif
Posts: 204
Registered: ‎10-08-2011
Message 1 of 7 (666 Views)
Accepted Solution

tolal length

666 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

 

Hello

 

The French routine TL, is in fact the TLEN routine coming from www.turvill.com

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

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

 

*Expert Elite*
Patchy
Posts: 6,267
Registered: ‎09-16-2009
Message 2 of 7 (652 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*
braudpat
Posts: 2,168
Registered: ‎12-15-2006
Message 3 of 7 (638 Views)

Re: tolal length

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

Hello

 

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
;; http://www.cadxp.com/modules.php?op=modload&name=XForum&file=viewthread&tid=2683#pid6828

(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)))
(princ)
)

 

Bye, Pat

Contributor
vmichl
Posts: 15
Registered: ‎01-31-2011
Message 4 of 7 (601 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 www.cadstudio.cz/download (free)

 

Vladimir Michl, www.cadforum.cz


*Expert Elite*
3wood
Posts: 1,082
Registered: ‎03-25-2009
Message 5 of 7 (593 Views)

Re: tolal length

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

You can try attached routine as well.

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

Re: tolal length

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

Re: tolal length

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

 

Hello

 

The French routine TL, is in fact the TLEN routine coming from www.turvill.com

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

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

Need installation help?

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