0 Members and 1 Guest are viewing this topic.
(defun c:addvals ( / index repval ss2add total) (setq ss2add (ssget) index 0 repval (sslength ss2add) total 0 ) (repeat repval (setq total (+ total (distof (cdr (assoc 1 (entget (ssname ss2add index))))))) (setq index (1+ index)) ) (alert (strcat "Total is: " (rtos total))))
(defun c:addvals (/ ss ename total num msg) (setq ss (ssget '((0 . "TEXT"))) i -1 total 0 ) (if ss (while (setq ename (ssname ss (setq i (1+ i)))) (if (setq num (distof (cdr (assoc 1 (entget ename))))) (setq total (+ total num)) ) ) ) (cond ((null ss) (setq msg " Nothing Selected")) ((zerop total) (setq msg " Zero Total")) (t (setq msg (strcat " Total is: " (rtos total)))) ) (alert msg) (princ))