This is the routine I use. It's a free LSP from Tee Square graphics that I modified so it will print the distance on the drawing It will not include blocks.
I use it for exactly what you do. Laser & Waterjet cutting
Jeannette
formatting link
;|
TLEN.LSP - Total LENgth of selected objects (c) 1998 Tee Square Graphics
|;
(defun C:TLEN (/ ss tl n ent itm obj l) (setq ss (ssget) tl 0 n (1- (sslength ss))) (while (>= n 0) (setq ent (entget (setq itm (ssname ss n))) obj (cdr (assoc 0 ent)) l (cond ((= obj "LINE") (distance (cdr (assoc 10 ent))(cdr (assoc 11 ent)))) ((= obj "ARC") (* (cdr (assoc 40 ent)) (if (minusp (setq l (- (cdr (assoc 51 ent)) (cdr (assoc 50 ent))))) (+ pi pi l) l))) ((or (= obj "CIRCLE")(= obj "SPLINE")(= obj "POLYLINE") (= obj "LWPOLYLINE")(= obj "ELLIPSE")) (command "_.area" "_o" itm) (getvar "perimeter")) (T 0)) tl (+ tl l) n (1- n))) ;(alert (strcat "Total length of selected objects is " (rtos tl 2
2))) (setq tlen (rtos tl 2 2))
(cond ((boundp 'tlen) (setq cmd (getvar "cmdecho") mno (getvar "menuecho") ) (setvar "cmdecho" 0) (setvar "menuecho" 1) (graphscr) (setq wcl (strcat "Total Cut Length = " tlen)) (setq p1 (getpoint "\nPick the arrowhead position : ")) (if (= p1 nil)(setq p2 nil)(setq p2 (getpoint p1 "\nPick the text position : "))) (if (/= p2 nil)(command "leader" p1 p2 "" wcl "")) (setvar "cmdecho" cmd) (setvar "menuecho" mno) ) ) (princ) )