也写了个
程序如下:
(defun c:qh (/ ss acc en ent tx nu)
(setq ss (ssget '((0 . "text,mtext"))))
(setq acc 0 nulist nil)
(repeat (sslength ss)
(setq en (ssname ss acc))
(setq ent (entget en))
(setq tx (read (cdr (assoc 1 ent))))
(if (numberp tx)
(progn
(setq nu tx)
(setq nulist (cons nu nulist))
)
)
(setq acc (1+ acc))
)
(setq he (apply '+ nulist))
(alert (strcat "所求和为" (rtos he 2 2)))
)
[ 本帖最后由 lenlenq 于 2009-10-13 20:10 编辑 ] |