Change attribute values to default values

Change attribute values to default values

Anonymous
Not applicable
11,841 Views
29 Replies
Message 1 of 30

Change attribute values to default values

Anonymous
Not applicable

Hi all,

 

I have several instances of a block placed on my drawings, and they all have attributes with values already set up. I have now changed the default value for two of those attributes to be a dynamic field. Is there a way to change those two attributes values back to the new default value for all instances of the block?

Thank you.

 

Alessandro

0 Likes
Accepted solutions (2)
11,842 Views
29 Replies
Replies (29)
Message 21 of 30

Anonymous
Not applicable

I have done some more tests and it looks like it's working only if the source attribute value has been already manually updated (see Working.dwg) and not if the source attribute has still the text value ("test" in NotWorking.dwg).

Also, I have tested it on my work drawings (more than 100 objects of a block) using the "working" approach and: 1. it missed some objects, apparently randomly; 2. it resets another attribute of that block to the default value (standard text attribute, no field codes).

0 Likes
Message 22 of 30

Anonymous
Not applicable

The attached lisp I found online (can't remember where) seems to work good, except for the fact that I have to select each attribute individually. Could it be helpful?

0 Likes
Message 23 of 30

Moshe-A
Mentor
Mentor

dear Alessandro Coppola,

 

You have to decide what you want? you start with example.dwg 'telling' you want to copy field code but testing it on attribute with simple value and that is totally something else cause coping simple value is very easy to do but again that's was not your initial  request. coping a field code is more complicated cause in your case you want to represent the X coordinate of the reference block.

 

so do more thinking and tell me what are all the options (attributes value) you want to copy?

 

moshe

 

0 Likes
Message 24 of 30

Anonymous
Not applicable

It is very clear what I want, yes I want to copy field code. In my previous post I was only saying that I thought your lisp worked when the field code was set in default value, not in the current value. That's it. Just trying to understand how it works. If it works like that it would be great anyway. Changing the source value it's not a problem. Now I am wondering why it asks if I want to change the source attribute value, if it has to be already changed to get it work.

Also, see second part of my previous post. There are some other problems.

0 Likes
Message 25 of 30

Moshe-A
Mentor
Mentor

@Anonymous,

 

It is very clear what I want, yes I want to copy field code. In my previous post I was only saying that I thought your lisp worked when the field code was set in default value, not in the current value.

what i said (even twice) that the lisp will work only if the source attribute value contain field code

and i was wondering how come you are trying to test it on attributes that does not contain field code (see your notworking.dwg)

 

That's it. Just trying to understand how it works. If it works like that it would be great anyway. Changing the source value it's not a problem.

if you do not set the attributes value with field code then how can you expect the lisp will know want to copy?

 

Now I am wondering why it asks if I want to change the source attribute value, if it has to be already changed to get it work.

it ask that cause there is always a change that you will select an not update attribute for example:

some how the block with X coords has moved but no regen or updatefield invoked.

 

Also, see second part of my previous post. There are some other problems.

post the drawing with these problems (mark them somehow) so i can take a look


of course there is a posibility to make the lisp to respond to any attribute value (standard or/and field codes) but you agree that i have to know about it advance?!

 

 

 

0 Likes
Message 26 of 30

Anonymous
Not applicable

@Moshe-A wrote:

@Anonymous,

 

It is very clear what I want, yes I want to copy field code. In my previous post I was only saying that I thought your lisp worked when the field code was set in default value, not in the current value.

what i said (even twice) that the lisp will work only if the source attribute value contain field code

and i was wondering how come you are trying to test it on attributes that does not contain field code (see your notworking.dwg)

The field code was in the default value, and I assumed it was fine since you said you had tested it on example.dwg, which is exactly the same as NotWorking.dwg (no field code in the current value but in the default value only).

 

That's it. Just trying to understand how it works. If it works like that it would be great anyway. Changing the source value it's not a problem.

if you do not set the attributes value with field code then how can you expect the lisp will know want to copy?

See above. Obviously I am not an expert but I assumed it is possible to set the attribute value to the default value. I think it's possible but your lisp probably works in a different way (copying the current attribute value to the others) but I couldn't know that.

 

Now I am wondering why it asks if I want to change the source attribute value, if it has to be already changed to get it work.

it ask that cause there is always a change that you will select an not update attribute for example:

some how the block with X coords has moved but no regen or updatefield invoked.

I am happy with the explanation, but without knowing that you agree that, if I don't know how your lisp works and it asks if you want to update the source attribute,  it's understandable to assume that there was no need to manually update the source attribute.

 

Also, see second part of my previous post. There are some other problems.

post the drawing with these problems (mark them somehow) so i can take a look

I am sure that your lisp works perfectly and this has something to do with my blocks definition, too many people working on the drawings over the months and the blocks are quite messed up. The funny thing is that on my drawings the lisp works on almost all the blocks but not all of them, but if I copy the blocks to another drawing it's never working, even for the blocks where it used to work. I tried to copy a couple of them and clean them up a little bit to reduce them to the essentials, and it doesn't work (see attached). But again, this has to do with my blocks so don't waste too much time on it, I am already totally happy with the proposed solution. 



 

0 Likes
Message 27 of 30

Moshe-A
Mentor
Mentor

@Anonymous,

 

i'm sorry,  there is huge miss understanding here. you are talking about default attribute value but you did not mention you are refering to the block definition, now i getting it. by the way the first lisp was taking the default value from the block definition but after you said it's not working i thought you are reference to the current attribute value.

 

anyway setting field code position to the attributes definition from BEDIT is not the same as setting it to the block reference attribute. in BEDIT you take blockplaceholder whereas in block reference you directly can take Object  and that's exactly where the lisp is fails (it expect object)

 

to tell the truth i never used blockplaceholders so i will explore them and comeup with a solution for you. meanwhile attached a quick update that also respond to standard attribute value. meaning if the attribute value does not contains field code it will be copy & paste anyway 😀

 

Moshe

 

 

  

 

 

 

0 Likes
Message 28 of 30

Moshe-A
Mentor
Mentor
Accepted solution

@Anonymous ,

 

well, here is my result:

the  (LM:fieldcode) function (which this lisp is base on) does not retrieve field code from Attribute Definition so i actually reached 'dead end' here 😂 

 

so your solution should be setting the field code value to a block reference and from there populate it to all.

as for the coworkers? they must follow this rule and fix the attribute value.

 

as for copy & paste such blocks between drawings there should be no problem, the field code should be copied normally. 

 

found the bug you encounter and fix it (attached update)

 

moshe

 

 

 

0 Likes
Message 29 of 30

Anonymous
Not applicable

Brilliant! 

For some reason it's still missing some blocks in my original drawings, but that's fine. Something wrong with my blocks I'm sure.

Many thanks.

0 Likes
Message 30 of 30

CHLOE-KJ-DINGMAN
Observer
Observer

I know this is an old thread but thank you so much for that command!! I have spent far too much time changing attributes when this command would have changed all of them in just a couple of clicks. Much appreciated!!