;; Match Attribute Values - Lee Mac
(defun c:mav ( / idx lst ss1 ss2 val )
(if
(and
(princ "\nSelect source block: ")
(setq ss1 (ssget "_+.:E:S" '((0 . "INSERT") (66 . 1))))
(princ "\nSelect blocks to match attributes: ")
(setq ss2 (ssget "_:L" '((0 . "INSERT") (66 . 1))))
)
(progn
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname ss1 0)) 'getattributes)
(setq lst (cons (cons (strcase (vla-get-tagstring att)) (vla-get-textstring att)) lst))
)
(repeat (setq idx (sslength ss2))
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname ss2 (setq idx (1- idx)))) 'getattributes)
(if (setq val (cdr (assoc (strcase (vla-get-tagstring att)) lst)))
(vla-put-textstring att val)
)
)
)
)
)
(princ)
)
(vl-load-com) (princ)
(c:mav)

Advertisements