Jump to content

Changing value of attribute A of a Block with value of attribute B


ghsotwriter

Recommended Posts

I was given a template with blocks.

One of the block has an attribute with a text value (text value is in separate layer from the geometry)

I would like to copy the values of Attribute A to the Attribute B, all inside the same block.

 

Is there a way to do this in a more automatic way?

 

Thanks!

Link to comment
Share on other sites

I was given a template with blocks.

One of the block has an attribute with a text value (text value is in separate layer from the geometry)

I would like to copy the values of Attribute A to the Attribute B, all inside the same block.

 

Is there a way to do this in a more automatic way?

 

Thanks!

 

I mistyped. My last sentence i meant to copy the values of Attribute B to the Attribute A, all inside the same block.

 

Thanks for the quick reply pendean!

Link to comment
Share on other sites

Not sure my answer would change even with the new info: are your attributes tags unique from each other, or did you simply copy the first for the second location? posting sample dwg files might help others help you. Let us know.

Link to comment
Share on other sites

Like pendean a common asked for is to do Revision updates where the revision is bumped in a block containg multipe rows of attributes. A simple way is knowing the attribute order of creation and using the att number rather than tag names, cut att 3 and paste into att 6.

Something like this

; Change attribute value by created position
; by Alan H 
(vl-load-com)
(setq y 1)
(setq ss1 (car (entsel)))
(setq bname (vla-get-name(vlax-ename->vla-object SS1))) 

(setq x (getint "\nEnter line no to pick")) ; change this line in block
(SETQ newstrblank ".")
(foreach att (vlax-invoke (vlax-ename->vla-object SS1) 'getattributes)
   (if (= y x)
   (progn
   (setq newstr (vla-get-textstring att ))
   (vla-put-textstring att newstrblank)
   )
   )
   (setq y (+ Y 1))
)
(setq y 1)
(setq x (getint "\nEnter line no to move to"))
(foreach att (vlax-invoke (vlax-ename->vla-object SS1) 'getattributes)
   (if (= y x)
   (vla-put-textstring att newstr)
   )
   (setq y (+ Y 1))
)
(princ) 

Link to comment
Share on other sites

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...