- (defun c:tt ()
- "图块替换"
- (defun SubUpd (ename code newvalue)(entmod (subst (cons code newvalue) (assoc code (entget ename)) (entget ename))) (entupd ename))
- (princ "\n 选择需要替换的图块图元: ")
- (if (and (setq ss (ssget '((0 . "INSERT"))))
- (setq s0 (car (entsel "\n选择替换后的图块图块: ")))
- (=(cdr(assoc 0 (entget s0))) "INSERT")
- (setq bn (cdr (assoc 2 (entget s0))))
- (setq i -1)
- )
- (while (setq s1 (ssname ss (setq i (1+ i))))
- (SubUpd s1 2 bn)
- )
- )
- (princ)
- )
|