这样吧:- (defun C:blkrp ( / ss BlkName ents i)
- (setvar "osmode" 0)
- (princ "\n请选择作为源块的图块:")
- (setq ss (ssget (list (cons 0 "INSERT"))))
- (setq BlkName (cdr (assoc 2 (entget (ssname ss 0)))))
- (princ "\n请选择将替换的图块:")
- (setq ss (ssget (list (cons 0 "INSERT"))))
- (if ss
- (progn
- (setq i 0)
- (repeat (sslength ss)
- (setq ents (entget (ssname ss i)))
- (setq ents (subst (cons 2 BlkName) (assoc 2 ents) ents))
- (entmod ents)
- (setq i (1+ i))
- )
- )
- )
- (princ)
- )
|