Opened 8 years ago
Closed 8 years ago
#6460 closed defect (invalid)
ogr save dxf file,autocad don‘t open
Reported by: | mmtxcp | Owned by: | warmerdam |
---|---|---|---|
Priority: | highest | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | major | Keywords: | |
Cc: |
Description
I use GDAL to read the DXF file, and then save as a DXF file, the use of AutoCAD 2014 failed to open, but QCAD, ArcGIS can be opened correctly. With test code (above gdal2.0 version) and DXF original documents and generate the results of the DXF file.
Attachments (4)
Change History (9)
by , 8 years ago
by , 8 years ago
by , 8 years ago
Attachment: | result1.dxf added |
---|
by , 8 years ago
Attachment: | screen.png added |
---|
comment:1 by , 8 years ago
Version: | → unspecified |
---|
comment:3 by , 8 years ago
Can you generate a proper patch with svn diff or diff -u for your proposed correction ?
comment:4 by , 8 years ago
Actually re-reading, I think the issue comes from your code. You call directly CreateFeature() from the feature got from the source dataset. And particularly you inherit from its FID. You should unset the FID with pFeature->SetFID(-1); in your own code. I'm not sure why not using the source FID doesn't work however but there are a few comments in the DXF driver about issues with FID (OGRDXFWriterLayer::WriteCore())
comment:5 by , 8 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Closing, assuming this was a mis use of the API
The reason is that the following functions lead to OGRDXFWriterDS: long: WriteEntityID (*fpIn VSILFILE, nPreferredFID long), the feature DXF access to the ID is a value, and the TranslateGenericProperty function within the 5: case PoFeature->SetField ("EntityHandle", pszValue); storage is not a ID, resulting in re write DXF, the coding error occurs! The solution is to write feature before setting the ID to -1 (pFeature->SetFID (-1);)