 - (defun c:tt (/ a b n3 s1 ss)
- (princ "\n选择文字: ")
- (if (and
- (setq ss (ssget ":S" '((0 . "*TEXT"))))
- (setq n3 (entget (setq s1 (car (entsel "\n写入数值: ")))))
- )
- (progn
- (setq a (cdr (assoc 1 (entget (ssname ss 0))))
- b (apply '* (mapcar 'read (split-numbers a)))
- b (* b 0.001 0.001 7.85)
- )
- (entmod (subst (cons 1 (rtos b 2 2)) (assoc 1 n3) n3))
- (entupd s1)
- )
- )
- (princ)
- )
- (defun split-numbers (str / buff l2)
- (setq str (vl-string->list str))
- (while str
- (if (< 47 (car str) 58)
- (setq buff (cons (car str) buff))
- (if buff
- (setq l2 (cons (vl-list->string (reverse buff)) l2)
- buff nil
- )
- )
- )
- (setq str (cdr str))
- )
- (if buff
- (setq l2 (cons (vl-list->string (reverse buff)) l2))
- )
- (reverse l2)
- )
|