(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)
)
 
 
 
No comments:
Post a Comment