LWPOLYLINE elevation value not read
Posted: Mon Mar 16, 2009 4:33 am
Hi, I also submitted a bug for this but I thought I should post here so other uses may benefit.
I was able to fix this bug by changing the DL_Dxf::addPolyline() method. The DXF specification on LWPOLYLINE (http://www.autodesk.com/techpubs/autoca ... _u05_c.htm) states that group code 38 is for elevation. DXF Lib was assuming it was the same group code as POLYLINE entity (30). Here is the modified source:
I was able to fix this bug by changing the DL_Dxf::addPolyline() method. The DXF specification on LWPOLYLINE (http://www.autodesk.com/techpubs/autoca ... _u05_c.htm) states that group code 38 is for elevation. DXF Lib was assuming it was the same group code as POLYLINE entity (30). Here is the modified source:
Code: Select all
/**
* Adds a polyline entity that was read from the file via the creation interface.
*/
void DL_Dxf::addPolyline(DL_CreationInterface* creationInterface) {
if (currentEntity==DL_ENTITY_POLYLINE) {
DL_PolylineData pd(maxVertices, toInt(values[71], 0), toInt(values[72], 0), toInt(values[70], 0), toReal(values[30]));
creationInterface->addPolyline(pd);
} else if (currentEntity==DL_ENTITY_LWPOLYLINE) {
DL_PolylineData pd(maxVertices, toInt(values[71], 0), toInt(values[72], 0), toInt(values[70], 0), toReal(values[38]));
creationInterface->addPolyline(pd);
for (int i=0; i<maxVertices; i++) {
DL_VertexData d(vertices[i*4],
vertices[i*4+1],
vertices[i*4+2],
vertices[i*4+3]);
creationInterface->addVertex(d);
}
creationInterface->endEntity();
}
}