修改相同内容的标注
- (defun c:tt (/ *error* cmd dist en en0 ent ent0 new-str ss ssn str str0)
- (defun *error* ( msg )
- (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
- (progn (princ (strcat "\n错误:" msg)) (vl-cmdf "_undo" "e") (vl-cmdf "_undo" 1) (setvar "CMDECHO" cmd))
- )
- (princ)
- )
- (vl-cmdf "_undo" "be")
- (setq cmd (getvar "CMDECHO"))
- (setvar "CMDECHO" 0)
- (while (setq en (car (entsel "\n选择标注样板:"))
-
- )
- (setq new-str (getstring "\n输入新值:")
- ent (entget en)
- str0 (cdr (assoc 1 ent))
- dist (cdr (assoc 42 ent))
- )
- (if str0 (setq str str0) (setq str (rtos dist 2 3)))
- (setq ss (ssget (list '(0 . "DIMENSION") '(-4 . "<xor") (cons 1 str) '(-4 . "<and") (cons 1 "") (cons 42 (atof str)) '(-4 . "and>") '(-4 . "xor>")))
- ssn (sslength ss)
- )
- (repeat ssn
- (setq en0 (ssname ss (setq ssn (1- ssn)))
- ent0 (entget en0)
- )
- (entmod (subst (cons 1 new-str) (assoc 1 ent0) ent0))
- (entupd en0)
- )
- )
- (vl-cmdf "_undo" "e")
- (setvar "CMDECHO" cmd)
- (princ)
- )
|