DXF: error reading hatch
Expected behavior and actual behavior.
I expected to be able to open this dxf test.zip and it returns an error message instead.
ERROR 1: /build/gdal-hKKMDX/gdal-2.3.2+1/drivers/vector/dxf/ogrdxf_hatch.cpp, 163: error at line 6084 of test.dxf
note: I stripped this file down from a 79MB dxf removing all customer data and other info. As a result it doesn't show anymore in Autodesk Trueview. The error however is still in the same block/line as it was in the original file
Steps to reproduce the problem.
ogrinfo test.dxf entities
Operating system
For example: Ubuntu 16.04.5 64 bit
GDAL version and provenance
GDAL 2.3.2, released 2018/09/21 from NextGIS Ubuntu ppa
With DraftSight I've stripped down another case resulting in one single object. This sample still shows in DraftSight, TrueView and Teigha Viewer.
The result of running ogrinfo error2.dxf entities > /dev/null ERROR 1: /build/gdal-GEMHj5/gdal-2.3.2+2/drivers/vector/dxf/ogrdxf_hatch.cpp, 517: error at line 808 of error2.dxf ERROR 1: /build/gdal-GEMHj5/gdal-2.3.2+2/drivers/vector/dxf/ogrdxf_hatch.cpp, 517: error at line 808 of error2.dxf ERROR 1: /build/gdal-GEMHj5/gdal-2.3.2+2/drivers/vector/dxf/ogrdxf_hatch.cpp, 517: error at line 808 of error2.dxf
The issue is that the HATCH boundary contains a spline segment with a sequence of 10,20,42,10,20,42,... group codes. GDAL is expecting the sequence to be 10,20,10,20,...,10,20,42,42,...,42, which is not what AutoCAD generates.
To be honest it looks like I just guessed how this was implemented when I coded 89cb8bafe, and never tested it :(
I'm not an expert either. I tried to read the dxf spec to figure out what is expected, but it is way to much reading ;)