;;;Moss Designs ;;;www.mossdesigns.com ;;;April 2004 ;;;This routine allows you to total the values in a block attribute (defun c:btot() (prompt "\nSelect blocks to total: ") (setq bgroup (ssget)) ; filter so user only selected blocks (setq index 0) (setq total 0) (setq blen (sslength bgroup)) (while (< index blen) (setq bitem (ssname bgroup index)) (setq bdetail (entget bitem)) ; get value for attribute (setq attitem (entnext bitem)) (setq attdet (entget attitem)) (if (= (cdr (assoc 2 attdet)) "STALLS") (setq stallamt (atoi(cdr (assoc 1 attdet)))) ) (setq index (1+ index)); increment counter (setq total (+ total stallamt)) );end while (setq total (rtos total)) (setq msg (strcat "The total number of stalls is: " total)) (alert msg) ); end defun (princ "Type 'btot' to total your block values.")