Skip to content

Commit

Permalink
minor layer fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DomCR committed Oct 1, 2024
1 parent 468605f commit 752c269
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/ACadSharp/Tables/Layer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,22 @@ public class Layer : TableEntry
/// if the index is negative, layer is off
/// </remarks>
[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;
}
}

/// <summary>
/// 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).
/// </summary>
[DxfCodeValue(DxfReferenceType.Name, 6)]
public LineType LineType
Expand Down Expand Up @@ -80,7 +92,7 @@ public LineType LineType
public bool PlotFlag { get; set; } = true;

/// <summary>
/// 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.
/// </summary>
[DxfCodeValue(370)]
public LineweightType LineWeight { get; set; } = LineweightType.Default;
Expand All @@ -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) { }
Expand Down

0 comments on commit 752c269

Please sign in to comment.