Skip to content

Commit

Permalink
header color index fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DomCR committed Aug 15, 2024
1 parent ed0b790 commit 582573f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/ACadSharp.Tests/IO/WriterSingleObjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,26 @@ public void EntityColorTrueColor()
this.Document.Entities.Add(c);
}

public void EntityColorByIndex()
{
Circle c = new Circle();
c.Center = new XYZ(0, 0, 0);
c.Radius = 10;
c.Color = new Color(11);

this.Document.Entities.Add(c);
}

public void CurrentEntityColorTrueColor()
{
this.Document.Header.CurrentEntityColor = Color.FromTrueColor(1151726);
}

public void CurrentEntityByIndex()
{
this.Document.Header.CurrentEntityColor = new Color(11);
}

public void SingleLine()
{
Line line = new Line(XYZ.Zero, new XYZ(100, 100, 0));
Expand Down Expand Up @@ -295,7 +310,9 @@ static WriterSingleObjectTests()
Data.Add(new(nameof(SingleCaseGenerator.SingleMLine)));
Data.Add(new(nameof(SingleCaseGenerator.EntityColorByLayer)));
Data.Add(new(nameof(SingleCaseGenerator.EntityColorTrueColor)));
Data.Add(new(nameof(SingleCaseGenerator.EntityColorByIndex)));
Data.Add(new(nameof(SingleCaseGenerator.CurrentEntityColorTrueColor)));
Data.Add(new(nameof(SingleCaseGenerator.CurrentEntityByIndex)));
Data.Add(new(nameof(SingleCaseGenerator.DefaultLayer)));
Data.Add(new(nameof(SingleCaseGenerator.LayerTrueColor)));
Data.Add(new(nameof(SingleCaseGenerator.SingleMText)));
Expand Down
5 changes: 5 additions & 0 deletions src/ACadSharp/IO/DWG/DwgStreamWriters/DwgStreamWriterAC18.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public override void WriteCmColor(Color value)
arr[0] = (byte)value.B;
arr[3] = 0b1100_0010;
}
else if (value.IsByLayer)
{
arr[3] = 0b11000000;
arr[0] = (byte)value.Index;
}
else
{
arr[3] = 0b1100_0011;
Expand Down

0 comments on commit 582573f

Please sign in to comment.