Sum of lengths
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Sum of lengths

 
Post new topic   Reply to topic    CADForums.net Forum Index -> AutoCAD
Author Message
Mike Harrison
Guest





Posted: Sat Nov 19, 2005 5:10 pm    Post subject: Sum of lengths Reply with quote

Is there any way to select several lines on a drawing and have autocad list
the sum of their lengths?

Back to top
Peter Ruehle
Guest





Posted: Sat Nov 19, 2005 5:10 pm    Post subject: Re: Sum of lengths Reply with quote

Paul has a good freebie on his site.
Go here and download tlen.lsp:

http://www.turvill.com/t2/free_stuff/

It does circles, arcs, polylines as well as lines.

"Mike Harrison" <walker7729@hotmail.com> wrote in message
news:ArFff.536469$tl2.340047@pd7tw3no...
Quote:
Is there any way to select several lines on a drawing and have autocad
list the sum of their lengths?
Back to top
Dr Fleau
Guest





Posted: Mon Nov 21, 2005 5:10 pm    Post subject: Re: Sum of lengths Reply with quote

Here... have fun..

(defun c:develop (/ iter devel $a total data1
stpt endpt distl strad endrad distr
)
(setvar "osmode" 0)
(setq $a nil
iter 0
devel 0.0
stpt nil
endpt nil
strad 0.0
endrad 0.0
rad 0.0
distl 0.0
distr 0.0
total 0.0
devel 0.0
)
(setq $a (ssget))
(setq total (sslength $a))
(while (< 0 total)
(progn
(setq data1 (cdr (entget (ssname $a iter))))
(cond
((= (cdr (assoc 0 data1)) "LINE")
(Progn
(setq
stpt
(cdr (assoc 10 data1))
endpt
(cdr (assoc 11 data1))
)
(setq distl (abs (distance stpt endpt)))
(setq devel (+ devel distl))
) ;_END PROGN
) ;_END COND1
((= (cdr (assoc 0 data1)) "ARC")
(Progn
(setq
strad
(cdr (assoc 50 data1))
endrad
(cdr (assoc 51 data1))
rad
(cdr (assoc 40 data1))
)
(cond
((> endrad strad)
(setq distr (* rad (- endrad strad)))
)
((setq distr (* rad (+ endrad (- (* 2 pi) strad))))
)
(t nil)
) ;_end COND
(setq devel (+ devel distr))
) ;_END PROGN
) ;_END COND2
(T nil)
) ;_END COND
(setq iter (+ 1 iter))
(setq total (- total 1))
) ;_END PROGN
) ;_END WHILE
(alert (strcat "Longueur totale : " (rtos devel) " unités"))
(setq $a nil)
(setvar "osmode" 183)
) ;_end DEFUN DEVELOP


"Mike Harrison" <walker7729@hotmail.com> a écrit dans le message de
news:ArFff.536469$tl2.340047@pd7tw3no...
Quote:
Is there any way to select several lines on a drawing and have autocad
list
the sum of their lengths?



Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> AutoCAD All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Contact Us
Powered by phpBB