diff --git a/src/ACadSharp/Tables/Layer.cs b/src/ACadSharp/Tables/Layer.cs index 354bcd1a..dd756bea 100644 --- a/src/ACadSharp/Tables/Layer.cs +++ b/src/ACadSharp/Tables/Layer.cs @@ -46,10 +46,22 @@ public class Layer : TableEntry /// if the index is negative, layer is off /// [DxfCodeValue(62, 420, 430)] - public Color Color { get; set; } = new Color(7); + public Color Color + { + get { return this._color; } + set + { + if (value.IsByLayer || value.IsByBlock) + { + throw new ArgumentException("The layer color cannot be ByLayer or ByBlock", nameof(value)); + } + + this._color = value; + } + } /// - /// The linetype of an object. The default linetype is the linetype of the layer (ByLayer). + /// The line type of an object. The default line type is the line type of the layer (ByLayer). /// [DxfCodeValue(DxfReferenceType.Name, 6)] public LineType LineType @@ -80,7 +92,7 @@ public LineType LineType public bool PlotFlag { get; set; } = true; /// - /// Specifies the lineweight of an individual object or the default lineweight for the drawing. + /// Specifies the line weight of an individual object or the default line weight for the drawing. /// [DxfCodeValue(370)] public LineweightType LineWeight { get; set; } = LineweightType.Default; @@ -104,6 +116,8 @@ public LineType LineType private LineType _lineType = LineType.Continuous; + private Color _color = new Color(7); + internal Layer() : base() { } public Layer(string name) : base(name) { }