Beginner : How to store DXF data
Posted: Wed Jul 18, 2007 8:26 am
Hello,
First, I would like to Thank Andrew for Qcad. It is a really great software.
I am a nearly total beginner in C++ programming.
Starting with the "test" source code of dxflib, I am trying to store the datas of a dxf file composed of 217 lines.
So I modified test_creationclass.h this way :
And test_creationclass.cpp this way :
But when I run it, it segfaults at the end, because of this :
By further investigation, I saw that it jumps over the line 151 of the dxf file.
Would someone have an idea of what is happening ??
Thanks a lot.
First, I would like to Thank Andrew for Qcad. It is a really great software.
I am a nearly total beginner in C++ programming.
Starting with the "test" source code of dxflib, I am trying to store the datas of a dxf file composed of 217 lines.
So I modified test_creationclass.h this way :
Code: Select all
class Test_CreationClass : public DL_CreationAdapter {
public:
int NbLine;
double OLx1[500];
double OLy1[500];
double OLx2[500];
double OLy2[500];
Test_CreationClass();
virtual void addLayer(const DL_LayerData& data);
virtual void addPoint(const DL_PointData& data);
virtual void addLine(const DL_LineData& data);
virtual void addArc(const DL_ArcData& data);
virtual void addCircle(const DL_CircleData& data);
virtual void addPolyline(const DL_PolylineData& data);
virtual void addVertex(const DL_VertexData& data);
void printAttributes();
};
Code: Select all
void Test_CreationClass::addLine(const DL_LineData& data) {
printf("LINE (%6.3f, %6.3f, %6.3f) (%6.3f, %6.3f, %6.3f) ligne : %d\n",
data.x1, data.y1, data.z1, data.x2, data.y2, data.z2, NbLine + 1);
OLx1[NbLine]=data.x1;
OLy1[NbLine]=data.y1;
OLx2[NbLine]=data.x2;
OLy2[NbLine]=data.y2;
NbLine+=1;
}
Code: Select all
OLx1[NbLine]=data.x1;
OLy1[NbLine]=data.y1;
OLx2[NbLine]=data.x2;
OLy2[NbLine]=data.y2;
Would someone have an idea of what is happening ??
Thanks a lot.