Jump to content

Recommended Posts

Posted (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?
image.png.2d29d4b8fbf6f23b652c54d675037de0.png 
 

Edited by barristann
  • barristann changed the title to Help Please: Change Block Attributes with Same Name
Posted

I think you can do that in block editor. either that or explode the block rename the attribute and then remake the block

  • Like 2
Posted

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.

  • Like 2
Posted (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 by Emmanuel Delay
  • Like 1
Posted

Thank you everyone for your counsel. I'll utilize these ideas. 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...