Class DxfLayerTableRecord
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
A layer of a DXF file, as AutoCAD's LayerTableRecord: its name, the colour, linetype and lineweight its
entities take where they say BYLAYER, and whether it is off, frozen, locked and plotted.
public sealed class DxfLayerTableRecord : DxfSymbolTableRecord
- Inheritance
-
DxfLayerTableRecord
- Inherited Members
Remarks
A layer of the file is read from its LAYER record and changed by its setters, its record written anew, every other group kept as it was; a setter given the value its getter gives changes nothing. The layer steel in red, turned off, is written as the colour -1: it is ColorIndex 1 and IsOff true.
A layer made in code is in the colour 7, with the linetype Continuous, its lineweight the default, on, thawed, unlocked and plotted until it is given others, and is written when it is added to a DxfLayerTable.
A layer of a file is renamed by its Name, every reference to it with it, and erased
by Erase() where nothing is drawn on it: the layer steel renamed Steel_S355 has every entity of it, in model
space, paper space and the blocks, its vertices and attributes among them, on Steel_S355, and $CLAYER too where
it was the current layer.
Constructors
- DxfLayerTableRecord()
Initializes a layer made in code, to be added to a DxfLayerTable with its Name given.
Properties
- Color
Gets or sets the colour of the layer, as AutoCAD's
Color: its true colour (420, its book's name 430) where it has one, else the colour of its index (62), whether the layer is on or off. It agrees with ColorIndex and TrueColor; a true colour carries the index nearest it, as FromRgb(byte, byte, byte) gives it.
- ColorIndex
Gets or sets the colour of the layer (group 62), as AutoCAD's
Colorby its index: 1 to 255, whether the layer is on or off; 7 where the record gives none or one outside that.
- Description
Gets or sets the description of the layer, as AutoCAD's
Description, kept as AutoCAD keeps it: the second 1000 of the layer's extended data of the applicationAcAecLayerStandard, after an empty one; empty where it has none.
- HasOverrides
Gets whether the layer looks otherwise in some viewport, as AutoCAD's
HasOverrides: whether an XRECORD of its extension dictionary that AutoCAD keeps overrides in (ADSK_XREC_LAYER_COLOR_OVR, ADSK_XREC_LAYER_LINETYPE_OVR, ADSK_XREC_LAYER_LINEWT_OVR, ADSK_XREC_LAYER_ALPHA_OVR, ADSK_XREC_LAYER_PLOTSTYLE_OVR) names a viewport.
- IsFrozen
Gets or sets whether the layer is frozen (flag 1 of group 70): its entities are not drawn.
- IsLocked
Gets or sets whether the layer is locked (flag 4 of group 70): its entities are drawn and cannot be changed in AutoCAD.
- IsOff
Gets or sets whether the layer is turned off, which the table writes as a colour below nought: its entities are not drawn, and are still regenerated.
- IsPlottable
Gets or sets whether the layer is plotted (group 290); true where the record does not say.
- IsUsed
Gets whether the layer is in use, as AutoCAD's
IsUsedafter GenerateUsageData(): layer 0, Defpoints and the current layer ($CLAYER) always; any other where an entity is on it, in model space, paper space or a block, a vertex or an attribute among them, those added since the drawing was opened too. The layers in use are worked out in one walk of the drawing and kept until it next changes, so that reading it for 400 layers walks it once; false for a layer made in code.
- LineWeight
Gets or sets the lineweight of the layer (group 370); ByLineWeightDefault where the record gives none.
- LinetypeName
Gets or sets the name of the layer's linetype (group 6), as the file spells it; Continuous where the record gives none.
- PlotStyleName
Gets or sets the name of the plot style of the layer, as AutoCAD's
PlotStyleName: the entry of the drawing's plot style names (ACAD_PLOTSTYLENAME) its group 390 points at, as Normal; empty where it points at none or the layer is made in code and not added yet. A drawing plotted by colour (PlotStyleMode) names its plot styles by the layer's colour (Color_30 for the colour 30), which the record does not keep: the entry it points at is still Normal there.
- Transparency
Gets or sets how much the layer's entities by layer let show through them, as AutoCAD's
Transparency, kept as AutoCAD keeps it: the 1071 of the layer's extended data of the applicationAcCmTransparency, 0x020000TT; solid, the alpha 255, where it has none.
- TrueColor
Gets or sets the colour of the layer as red, green and blue (group 420), 0xRRGGBB; null where it has none.
- ViewportVisibilityDefault
Gets or sets whether the layer is frozen in each viewport made from now on (flag 2 of group 70), as AutoCAD's
ViewportVisibilityDefault, its VPDFLT: true where new viewports freeze it.
Methods
- Erase()
Erases the layer from its table, as AutoCAD's
Eraseof a layer no entity is on: its LAYER record taken out, the table's count lowered by one, its handle not given again and what it owned, as its extension dictionary, removed with it when the file is saved.
- GetViewportOverrides(DxfViewport)
Gets how the layer looks in a viewport, as AutoCAD's
GetViewportOverrides: its colour, linetype, lineweight and transparency there, each the override the layer's extension dictionary keeps for the viewport, else the layer's own.
- HasViewportOverrides(DxfViewport)
Gets whether the layer looks otherwise in a viewport, as AutoCAD's
HasViewportOverrides.
- RemoveAllOverrides()
Takes out every override of the layer in the viewports, as AutoCAD's
RemoveAllOverrides: the XRECORDs of its extension dictionary that hold them, each with its entry; nothing where it has none.
- RemoveViewportOverrides(DxfViewport)
Takes out the overrides of the layer in one viewport, as AutoCAD's
RemoveViewportOverrides: the viewport's list of each XRECORD that holds one, an XRECORD left with none taken out with its entry; those of the other viewports kept. Nothing where it has none there.
- SetDependent(bool, bool)
Marks the layer as one an external reference brings, as AutoCAD writes the layers of an external reference into the drawing that attaches it: flag 16 of group 70 where it comes from one, and 32 as well where that reference is resolved; AutoCAD 2021 writes 48 for the layer
grid|WALLof a drawing attached and loaded, and 16 once it is unloaded.