;对数字文本进行求和
(defun sum()
    (setq s
        (ssget '((0 . "TEXT") (1 . "~*[~`--9]*")))
    )
    (setq sl
        (sslength s)
    )
    (setq st 0)
    (setq j 0)
    (while (< st sl)
        (setq e(ssname s st))
        (setq st(1+ st))
        (setq i
            (atoi (cdr (assoc 1 (entget e))))
        )
        (setq j(+ j i))
    )
    (princ "求和结果为:")
    (eval j)
)