diff --git a/src/ACadSharp.Tests/IO/WriterSingleObjectTests.cs b/src/ACadSharp.Tests/IO/WriterSingleObjectTests.cs index 0a9e7427..04f54c9b 100644 --- a/src/ACadSharp.Tests/IO/WriterSingleObjectTests.cs +++ b/src/ACadSharp.Tests/IO/WriterSingleObjectTests.cs @@ -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)); @@ -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))); diff --git a/src/ACadSharp/IO/DWG/DwgStreamWriters/DwgStreamWriterAC18.cs b/src/ACadSharp/IO/DWG/DwgStreamWriters/DwgStreamWriterAC18.cs index 577052ce..6bde842a 100644 --- a/src/ACadSharp/IO/DWG/DwgStreamWriters/DwgStreamWriterAC18.cs +++ b/src/ACadSharp/IO/DWG/DwgStreamWriters/DwgStreamWriterAC18.cs @@ -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;