(defun c:TTx ()
(defun *error* (msg)
(if (not
(member msg '("Function cancelled" "quit / exit abort"))
)
(princ msg)
)
(setvar 'cmdecho cmh)
(princ)
)
(setq cmh (getvar 'cmdecho))
(setvar 'cmdecho 0)
(if (setq ss (ssget '((0 . "TEXT") (1 . "##.###,#*"))))
(progn
(setq cntr 0
len (sslength ss)
total 0
)
(repeat len
(setq ssnm (ssname ss cntr))
(setq ent (entget ssnm))
(setq val (atof (cdr (assoc 1 ent))))
(setq total (+ total val))
(setq cntr (1+ cntr))
)
(if (setq TExt
(car (entsel "\nSelect A TExt To rePlace Value:"
)
)
)
(progn
(entmod (subst (cons 1 (rtos total 2 3))
(assoc 1 (entget TExt))
(entget TExt)
)
)
(entupd TExt)
)
(princ "\nError No Text Selected:")
)
)
(princ "\nError No Texts Selected for Total Value:")
)
(*error* "")
(princ)
)
(defun *error* (msg)
(if (not
(member msg '("Function cancelled" "quit / exit abort"))
)
(princ msg)
)
(setvar 'cmdecho cmh)
(princ)
)
(setq cmh (getvar 'cmdecho))
(setvar 'cmdecho 0)
(if (setq ss (ssget '((0 . "TEXT") (1 . "##.###,#*"))))
(progn
(setq cntr 0
len (sslength ss)
total 0
)
(repeat len
(setq ssnm (ssname ss cntr))
(setq ent (entget ssnm))
(setq val (atof (cdr (assoc 1 ent))))
(setq total (+ total val))
(setq cntr (1+ cntr))
)
(if (setq TExt
(car (entsel "\nSelect A TExt To rePlace Value:"
)
)
)
(progn
(entmod (subst (cons 1 (rtos total 2 3))
(assoc 1 (entget TExt))
(entget TExt)
)
)
(entupd TExt)
)
(princ "\nError No Text Selected:")
)
)
(princ "\nError No Texts Selected for Total Value:")
)
(*error* "")
(princ)
)
0 comments:
Post a Comment