From c51a45ee0f8c08cbee0d874d81da3ba5d42d9cea Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 24 Aug 2020 08:04:16 +0200 Subject: [PATCH] Drainholes are saved elevated for 3MF compatibility This is a follow-up of previous commit --- src/libslic3r/Format/3mf.cpp | 30 ++++++++++++++++++++---------- src/libslic3r/Format/3mf.hpp | 9 +-------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index c25b7b96a..52a3335ee 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -1103,7 +1103,7 @@ namespace Slic3r { sla::DrainHoles sla_drain_holes; - if (version == 1 || version == 2) { + if (version == 1) { for (unsigned int i=0; isla_drain_holes; + sla::DrainHoles drain_holes = object->sla_drain_holes; + + // The holes were placed 1mm above the mesh in the first implementation. + // This was a bad idea and the reference point was changed in 2.3 so + // to be on the mesh exactly. The elevated position is still saved + // in 3MFs for compatibility reasons. + for (sla::DrainHole& hole : drain_holes) { + hole.pos -= hole.normal.normalized(); + hole.height += 1.f; + } + + if (!drain_holes.empty()) { out += string_printf(fmt, count); diff --git a/src/libslic3r/Format/3mf.hpp b/src/libslic3r/Format/3mf.hpp index 02e2bd1d3..ccfd9356d 100644 --- a/src/libslic3r/Format/3mf.hpp +++ b/src/libslic3r/Format/3mf.hpp @@ -20,15 +20,8 @@ namespace Slic3r { support_points_format_version = 1 }; - - /* The same for holes. - - * version 0: undefined - * version 1: holes saved a bit above the mesh and deeper - * version 2: holes are saved on the mesh exactly - */ enum { - drain_holes_format_version = 2 + drain_holes_format_version = 1 }; class Model;