Jump to content
ghsotwriter

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

Recommended Posts

ghsotwriter

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!

Share this post


Link to post
Share on other sites
pendean

The second attribute needs to be a FIELD

Share this post


Link to post
Share on other sites
ghsotwriter
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!

Share this post


Link to post
Share on other sites
pendean

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.

Share this post


Link to post
Share on other sites
BIGAL

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) 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×