Saving DxfDocument including a certain dimension causes error.
There is a Dimension that causes an error when adding and saving to DxfDocument.(dimension.dxf)
The error reproduction code is as follows.
static void Main(string[] args)
{
DxfDocument dxffile = new DxfDocument();
string debugfile = "C:\\tmp\\dimension.dxf";
DxfDocument a = DxfDocument.Load(debugfile);
var dimensions = a.Dimensions.ToList();
List<EntityObject> tmp = new List<EntityObject>();
foreach (netDxf.Entities.Dimension dim in dimensions)
{
netDxf.Entities.Dimension c = (netDxf.Entities.Dimension)dim.Clone();
c.Block = (Block)dim.Block.Clone();
tmp.Add(c as EntityObject);
}
dxffile.AddEntity(tmp);
a.Save(@"C:\tmp\AfterDimension.dxf");
}
note: To try the sample code, create a folder named 'tmp' directly under the C drive in advance to store the sample dxf file 'dimension.dxf'.
dimension.zip
There is an error on line 3532 of DxfWriter.cs.
case DimensionStyleOverrideType.FitOptions:
xdataEntry.XDataRecord.Add(new XDataRecord(XDataCode.Int16, (short) 289));
xdataEntry.XDataRecord.Add(new XDataRecord(XDataCode.Int16, (short) styleOverride.Value));
I tentatively changed the code as follows, the error will not occur.(I don't think this is the right change...)
Saving DxfDocument including a certain dimension causes error.
There is a Dimension that causes an error when adding and saving to DxfDocument.(dimension.dxf) The error reproduction code is as follows.
note: To try the sample code, create a folder named 'tmp' directly under the C drive in advance to store the sample dxf file 'dimension.dxf'. dimension.zip
There is an error on line 3532 of DxfWriter.cs.
I tentatively changed the code as follows, the error will not occur.(I don't think this is the right change...)
Would you please confirm if it's a code bug?