DXF: Fix export of wireframe as 3D DXF.

Before this commit, polylines got flattened but all other entities
got exported with the proper Z coordinate. After this commit, all
entities are exported with proper Z coordinate.

Also, instead of exporting LWPOLYLINE (2d only), POLYLINE (2d/3d)
is exported; as a bonus it is more compatible with 3rd party
software, since it is older.
This commit is contained in:
whitequark 2016-11-26 08:17:20 +00:00
parent ece7630624
commit 99d6f1f5b5
2 changed files with 14 additions and 11 deletions

View File

@ -8,6 +8,7 @@ Bug fixes:
* Do not crash when applying a symmetry constraint to two points.
* Fix TTF font metrics again (properly this time).
* Fix the "draw back faces in red" option.
* Fix export of wireframe as 3D DXF.
* Various minor crashes.
2.2

View File

@ -259,14 +259,17 @@ public:
found = true;
e->tag = 1;
DRW_LWPolyline polyline;
DRW_Polyline polyline;
assignEntityDefaults(&polyline, e->style);
polyline.vertlist.push_back(new DRW_Vertex2D(start->pos.x, start->pos.y, 0.0));
polyline.vertlist.push_back(new DRW_Vertex2D(next->pos.x, next->pos.y, 0.0));
polyline.vertlist.push_back(
new DRW_Vertex(start->pos.x, start->pos.y, start->pos.z, 0.0));
polyline.vertlist.push_back(
new DRW_Vertex(next->pos.x, next->pos.y, next->pos.z, 0.0));
while(next->getNext(e->style, &next)) {
polyline.vertlist.push_back(new DRW_Vertex2D(next->pos.x, next->pos.y, 0.0));
polyline.vertlist.push_back(
new DRW_Vertex(next->pos.x, next->pos.y, next->pos.z, 0.0));
}
dxf->writeLWPolyline(&polyline);
dxf->writePolyline(&polyline);
}
if(!found && !loop) {
@ -479,16 +482,14 @@ public:
List<Vector> lv = {};
sb->MakePwlInto(&lv, SS.ExportChordTolMm());
hStyle hs = { (uint32_t)sb->auxA };
DRW_LWPolyline polyline;
DRW_Polyline polyline;
assignEntityDefaults(&polyline, hs);
for(int i = 0; i < lv.n; i++) {
Vector *v = &lv.elem[i];
DRW_Vertex2D *vertex = new DRW_Vertex2D();
vertex->x = v->x;
vertex->y = v->y;
DRW_Vertex *vertex = new DRW_Vertex(v->x, v->y, v->z, 0.0);
polyline.vertlist.push_back(vertex);
}
dxf->writeLWPolyline(&polyline);
dxf->writePolyline(&polyline);
lv.Clear();
}
@ -527,7 +528,8 @@ public:
spline.ncontrol = sb->deg + 1;
makeKnotsFor(&spline);
for(int i = 0; i <= sb->deg; i++) {
spline.controllist.push_back(new DRW_Coord(sb->ctrl[i].x, sb->ctrl[i].y, 0.0));
spline.controllist.push_back(
new DRW_Coord(sb->ctrl[i].x, sb->ctrl[i].y, sb->ctrl[i].z));
if(isRational) spline.weightlist.push_back(sb->weight[i]);
}
dxf->writeSpline(&spline);