haplokuon / netDxf

.net dxf Reader-Writer
MIT License
1.01k stars 410 forks source link

DXF saved in AutoCAD 2000 format cannot be loaded #286

Open kyosukeSakurai opened 3 years ago

kyosukeSakurai commented 3 years ago

DXF saved in AutoCAD 2013 format can be loaded with the Load method of the DxfDocument class. However, the latest netDXF throws an exception when trying to load DXF saved in AutoCAD 2000 format with Load. We want to load DXF saved in AutoCAD 2000 format, but we are havtmp.zipng trouble loading it. I want you to be able to load DXF in AutoCAD 2000 format. Earlier versions (probably netDxf 2.4.0) were able to load.

The following is a reproduction sample code and dxf files.

"AC1015.dxf" is the DXF saved in AutoCAD 2000 format, and "AC1027.dxf" is the DXF saved in AutoCAD 2013 format. note: To try the sample code, create a folder named 'tmp' directly under the C drive in advance to store the sample dxf file.

tmp.zip

Sample code:

static void Main(string[] args) 
{
    // Successes loading.
    var dxfDocument = netDxf.DxfDocument.Load(@"C:\tmp\AC1027.dxf");
    // Throws exception.
    var dxfDocument = netDxf.DxfDocument.Load(@"C:\tmp\AC1015.dxf");
}
kyosukeSakurai commented 3 years ago

Isn't it affected by the fact that the Shift-JIS (character code) processing code has been deleted in the latest version?

DxfReader.cs public DxfDocument Read(Stream stream, IEnumerable supportFolders)

image

haplokuon commented 3 years ago

I am aware of this. It is still a work in progress, with at least the net standard, net core versions, the encoding code pages need special attention. So use version AutoCad2007 (AC1021) and upwards they are saved as UTF-8, or stick to netDxf 2.4.2.

haplokuon commented 3 years ago

It should work now once again.