I'm trying to generate a DWG file by creating a circle and assign it to a layer. Layer is created and circle is drawn. Layer to the circle has been assigned. But for some reason the Color of the circle is always set to "ByBlock". I tried in different ways to set to ByLayer, but didn't work. The following is the code I'm trying. The same code works in DXF but not DWG. Can you please suggest what needs to be changed?
CadDocument doc = new CadDocument();
string dwgFilePath = "Output.dwg";
Layer layer = new Layer("Test");
layer.Color = new Color(25);
doc.Layers.Add(layer);
Circle c = new Circle();
c.Center = new CSMath.XYZ(0, 0, 0);
c.Radius = 10;
c.Layer = layer;
c.Color = Color.ByLayer;
doc.ModelSpace.Entities.Add(c);
using (DwgWriter writer = new DwgWriter(dwgFilePath, doc))
{
writer.Write();
}
I'm trying to generate a DWG file by creating a circle and assign it to a layer. Layer is created and circle is drawn. Layer to the circle has been assigned. But for some reason the Color of the circle is always set to "ByBlock". I tried in different ways to set to ByLayer, but didn't work. The following is the code I'm trying. The same code works in DXF but not DWG. Can you please suggest what needs to be changed?