- (defun c:inbt (/ sb en en1 i m name ss)
- (setq i 0)
- (if (and (setq sb (entsel "\nSelect source Block :"))
- (setq en (entget (car sb)))
- (= (cdr (assoc 0 en)) "INSERT")
- )
- (progn
- (setq ss (ssget '((0 . "INSERT"))))
- (repeat (sslength ss)
- (setq name (ssname ss i))
- (setq en1 (entget name))
- (setq m (cdr (assoc 2 en1)))
- (if (= m "要替换的块名")
- (entmod (subst (assoc 2 en) (assoc 2 en1) en1))
- )
- (setq i (1+ i))
- )
- )
- )
- (princ)
- )
|