AutoCAD 2013/2014/2015

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

tolal length

887 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,325
Registered: ‎09-16-2009
Message 2 of 7 (873 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,407
Registered: ‎12-15-2006
Message 3 of 7 (859 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 ( Supporting Troops )
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Compliment) - Thanks
Contributor
vmichl
Posts: 15
Registered: ‎01-31-2011
Message 4 of 7 (822 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,153
Registered: ‎03-25-2009
Message 5 of 7 (814 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,648
Registered: ‎11-13-2006
Message 6 of 7 (806 Views)

Re: tolal length

04-23-2013 03:37 PM in reply to: faisal.aaouatif
*Expert Elite*
braudpat
Posts: 2,407
Registered: ‎12-15-2006
Message 7 of 7 (784 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 ( Supporting Troops )
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Compliment) - Thanks
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.