Looking to change a block's secondary color when it changes layer

Looking to change a block's secondary color when it changes layer

smyler17
Explorer Explorer
1,489 Views
8 Replies
Message 1 of 9

Looking to change a block's secondary color when it changes layer

smyler17
Explorer
Explorer

I am looking for a function that,  when I move the block to 1 of 3 layers, changes the color of a portion of a block to a preset color that I specify. 

 

ie: I select layer 1, part of the block is set to color: 'by layer', then this portion of the block is colored in the layer 1 color.

Then I would like the other part of the block to be a different color than the layer color. 

 

Layer 1: Color Red, block secondary Yellow

Layer 2: Color Green, block secondary Magenta

Layer 3: Color Blue, block secondary Blue

 

(2 colors associated with a layer, an A and B. Maybe using an array to to store the color information?)

 

Would it be possible to learn this power?

smyler17_0-1603367777260.png

 

0 Likes
1,490 Views
8 Replies
Replies (8)
Message 2 of 9

pendean
Community Legend
Community Legend
you et that one element to BYLAYER and ensure those are the colors of your layers in question is how you'd do it with just blocks or dynamic blocks "automatically".

Otherwise you are asking for a feature not found yet in the forum you are asking in: try one of the customizations forums instead https://forums.autodesk.com/t5/autocad-customization/ct-p/AutoCADTopic1

HTH
0 Likes
Message 3 of 9

Anonymous
Not applicable

There are a couple ways you can do this.  The file attached has 2 blocks with each of the functionality.

 

With 3 options what might be the easiest is to create 3 visibility states (you could name them Layer1, Layer2, Layer3).  Copy the item 3 times.  Each set will have it's own lines.

1.  Easiest.  Each line in the visibility state the colors are set for you (you could just have these on the same layer and manually change the colors to avoid extra nested layers in your project).  Pick the visibility layer and set the colors.  Copy the block. Pick the Layer from the Visibility Drop down and it will change colors.

(you'll have to do this anyways in 2nd Item)

2. (Going this route you have to manually change 2 items for the block. Much more of a pain.)

Set the lines that will define the color based on layer within the project to "0" This will be your primary color.  Then in the block create a Layer1 Secondary, Layer2 Secondary, Layer3 Secondary with the appropriate colors.  Within each Visibility State set the Secondary lines to the appropriate layer.

(This route you will have to match the Visibility State to the Layer your on.  1 more step of confusion.)

As said previously, there isn't a way to tie them together.  At least not that I'm aware of.  This would be a nice feature.

 

0 Likes
Message 4 of 9

smyler17
Explorer
Explorer

Yes Brian, 

 

We were trying to avoid using the visibility layers if possible. Many of the employees burst the bock when using and apply the colors that way. 

 

Preferably, the visibility state would change when the layer changes. That would be the easiest fix. But I may have to post that in the dream forum.

 

The quest for efficiency has led me to a wall. 

0 Likes
Message 5 of 9

smyler17
Explorer
Explorer

Yes, we have the by layer function for the lines on the side. I was looking for a way to add a second color by layer that would be different than the layer's color.

Unfortunately, a visibility state would be best for this feature, but the people here explode the block instead. 

 

I will post to the forum you recommend.

0 Likes
Message 6 of 9

MMcCall402
Mentor
Mentor

Set some elements of the block to be ByLayer and others to be ByBlock.  Seems like that should do it.

 

Another option would be to have three copies of the secondary color objects, each in the their own color, and then use a visibility state parameter to select between them.

Mark Mccall 
CAD Mangler


EESignature


VHB - Vanasse Hangen Brustlin, Inc.


Linkedin

0 Likes
Message 7 of 9

smyler17
Explorer
Explorer

The issue with the ByBlock setting is forcing people to remember the colors we use. The colors above are for example of how the results should be. 

 

Then the issue with visibility states is that no one uses them and explodes the block. A mild conundrum.

 

I went down a rabbit hole yesterday trying to use the block's layer to test against a set of layer names. If a match was found, it would use the lookup table to display the correct visibility state.

 

My basic idea:

field: block layer = layer name => display: visibility state

 

Unfortunately, referencing the block's layer is loop or I am using the wrong function to test if the layer is true. 

 

I thought I was on to something.

0 Likes
Message 8 of 9

MMcCall402
Mentor
Mentor

You're probably already aware of this, but in the block editor you can prevent the block from being exploded by setting the Allow Exploding to "No".

 

As soon as you make if fool proof they release a new version of fools.  :oP

Mark Mccall 
CAD Mangler


EESignature


VHB - Vanasse Hangen Brustlin, Inc.


Linkedin

Message 9 of 9

smyler17
Explorer
Explorer

Yes, they get more advanced. 

 

May need to find out how to password protect the block too when they get too curious.

 

I appreciate your help. 

0 Likes