Set Layer
Purpose
The Set Layer function is used to delimit a group of opcodes. This group can then be operated on as a unit at a later time.
Syntax
Opcode format | Opcode | Operand Format | Comments |
Extended ASCII | (Layer | <ws><ILayerNum>[<ws><TLayerName>]) | Establishes which layer the following primitives will belong to. |
LayerNum The layer number which will be assigned to the geometric primitives that are subsequently created. The legal range is from 0 to 32,767.
LayerName An optional ASCII text string that names the layer number specified.
Details
Opcodes in a .dwf file can be assigned to a specific layer, which is a grouping of opcodes that can later be turned visible or invisible by the DWF reading application. For example, in an architectural drawing, multiple layers can be used for the electrical, plumbing, and structural parts of building. The user of a DWF reading application can then select which layers to view interactively.
A layer attribute is attached to a specific set of opcodes by surrounding them with a pair of Set Layer opcodes: the first with a LayerNum specified and the second with a null LayerNum:
L 0,0 15,15 By default layer 0 is active, which is always visible.
(Layer 1 Electrical) The layer will be attached to subsequent geometry.
L 10,10 35,35 This line is attached to layer 1, the Electrical layer.
L 0,10 30,30 This line is attached to layer 1, the Electrical layer.
(Layer 0) Subsequent geometry will use the default layer 0.
L 0,20 20,20 This line is on layer 0, which is always visible.
As with other attributes, only one layer is active at a time. If a layer is active in a .dwf file and a second layer is specified, only the later layer applies to subsequent geometric primitives.
Notes
A geometric primitive has a maximum of one layer attached to it.
Layer number zero is a special layer that is always on and visible.
By default all layers (zero through 32,767) are on and thus visible. If it is desired that a layer be normally off (invisible), then a Set Layer State (TBD) opcode should proceed any geometric primitives contained in that layer.
Layers do not affect the drawing order of geometric primitives. It is possible to have two layers where some primitives of the first layer are drawn before some primitives of the second layer and vice versa. To accomplish this, return to a given layer after selecting another layer. For example, three lines are drawn in the order in which they appear in the file:
(Layer 1 Electrical) Layer 1 is attached to subsequent geometry.
L 10,10 35,35 This line is attached to layer 1, the Electrical layer.
(Layer 2 Plumbing) Subsequent geometry uses layer 2.
L 0,20 20,20 This line is on layer 2, the Plumbing layer.
(Layer 1) Return to layer 1.
L 10,10 35,35 This line is attached to layer 1, the Electrical layer.
A URL may be attached to geometric primitives that are invisible, see the Set URL Link and Set Visibility functions. Although such primitives are not displayed, they may still be selected by the user (with the mouse) to execute a URL. However, the state of a layer (either on or off, selected by the Set Layer State opcode - TBD) takes precedence over the "Visibility" attribute of primitives. If a primitive belongs to a layer whose state is off, then the "Visibility" attribute does not matter, and the user cannot select these URLs. (Set Layer State is still TBD)
Default
The default layer is layer 0 and is equivalent to
(Layer 0 'Default Layer')
Implementation in WHIP! Versions
Toolkit Function |
TBD |
Partial |
Full |
Revised in |
Set Layer | - | - | - | - |
See Also
Set Layer State (TBD), Set URL Link, and Set Visibility