netDxf icon indicating copy to clipboard operation
netDxf copied to clipboard

DXF saved in AutoCAD 2000 format cannot be loaded

Open kyosukeSakurai opened this issue 3 years ago • 3 comments

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 avatar May 28 '21 12:05 kyosukeSakurai

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

kyosukeSakurai avatar Jun 06 '21 05:06 kyosukeSakurai

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 avatar Jun 10 '21 15:06 haplokuon

It should work now once again.

haplokuon avatar Jun 20 '21 15:06 haplokuon