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:
parent
aaab8a09d4
commit
41365c5f9f
@ -44,6 +44,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
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
DRW_LWPolyline polyline;
|
||||
DRW_Polyline polyline;
|
||||
|
||||
auto startFunc = [&](PolylineBuilder::Vertex *start,
|
||||
PolylineBuilder::Vertex *next,
|
||||
@ -129,16 +129,19 @@ public:
|
||||
hStyle hs = { e->kind };
|
||||
polyline = {};
|
||||
assignEntityDefaults(&polyline, hs);
|
||||
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));
|
||||
};
|
||||
|
||||
auto nextFunc = [&](PolylineBuilder::Vertex *next, PolylineBuilder::Edge *e) {
|
||||
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));
|
||||
};
|
||||
|
||||
auto endFunc = [&]() {
|
||||
dxf->writeLWPolyline(&polyline);
|
||||
dxf->writePolyline(&polyline);
|
||||
};
|
||||
|
||||
auto aloneFunc = [&](PolylineBuilder::Edge *e) {
|
||||
@ -357,16 +360,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();
|
||||
}
|
||||
|
||||
@ -403,7 +404,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);
|
||||
|
Loading…
Reference in New Issue
Block a user