以下假设活动布局中每个块只有一个参考,并且两个块都不是动态的:
- (defun c:attcopy ( / a b e i l s v x )
- (if
- (setq s
- (ssget "_X"
- (list
- '(0 . "INSERT")
- '(66 . 1)
- '(2 . "REV,REVHISTORY")
- (cons 410 (getvar 'ctab))
- )
- )
- )
- (progn
- (setq i -1)
- (while (not (or (and a b) (not (setq e (ssname s (setq i (1+ i)))))))
- (set (if (= "REV" (cdr (assoc 2 (entget e)))) 'a 'b) e)
- )
- (if (and a b)
- (progn
- (setq l
- (mapcar '(lambda ( x ) (cons (vla-get-tagstring x) (vla-get-textstring x)))
- (vlax-invoke (vlax-ename->vla-object a) 'getattributes)
- )
- )
- (foreach x (vlax-invoke (vlax-ename->vla-object b) 'getattributes)
- (if (setq v (cdr (assoc (vla-get-tagstring x) l)))
- (vla-put-textstring x v)
- )
- )
- )
- (if a
- (princ "\nREVHISTORY block not found in the current layout.")
- (princ "\nREV block not found in the current layout.")
- )
- )
- )
- (princ "\nNeither REV nor REVHISTORY blocks found in the current layout.")
- )
- (princ)
- )
- (vl-load-com) (princ)
|