Re: Can not open saved dxf file

Posted by LordOfBikes on
URL: https://forum.librecad.org/Can-not-open-saved-dxf-file-tp5709150p5709166.html

Hi,

on Windows I can open both files.

@dxli:
I've seen a problem in the DXF files. Look at the group codes 5, they are written with a 2 digit hex value. With a hex editor you can see, that these hex values are followed by 7 0x00 bytes before the line feed.
Think this is caused by the dxfRW::toHexStr(int n) in libdxfrw.cpp, lines 2662ff. The 2 hex digit plus the 7 zero bytes are the buffer size of the toHexStr() method. The method works different on OSX, because of the __APPLE__ define.
As I can see, the logic behind the code is OK, I would expect, that the processing of the buffer should stop at the first zero byte. This implies the assumption that it is a library issue on OSX.

As I can open the files without exception on Windows, this DXF writing issue must not be the cause for the crash on OSX. But it could be a similar bug on reading or processing the file.

Here are the files where I corrected the zero byte issue, can you please try to open them on OSX.
ElevtorWin.dxf
test_load_libreWin.dxf

Armin

investing less than half an hour into Search function can save hours or days of waiting for a solution