From 9f9bca5cd0004b7169e6220a4506aea2ad5cbec3 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 25 Jan 2023 15:43:56 +0100 Subject: [PATCH] Fix pad struts not connecting to model --- src/libslic3r/SLA/SupportTree.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/libslic3r/SLA/SupportTree.cpp b/src/libslic3r/SLA/SupportTree.cpp index cfafdf7e9..3de05261a 100644 --- a/src/libslic3r/SLA/SupportTree.cpp +++ b/src/libslic3r/SLA/SupportTree.cpp @@ -68,13 +68,14 @@ indexed_triangle_set create_pad(const SupportableMesh &sm, const indexed_triangle_set &support_mesh, const JobController &ctl) { + constexpr float PadSamplingLH = 0.1f; ExPolygons model_contours; // This will store the base plate of the pad. - double pad_h = sm.pad_cfg.full_height(); - - float zstart = ground_level(sm); - float zend = zstart + float(pad_h + EPSILON); - auto heights = grid(zstart, zend, 0.1f); + double pad_h = sm.pad_cfg.full_height(); + auto gndlvl = float(ground_level(sm)); + float zstart = gndlvl - bool(sm.pad_cfg.embed_object) * sm.pad_cfg.wall_thickness_mm; + float zend = zstart + float(pad_h + PadSamplingLH + EPSILON); + auto heights = grid(zstart, zend, PadSamplingLH); if (!sm.cfg.enabled || sm.pad_cfg.embed_object) { // No support (thus no elevation) or zero elevation mode @@ -91,7 +92,7 @@ indexed_triangle_set create_pad(const SupportableMesh &sm, indexed_triangle_set out; create_pad(sup_contours, model_contours, out, sm.pad_cfg); - Vec3f offs{.0f, .0f, zstart}; + Vec3f offs{.0f, .0f, gndlvl}; for (auto &p : out.vertices) p += offs; its_merge_vertices(out);