From 4260be2445fb9ee93a9fab312c1f5c8fc5e9e281 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 5 Feb 2017 09:39:05 +0000 Subject: [PATCH] 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. --- extlib/libdxfrw | 2 +- src/exportvector.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/extlib/libdxfrw b/extlib/libdxfrw index 8f958955..3475a9bf 160000 --- a/extlib/libdxfrw +++ b/extlib/libdxfrw @@ -1 +1 @@ -Subproject commit 8f958955f54668c142ded760dc951ffd16d9c71b +Subproject commit 3475a9bf811afddde7d0638fbcc2b0200d542b07 diff --git a/src/exportvector.cpp b/src/exportvector.cpp index aa8fed13..5ab335d0 100644 --- a/src/exportvector.cpp +++ b/src/exportvector.cpp @@ -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)); };