TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Woabow on March 05, 2012, 08:06:19 AM

Title: Temporarily change color of selected, multicolored blocks
Post by: Woabow on March 05, 2012, 08:06:19 AM
Maybe this is not the right place to ask (I assume lisp is needed), but is there a way to temporarily change the color of some instances of a block and go back later? The items in the block do contain multiple colors and layers and the layers should not change if possible.

The situation is this: when I have a drawing with Block1 inserted many times, I would like to change the color of all instances of Block1 in a certain area. After I'm finished I would like to change the color(s) of the block back to normal.

When the block items would have a single color it would be easy, but they don't. Maybe storing the original color in the items for restoring later? The blocks can be nested too.
Title: Re: Temporarily change color of selected, multicolored blocks
Post by: irneb on March 05, 2012, 11:38:09 AM
When you state "change block's colour" ... are the entities inside set to colour ByBlock?

Otherwise, changing the colours of the entities within the block will always update all instances of the block in one go. That's the point of a block - one definition, many instances.

If you want to force the issue, the only way i can figure something like this is to duplicate the block-definition to some temporary one. Then change the selected instances to that definition.
Title: Re: Temporarily change color of selected, multicolored blocks
Post by: Woabow on March 05, 2012, 12:54:25 PM
So there is no way whatsoever to overrule the color of a block? Assuming the entities in the block do have their own color and that I only want to change the color of blocks in a certain area.

 Creating temporarily duplicate blocks is maybe a solution, but I'm afraid it will create inefficient big drawings if not purged before every save.

Title: Re: Temporarily change color of selected, multicolored blocks
Post by: irneb on March 06, 2012, 01:45:43 AM
So there is no way whatsoever to overrule the color of a block? Assuming the entities in the block do have their own color and that I only want to change the color of blocks in a certain area.

Creating temporarily duplicate blocks is maybe a solution, but I'm afraid it will create inefficient big drawings if not purged before every save.
That's the problem yes. There's only 2 ways to affect individual references to different properties from the block definition:
Other than that, the temporary definition. You're correct about purging though.
Depending on what you want, the 2nd method above might do the trick. But that depends on the situation. If you could attach a sample DWG, I could try with that - hopefully there is a "simple" way.