Tutorial: Layers, Blocks and Attributes

This tutorial explains the effect that layers and blocks have on an entity's attributes (color, linetype, lineweight).

Contents

 

Introduction

In CAD, entity attributes are usually controlled by the layer an entity resides on. If an entity is on a red layer, the entity is red, if it's on a blue layer, the entity is blue, etc.

This is not only true for entities in the main drawing but also for entities that are inside a block. This is important as there might be entities on various layers with various attributes in the same block. The block might be inserted on various layers which does not (and should not) affect the attributes of the individual entities inside the block.

There are, however, situations in which an entity should take on the attribute of the layer on which the block has been inserted. This situation is covered by the "By Block" attribute value available for entities.  

Example

Consider the example drawing below which consists of one single block reference. The block reference is placed on layer "2":

The block definition contains four texts and some line entities on various layers with various attributes:

  • The first triangle and text at the top is placed on layer "0".
    Its color property of these entities is set to "Green".
    This means that this text and triangle will always be displayed in green. These entities have a fixed color.
  • The second triangle and text reside on layer "1".
    Their color property is set to "By Layer".
    Since layer "1" has its color set to "red", these entities are displayed in red. The layer the block reference is placed on is irrelevant. 
  • The third triangle and text reside on layer "2" which is blue.
    They too have their color property set to "By Layer" which means these entities also inherit their color from the layer they are on, in this case blue.
  • The bottom triangle and text are also on layer "2".
    They have their color property set to "By Block".
    These entities don't inherit their color from the layer they are on ("2") but rather from the block reference they are in.
    In this example, the block reference is placed on layer "2" and has its color property set to "By Layer".
    The color of these entities is determined as follows:
    1. QCAD looks at the color property which is "By Block".
    2. QCAD looks up the block reference and sees that its color property is "By Layer".
    3. QCAD looks up the layer the block reference is placed on, that's layer "2".
    4. QCAD renders the entities using the color of layer "2" (red).

If we move the block reference to a different layer or set the color of the block reference to a fixed color (instead of "By Layer"), the entities with color attribute set to "By Block" change their color accordingly.

In this example, the block reference resides on an orange layer or has its color property set to "orange":

Notes

The property values "By Layer" and "By Block" are not only available for colors but also for the other entity attributes lineweight and linetype. These attribute behave in the same way.