Originally Posted by
vijaybaskergundla
Hi,
I am having seperate polylines in a file.I want to know the total length of these lines with one command. . .
This code works on LWpoly, HeavyPoly and 3dPoly.
Single select, window select or select All.
Code:
(defun c:PolySum ( / SelSet Item SumLength EntName )
(if (setq SelSet (ssget '((0 . "*POLYLINE" ))))
(progn
(vl-load-com)
(setq Item 0 SumLength 0 )
(repeat (sslength SelSet )
(setq EntName (ssname SelSet Item ) )
(setq SumLength (+ SumLength (vlax-curve-getDistAtParam EntName (vlax-curve-getEndParam EntName ))) )
(setq Item (1+ Item ) )
)
(princ (strcat "\n" (itoa Item ) " polylines, total length = " (rtos SumLength )) )
)
(princ "..no POLYLINE selected " )
)
(princ)
)
: ) Happy Computing !
kennet