(defun c:rrr ( / ss n i a sum ent) ;标注数相加
(princ "选择要相加的标注:")
(setq ss (ssget '((0 . "DIMENSION")))
n (sslength ss)
i 0
sum 0
)
(while (< i n)
(Setq ent (entget (ssname ss i))
a (if (= (cdr (assoc 1 ent)) "")
(cdr (assoc 42 ent))
(atof (cdr (assoc 1 ent)))
)
sum (+ a sum)
i (+ 1 i)
)
)
(princ sum)
(princ)
)