diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 45ff20e78..377d53bef 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2502,7 +2502,7 @@ void PrintConfigDef::init_sla_params() def->min = 0; def->max = 10; def->mode = comExpert; - def->set_default_value(new ConfigOptionFloat(0.5)); + def->set_default_value(new ConfigOptionFloat(1)); def = this->add("support_critical_angle", coFloat); def->label = L("Critical angle"); @@ -2625,6 +2625,17 @@ void PrintConfigDef::init_sla_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(45.0)); + def = this->add("pad_object_gap", coFloat); + def->label = L("Pad object gap"); + def->category = L("Pad"); + def->tooltip = L("The gap between the object bottom and the generated " + "pad in zero elevation mode."); + def->sidetext = L("mm"); + def->min = 0; + def->max = 10; + def->mode = comExpert; + def->set_default_value(new ConfigOptionFloat(1)); + def = this->add("pad_object_connector_stride", coFloat); def->label = L("Pad object connector stride"); def->category = L("Pad"); @@ -2643,7 +2654,7 @@ void PrintConfigDef::init_sla_params() def->sidetext = L("mm"); def->min = 0; def->mode = comExpert; - def->set_default_value(new ConfigOptionFloat(0.3)); + def->set_default_value(new ConfigOptionFloat(0.5)); def = this->add("pad_object_connector_penetration", coFloat); def->label = L("Pad object connector penetration"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index e632e6946..b5ddc4f13 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1033,6 +1033,9 @@ public: // - The two pads will be connected with tiny connector sticks // ///////////////////////////////////////////////////////////////////////// + // This is the gap between the object bottom and the generated pad + ConfigOptionFloat pad_object_gap; + // How far to place the connector sticks on the object pad perimeter ConfigOptionFloat pad_object_connector_stride; @@ -1071,6 +1074,7 @@ protected: OPT_PTR(pad_max_merge_distance); OPT_PTR(pad_edge_radius); OPT_PTR(pad_wall_slope); + OPT_PTR(pad_object_gap); OPT_PTR(pad_object_connector_stride); OPT_PTR(pad_object_connector_width); OPT_PTR(pad_object_connector_penetration); diff --git a/src/libslic3r/SLA/SLABasePool.cpp b/src/libslic3r/SLA/SLABasePool.cpp index 62a078cb7..4a1259b5a 100644 --- a/src/libslic3r/SLA/SLABasePool.cpp +++ b/src/libslic3r/SLA/SLABasePool.cpp @@ -383,18 +383,12 @@ Polygons unify(const Polygons& shapes) { // inserted along the perimeter in every "stride" distance. The stick rectangles // will have a with about "stick_width". The input dimensions are in world // measure, not the scaled clipper units. -void offset_with_breakstick_holes(ExPolygon& poly, - double padding, - double stride, - double stick_width, - double penetration) -{ - // We do the basic offsetting first - static const bool dont_round_edges = false; - - if(padding > 0.0) - offset(poly, coord_t(padding / SCALING_FACTOR), dont_round_edges); - +void breakstick_holes(ExPolygon& poly, + double padding, + double stride, + double stick_width, + double penetration) +{ // SVG svg("bridgestick_plate.svg"); // svg.draw(poly); @@ -428,8 +422,8 @@ void offset_with_breakstick_holes(ExPolygon& poly, out.emplace_back(a); // dodge the start point, do not make sticks on the joins - while (t < sright) t += sright; - double tend = nrm - sright; + while (t < sbottom) t += sbottom; + double tend = nrm - sbottom; while (t < tend) { // insert the stick on the polygon perimeter diff --git a/src/libslic3r/SLA/SLABasePool.hpp b/src/libslic3r/SLA/SLABasePool.hpp index 129f7ccd4..8aa4f5f41 100644 --- a/src/libslic3r/SLA/SLABasePool.hpp +++ b/src/libslic3r/SLA/SLABasePool.hpp @@ -30,11 +30,11 @@ void base_plate(const TriangleMesh& mesh, // input mesh // inserted along the perimeter in every "stride" distance. The stick rectangles // will have a with about "stick_width". The input dimensions are in world // measure, not the scaled clipper units. -void offset_with_breakstick_holes(ExPolygon& poly, - double padding, - double stride, - double stick_width, - double penetration = 0.0); +void breakstick_holes(ExPolygon &poly, + double padding, + double stride, + double stick_width, + double penetration = 0.0); struct PoolConfig { double min_wall_thickness_mm = 2; diff --git a/src/libslic3r/SLA/SLASupportTree.cpp b/src/libslic3r/SLA/SLASupportTree.cpp index b9f2cc14e..ba14b1811 100644 --- a/src/libslic3r/SLA/SLASupportTree.cpp +++ b/src/libslic3r/SLA/SLASupportTree.cpp @@ -578,23 +578,31 @@ struct Pad { float(cfg.min_wall_height_mm + cfg.min_wall_thickness_mm), 0.1f, pcfg.throw_on_cancel); - // We don't need the holes for the base plate from the supports for (const ExPolygon &bp : platetmp) basep.emplace_back(bp.contour); - for (const ExPolygon &bp : modelbase) basep.emplace_back(bp.contour); + if(pcfg.embed_object) { - auto modelbase_sticks = modelbase; - for(auto& poly : modelbase_sticks) - sla::offset_with_breakstick_holes( + + if (pcfg.embed_object.object_gap_mm > 0.0) + modelbase_sticks + = offset_ex(modelbase_sticks, + coord_t(pcfg.embed_object.object_gap_mm + / SCALING_FACTOR)); + + for(auto& poly : modelbase_sticks) { + basep.emplace_back(poly); + sla::breakstick_holes( poly, pcfg.embed_object.object_gap_mm, // padding pcfg.embed_object.stick_stride_mm, pcfg.embed_object.stick_width_mm, pcfg.embed_object.stick_penetration_mm); + } create_base_pool(basep, tmesh, modelbase_sticks, cfg); } else { + for (const ExPolygon &bp : modelbase) basep.emplace_back(bp.contour); create_base_pool(basep, tmesh, {}, cfg); } diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 78bd50220..bff4c9587 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -602,17 +602,18 @@ sla::SupportConfig make_support_cfg(const SLAPrintObjectConfig& c) { return scfg; } -sla::PoolConfig::EmbedObject use_builtin_pad(const SLAPrintObjectConfig& c) { +sla::PoolConfig::EmbedObject builtin_pad_cfg(const SLAPrintObjectConfig& c) { sla::PoolConfig::EmbedObject ret; ret.enabled = c.support_object_elevation.getFloat() <= EPSILON && c.pad_enable.getBool(); if(ret.enabled) { - ret.object_gap_mm = c.support_base_safety_distance.getFloat(); - ret.stick_width_mm = c.pad_object_connector_width.getFloat(); - ret.stick_stride_mm = c.pad_object_connector_stride.getFloat(); - ret.stick_width_mm = c.pad_object_connector_penetration.getFloat(); + ret.object_gap_mm = c.pad_object_gap.getFloat(); + ret.stick_width_mm = c.pad_object_connector_width.getFloat(); + ret.stick_stride_mm = c.pad_object_connector_stride.getFloat(); + ret.stick_penetration_mm = c.pad_object_connector_penetration + .getFloat(); } return ret; @@ -631,7 +632,7 @@ sla::PoolConfig make_pool_config(const SLAPrintObjectConfig& c) { pcfg.min_wall_height_mm = c.pad_wall_height.getFloat(); // set builtin pad implicitly ON - pcfg.embed_object = use_builtin_pad(c); + pcfg.embed_object = builtin_pad_cfg(c); return pcfg; } @@ -663,6 +664,16 @@ std::string SLAPrint::validate() const if(supports_en && elv > EPSILON && elv < pinhead_width ) return L("Elevation is too low for object."); + + sla::PoolConfig::EmbedObject builtinpad = builtin_pad_cfg(po->config()); + if(supports_en && builtinpad.enabled && + cfg.pillar_base_safety_distance_mm < builtinpad.object_gap_mm) { + return L( + "The endings of the support pillars will be deployed on the " + "gap between the object and the pad. 'Support base safety " + "distance' has to be greater than the 'Pad object gap' " + "parameter to avoid this."); + } } return ""; @@ -861,7 +872,7 @@ void SLAPrint::process() // If the builtin pad mode is engaged, we have to filter out all the // points that are on the bottom of the object - if(use_builtin_pad(po.m_config)) { + if(builtin_pad_cfg(po.m_config)) { double gnd = po.m_supportdata->emesh.ground_level(); auto & pts = po.m_supportdata->support_points; @@ -1658,6 +1669,7 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector& Preset::sla_print_options() "pad_max_merge_distance", "pad_edge_radius", "pad_wall_slope", + "pad_object_gap", "pad_object_connector_stride", "pad_object_connector_width", "pad_object_connector_penetration", diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 8ca47f1b1..032bf95df 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3503,6 +3503,7 @@ void TabSLAPrint::build() // optgroup->append_single_option_line("pad_edge_radius"); optgroup->append_single_option_line("pad_wall_slope"); + optgroup->append_single_option_line("pad_object_gap"); optgroup->append_single_option_line("pad_object_connector_stride"); optgroup->append_single_option_line("pad_object_connector_width"); optgroup->append_single_option_line("pad_object_connector_penetration");