[solved] Writing XDATA accepted by QCAD/CAM
Posted: Fri Mar 26, 2021 10:08 am
I know that the current DXF-Lib version (3.17.0) doesn't support writing XDATA (see https://qcad.org/rsforum/viewtopic.php? ... data#p9180). We are using the nesting functionality of QCAD/CAM and for some extent we have to supply the drawing entities we want to be nested with some app specific extra data. So I tried to implement the XDATA writing outside DXF lib in our code. Every time I write a drawing entity, I append a XDATA section before ending the entity in the way like (using export version for writing):
As the DXF format reference suggests, our APP ID is registered in a seperate TABLE section directly after the HEADER section and before the ENTITY section:
This results in a DXF file as expected with an XDATA section at the end of each drawing entity and an app register section after the HEADER (see the attached "id_test.dxf" file which contains 1 polyline entity representing an arc).
The import into QCAD only works with the file type "DXF Files [dxflib]", the import with file type "All CAD Files [OpenDesign]" results in an import error. But with the [dxflib] import the XDATA is obviously ignored (the XDATA is not displayed in the "Custom" section of the proeprty editor), and after saving back the drawing by QCAD, the APP ID registering and the entity XDATA has been removed from the DXF file (see attached "id_test_qcad.dxf")
So my question is if there exists a possibility with dxflib to write entity XDATA in a way that QCAD accepts it and keeps it also when the DXF file is saved back again by QCAD? If yes, how has the written data to be structured?
Thanks in advance for any help!
Code: Select all
DL_Codes::AC1015
Code: Select all
...
m_dxf.writePolyline(*dw, polyline, m_cAtttribute);
DL_VertexData vertex;
....
// adding the vertex data
....
// write entity ID
dw->dxfString(1001, "digMAR"); //starts extended data section
dw->dxfString(1000, str.toStdString());
m_dxf.writePolylineEnd(*dw);
Code: Select all
...
dw->sectionTables(); // start tables section
// // register our APP-ID
dw->tableAppid(1); // start registered APPID table
d->m_dxf.writeAppid(*dw, "digMAR");
dw->tableEnd(); // table end
dw->sectionEnd();
...
The import into QCAD only works with the file type "DXF Files [dxflib]", the import with file type "All CAD Files [OpenDesign]" results in an import error. But with the [dxflib] import the XDATA is obviously ignored (the XDATA is not displayed in the "Custom" section of the proeprty editor), and after saving back the drawing by QCAD, the APP ID registering and the entity XDATA has been removed from the DXF file (see attached "id_test_qcad.dxf")
So my question is if there exists a possibility with dxflib to write entity XDATA in a way that QCAD accepts it and keeps it also when the DXF file is saved back again by QCAD? If yes, how has the written data to be structured?
Thanks in advance for any help!