BLOCKS with Attributes - MATCHPROP for blocks?
Hi all,
I have a dwg with about 20 identical blocks. I would like to use the MATCHPROP command to change the layer for some of the attributes on selected blocks. For instance, about 8 blocks I need to change the attribute color to green from the existing white. These attributes are typically set "by layer" - which is what I want. But, I need to change the layer for the newly edited attributes. I could do this manually, but it's going to be about >100 different attributes.
Any tips or tricks?
Thx and stay safe.
0
Comments
-
Try this lisp code:
(defun c:MatchAttLyr ( / enm doc lyrLst obj ss) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-endundomark doc) (vla-startundomark doc) (if (and (setq enm (car (entsel "\nSource object: "))) (setq obj (vlax-ename->vla-object enm)) (= "AcDbBlockReference" (vla-get-objectname obj)) (= :vlax-true (vla-get-HasAttributes obj)) (princ "\nTarget objects: ") (setq ss (ssget (list (cons 2 (vla-get-name obj)) '(66 . 1)))) ) (progn (setq lyrLst (mapcar 'vla-get-layer (cons obj (vlax-invoke obj 'getattributes))) ) (mapcar '(lambda (enm / obj) (mapcar '(lambda (obj lyr) (vla-put-layer obj lyr) ) (cons (setq obj (vlax-ename->vla-object enm)) (vlax-invoke obj 'getattributes) ) lyrLst ) ) (vle-selectionset->list ss) ) ) ) (vla-endundomark doc) (princ) )
0