1st installment of ModelInstance 3D scale components

This commit is contained in:
Enrico Turri
2018-09-24 15:54:09 +02:00
parent e3d44b07fe
commit 0e1843a871
26 changed files with 558 additions and 9 deletions
+14
View File
@@ -29,7 +29,12 @@ std::string toString(const Model& model, bool holes = true) {
if(!objinst) continue;
Slic3r::TriangleMesh tmpmesh = rmesh;
#if ENABLE_MODELINSTANCE_3D_SCALE
// CHECK_ME -> Is the following correct ?
tmpmesh.scale(objinst->get_scaling_factor());
#else
tmpmesh.scale(objinst->scaling_factor);
#endif // ENABLE_MODELINSTANCE_3D_SCALE
objinst->transform_mesh(&tmpmesh);
ExPolygons expolys = tmpmesh.horizontal_projection();
for(auto& expoly_complex : expolys) {
@@ -87,7 +92,11 @@ void toSVG(SVG& svg, const Model& model) {
if(!objinst) continue;
Slic3r::TriangleMesh tmpmesh = rmesh;
#if ENABLE_MODELINSTANCE_3D_SCALE
tmpmesh.scale(objinst->get_scaling_factor());
#else
tmpmesh.scale(objinst->scaling_factor);
#endif // ENABLE_MODELINSTANCE_3D_SCALE
objinst->transform_mesh(&tmpmesh);
ExPolygons expolys = tmpmesh.horizontal_projection();
svg.draw(expolys);
@@ -513,7 +522,12 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model) {
Slic3r::TriangleMesh tmpmesh = rmesh;
ClipperLib::PolygonImpl pn;
#if ENABLE_MODELINSTANCE_3D_SCALE
// CHECK_ME -> is the following correct ?
tmpmesh.scale(objinst->get_scaling_factor());
#else
tmpmesh.scale(objinst->scaling_factor);
#endif // ENABLE_MODELINSTANCE_3D_SCALE
// TODO export the exact 2D projection
auto p = tmpmesh.convex_hull();