Lisp AutoCAD – Total length Line, Polyline, Circle, Arc, Ellipse, Spline

By | May 3, 2023

The topic today: Lisp AutoCAD – Total length Line, Polyline, Circle, Arc, Ellipse, Spline

To use this Lisp, step to step as following:

  1. Load Lisp to AutoCAD
  2. Type “TL” and press Enter
  3. Select objects need to calculate length
  4. Press Enter and Look result

Code Lisp:

(defun Length1(e) (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e)))
;;;——————————————————————–
(defun C:TL( / ss L e)
(setq
ss (ssget (list (cons 0 “LINE,ARC,CIRCLE,POLYLINE,LWPOLYLINE,ELLIPSE,SPLINE”)))
L 0.0
)
(vl-load-com)
(while (setq e (ssname ss 0))
(setq L (+ L (length1 e)))
(ssdel e ss)
)
(alert (strcat “Total length = ” (rtos L)))
)
;;;——————————————————————–

Download Lisp here: Link 1Link 2

Thanks for visiting and reading AutoCADtip.com Blog!