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

This commit follows 41365c5, 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.
pull/200/head
whitequark 2017-02-05 09:39:05 +00:00
parent baf9dc0aae
commit 4260be2445
2 changed files with 8 additions and 1 deletions

@ -1 +1 @@
Subproject commit 8f958955f54668c142ded760dc951ffd16d9c71b
Subproject commit 3475a9bf811afddde7d0638fbcc2b0200d542b07

View File

@ -129,6 +129,10 @@ public:
hStyle hs = { e->kind };
polyline = {};
assignEntityDefaults(&polyline, hs);
if(!(EXACT(start->pos.z == 0.0) && EXACT(next->pos.z == 0.0))) {
polyline.flags |= 8 /* 3d polyline */;
}
polyline.vertlist.push_back(
new DRW_Vertex(start->pos.x, start->pos.y, start->pos.z, 0.0));
polyline.vertlist.push_back(
@ -136,6 +140,9 @@ public:
};
auto nextFunc = [&](PolylineBuilder::Vertex *next, PolylineBuilder::Edge *e) {
if(!EXACT(next->pos.z == 0.0)) {
polyline.flags |= 8 /* 3d polyline */;
}
polyline.vertlist.push_back(
new DRW_Vertex(next->pos.x, next->pos.y, next->pos.z, 0.0));
};