DXF: mark POLYLINE as 3d if any of the points have non-zero Z.

This commit follows 99d6f1f, which enabled export of Z coordinate
by using POLYLINE instead of LWPOLYLINE. After this commit, only
the AcDb2dPolyline/AcDb2dVertex are used when exporting flat views,
which may improve compatibility with 2d design packages.
This commit is contained in:
whitequark 2017-02-05 09:39:05 +00:00
parent 7c1ca46076
commit 59d4012800

View File

@ -261,11 +261,17 @@ public:
DRW_Polyline polyline; DRW_Polyline polyline;
assignEntityDefaults(&polyline, e->style); assignEntityDefaults(&polyline, e->style);
if(!(EXACT(start->pos.z == 0.0) && EXACT(next->pos.z == 0.0))) {
polyline.flags |= 8 /* 3d polyline */;
}
polyline.vertlist.push_back( polyline.vertlist.push_back(
new DRW_Vertex(start->pos.x, start->pos.y, start->pos.z, 0.0)); new DRW_Vertex(start->pos.x, start->pos.y, start->pos.z, 0.0));
polyline.vertlist.push_back( polyline.vertlist.push_back(
new DRW_Vertex(next->pos.x, next->pos.y, next->pos.z, 0.0)); new DRW_Vertex(next->pos.x, next->pos.y, next->pos.z, 0.0));
while(next->getNext(e->style, &next)) { while(next->getNext(e->style, &next)) {
if(!EXACT(next->pos.z == 0.0)) {
polyline.flags |= 8 /* 3d polyline */;
}
polyline.vertlist.push_back( polyline.vertlist.push_back(
new DRW_Vertex(next->pos.x, next->pos.y, next->pos.z, 0.0)); new DRW_Vertex(next->pos.x, next->pos.y, next->pos.z, 0.0));
} }