Total Length Lisp code

Topics relating to AutoLisp and SDS.

Moderators: CMS Inc, avaernes

Post Reply
greekpatriot
Newbie
Posts: 2
Joined: Thu Feb 09, 2006 12:01 am

Total Length Lisp code

Post by greekpatriot » Thu Feb 09, 2006 1:22 am

(defun c:tll(/ sset len x llen ename lst llen1)
(prompt "Select lines:")
(setq sset (ssget))
(setq len (sslength sset))
(setq x 0)
(setq llen 0)
(while (< x len)
(setq ename (ssname sset x))
(setq lst (entget ename))
(if (= "LINE" (cdr(assoc 0 lst)))
(progn
(setq llen1 (distance (cdr(assoc 10 lst)) (cdr(assoc 11 lst))))
(setq llen (+ llen llen1))
);progn
);if
(setq x (+ 1 x))
);while
(princ "Total length of selected lines = ") (princ llen)(princ)
);defun
Post Reply