barristann Posted March 6 Posted March 6 (edited) Hi all, I have blocks with 2 Attributes, but they both have the same name = "TEXT" How do I rename the 1st to NAME & the 2nd to NUMBER? Edited March 6 by barristann Quote
mhupp Posted March 7 Posted March 7 I think you can do that in block editor. either that or explode the block rename the attribute and then remake the block 2 Quote
BIGAL Posted March 7 Posted March 7 As Mhupp suggested use BEDIT on the block, and click on attribute have properties open can change Tagname there, then do Bclose to save. You may need to attsync the block to update the redefinition of the block. Yes can do a get attribute1 change, then get next attribute, but to much effort compared to bedit. 2 Quote
Emmanuel Delay Posted March 7 Posted March 7 (edited) (vl-load-com) (defun c:test ( / blk lst1 i newTagList) (setq newTagList (list "NAME" "NUMBER" ;;"TAG3" ;; and feel free to add tags in case there's more than 2 ;;"TAG4" ;;"TAG5" )) (setq blk (vlax-ename->vla-object (car (entsel "\nSelect block: ")))) (setq lst1 (vlax-invoke blk 'getAttributes)) (setq i 0) (foreach att lst1 (vla-put-TagString att (nth i newTagList)) (setq i (+ i 1)) ) (princ) ) This code changes the attribute tags of selected blocks. But it probably doesn't solve the problem. It only changes the attribute of the INSERT, it doesn't update the definition of the block ... As everybody is saying: you probably better do block edit. Unless there's a reason why you prefer not to? Edited March 7 by Emmanuel Delay 1 Quote
barristann Posted March 7 Author Posted March 7 Thank you everyone for your counsel. I'll utilize these ideas. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.