Fix pad struts not connecting to model

This commit is contained in:
tamasmeszaros 2023-01-25 15:43:56 +01:00
parent a7eda7cc8e
commit 9f9bca5cd0

View File

@ -68,13 +68,14 @@ indexed_triangle_set create_pad(const SupportableMesh &sm,
const indexed_triangle_set &support_mesh, const indexed_triangle_set &support_mesh,
const JobController &ctl) const JobController &ctl)
{ {
constexpr float PadSamplingLH = 0.1f;
ExPolygons model_contours; // This will store the base plate of the pad. ExPolygons model_contours; // This will store the base plate of the pad.
double pad_h = sm.pad_cfg.full_height(); double pad_h = sm.pad_cfg.full_height();
auto gndlvl = float(ground_level(sm));
float zstart = ground_level(sm); float zstart = gndlvl - bool(sm.pad_cfg.embed_object) * sm.pad_cfg.wall_thickness_mm;
float zend = zstart + float(pad_h + EPSILON); float zend = zstart + float(pad_h + PadSamplingLH + EPSILON);
auto heights = grid(zstart, zend, 0.1f); auto heights = grid(zstart, zend, PadSamplingLH);
if (!sm.cfg.enabled || sm.pad_cfg.embed_object) { if (!sm.cfg.enabled || sm.pad_cfg.embed_object) {
// No support (thus no elevation) or zero elevation mode // 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; indexed_triangle_set out;
create_pad(sup_contours, model_contours, out, sm.pad_cfg); 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; for (auto &p : out.vertices) p += offs;
its_merge_vertices(out); its_merge_vertices(out);