Author Topic: Attribute change  (Read 20943 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Attribute change
« Reply #45 on: January 04, 2006, 02:45:50 PM »
..have we been trying to solve a problem that doesn't exist?
I think so, but it was fun.

I don't think I am explaining clear enough.  I have three drawings with only one xref attached each.  A has B, B has C, and C has A.  If you check each drawing through the block collection, and then go to the next drawing if it's an xref, then in A you will go to B, and once in B you will go to C, and then once in C you will go to A, and then repeat until escape is hit.  I'm not talking about having two of the three xref'ed into each other, which I gather you thought I meant from your latest post.  Sorry if I wasn't clear.  Like I said I don't think this would every happen, so I probably wouldn't code for it, it just looks possible from your code.  I tried to run it here to test it, but it crashed.  Maybe because I'm using blank drawing.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Attribute change
« Reply #46 on: January 04, 2006, 05:02:07 PM »
Tim, I created 3 drawings A B & C
In drawing C I referenced A, saved & closed C
In drawing B I referenced C, saved and closed B
In drawing A I referenced B and got the circular reference error that I posted.

Is this not what you described? This is with R2002, BTW.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Attribute change
« Reply #47 on: January 04, 2006, 05:11:20 PM »
Tim, I created 3 drawings A B & C
In drawing C I referenced A, saved & closed C
In drawing B I referenced C, saved and closed B
In drawing A I referenced B and got the circular reference error that I posted.

Is this not what you described? This is with R2002, BTW.

That is exactly what I was talking about.  That is weird because when I do it in mine I don't get that message.  The only thing I can think of that wuold affect it is, do you attach or overlay?  I use overlay.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Greg B

  • Seagull
  • Posts: 12417
  • Tell me a Joke!
Re: Attribute change
« Reply #48 on: January 04, 2006, 05:18:33 PM »
You all know how smart I am in this aspect, but reading through made me want to ask a question.

The routine is set up to find a certain attribute and change it to what you want.  In the case of the circular reference, once the routine changed the attribute value it would not find it again on the return circle and would then continue on?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Attribute change
« Reply #49 on: January 04, 2006, 05:26:31 PM »
The routine is set up to find a certain attribute and change it to what you want. In the case of the circular reference, once the routine changed the attribute value it would not find it again on the return circle and would then continue on?

It would find it again.  It looks for tag names, not attribute values.  It most likely will be in a different block.
They way Jeff did it:
It looks through the block collection
When if finds a block that has attributes, it checks to see if any of the attributes match the list of tag strings.
If it does, then it puts in the new value.
If it finds and xref, it starts to search the block collection of that xref repeating the steps above.

Then my quesion was what started the discussion on circular references.  If three (or more) drawings xref'ed each other, then it would stay in the loop forever until someone hit escape because it would seach the xref's that are found within xref's etc....

With Jeff's setup, it seems that that couldn't happen, but with mine it looks as if it could.

Hope that makes it a little clearer.?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Greg B

  • Seagull
  • Posts: 12417
  • Tell me a Joke!
Re: Attribute change
« Reply #50 on: January 04, 2006, 05:28:59 PM »
Ok...what does Jeff's routine look for that breaks the circle?

I would assume you add something to the nature of an IF THEN statement so it looks for specific strings within the block.  Would make the routine more widely useable by more then one person.  Nothing hard coded.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Attribute change
« Reply #51 on: January 04, 2006, 05:35:34 PM »
Ok...what does Jeff's routine look for that breaks the circle?
Nothing.  Just that the way his Acad is set up, it won't let that situation happen.  You could add some stuff to it to check it, but the OP doesn't need it.  And it is pretty unlikely that the instance I mentioned would happen.  The way he set it up is to look through the block collection.  Once it looks at all the information stored there, then it finishes by itself.

I would assume you add something to the nature of an IF THEN statement so it looks for specific strings within the block. Would make the routine more widely useable by more then one person. Nothing hard coded.
What comes to mind first, would be to set up a list of all the draiwngs that it checks, if the xref is in the list, then don't proceed with checking, if it's not, then add it, and proceed to check it.  That is how I think I would do it.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Attribute change
« Reply #52 on: January 04, 2006, 05:53:22 PM »
What comes to mind first, would be to set up a list of all the draiwngs that it checks, if the xref is in the list, then don't proceed with checking, if it's not, then add it, and proceed to check it. That is how I think I would do it.
I thought about adding something like this since an Xfref can be inserted multiple times and there would be no need to edit the Xref drawing more than once. I just decided to let it go when I recalled seeing that the OP wasn't using Xrefs anyway. But it would be quite simple to add it just after the (setq file .....) line.