@alique.langlois wrote:
....
I also use Tlen.LSP and it works
I notice that TLEN and some of the routines in the link in my first Reply go to more trouble than necessary. They derive the length of different kinds of objects by different kinds of calculations, or in some cases using an AREA command on them so they can extract the length from the PERIMETER System Variable. Some allow selection of things that don't have length at all, and either just pass them by in processing, or report on their invalidity. But there's a way to disallow those right in the selection, and a single AutoLisp function that can get the length from all eligible object types in the same way, which greatly reduces the code required.
(vl-load-com) ; [if needed]
(defun C:TOTLEN (/ ss n ent tl)
(if (setq ss (ssget '((0 . "LINE,ARC,CIRCLE,*POLYLINE,SPLINE,ELLIPSE"))))
(progn ; then
(repeat (setq n (sslength ss))
(setq
ent (ssname ss (setq n (1- n)))
tl (+ (cond (tl) (0)) (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent)))
); setq
); repeat
(alert (strcat "Total length of selected objects is " (rtos tl) "."))
); progn
); if
(princ)
); defun
No, it doesn't do the breakdown reporting or extraction to a file or anything, but is just an improvement on the TLEN command and some of the other approaches.
Kent Cooper, AIA