From 716e0254f4be1955143806c8f387653d254f7076 Mon Sep 17 00:00:00 2001 From: PavelMikus Date: Tue, 31 Jan 2023 11:12:36 +0100 Subject: [PATCH] Fix notifications during GCode export - only CRTICAL are now shown Relax support detector parameters and warnings --- src/libslic3r/Print.cpp | 2 +- src/libslic3r/SupportSpotsGenerator.cpp | 25 ++++++++++++------------- src/libslic3r/SupportSpotsGenerator.hpp | 11 +++++------ src/slic3r/GUI/Plater.cpp | 13 ++++++++++--- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 736cfb4b2..ced6cd2a3 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1200,7 +1200,7 @@ void Print::alert_when_supports_needed() } } - message += "\n" + L("Consider enabling supports") + (recommend_brim ? (" " + L("and brim")) : "") + "."; + message += "\n" + L("Consider enabling supports") + (recommend_brim ? (" " + L("and/or brim")) : "") + "."; if (objects_isssues.size() > 0) { this->active_step_add_warning(PrintStateBase::WarningLevel::NON_CRITICAL, message); diff --git a/src/libslic3r/SupportSpotsGenerator.cpp b/src/libslic3r/SupportSpotsGenerator.cpp index 5c6c2d84b..295d3fe07 100644 --- a/src/libslic3r/SupportSpotsGenerator.cpp +++ b/src/libslic3r/SupportSpotsGenerator.cpp @@ -217,7 +217,7 @@ float estimate_curled_up_height( float dist_factor = std::max(point.distance - params.malformation_distance_factors.first * flow_width, 0.01f) / ((params.malformation_distance_factors.second - params.malformation_distance_factors.first) * flow_width); - curled_up_height = layer_height * 2.0f * sqrt(sqrt(dist_factor)) * std::clamp(6.0f * point.curvature, 1.0f, 6.0f); + curled_up_height = layer_height * sqrt(sqrt(dist_factor)) * std::clamp(3.0f * point.curvature, 1.0f, 3.0f); curled_up_height = std::min(curled_up_height, params.max_curled_height_factor * layer_height); } @@ -1183,23 +1183,22 @@ std::vector> gather_issues(const SupportPoint [](const PartialObject &left, const PartialObject &right) { return left.volume > right.volume; }); float max_volume_part = partial_objects.front().volume; - bool unstable_floating_part_added = false; for (const PartialObject &p : partial_objects) { - if (p.volume > max_volume_part / 500.0f && !p.connected_to_bed) { + if (p.volume > max_volume_part / 200.0f && !p.connected_to_bed) { result.emplace_back(SupportPointCause::UnstableFloatingPart, true); - unstable_floating_part_added = true; break; } } - if (!unstable_floating_part_added) { - for (const SupportPoint &sp : support_points) { - if (sp.cause == SupportPointCause::UnstableFloatingPart) { - result.emplace_back(SupportPointCause::UnstableFloatingPart, true); - break; - } - } - } + // should be detected in previous step + // if (!unstable_floating_part_added) { + // for (const SupportPoint &sp : support_points) { + // if (sp.cause == SupportPointCause::UnstableFloatingPart) { + // result.emplace_back(SupportPointCause::UnstableFloatingPart, true); + // break; + // } + // } + // } std::vector ext_supp_points{}; ext_supp_points.reserve(support_points.size()); @@ -1245,7 +1244,7 @@ std::vector> gather_issues(const SupportPoint } } - if (ext_supp_points.size() > 5) { + if (ext_supp_points.size() > max_volume_part / 200.0f) { result.emplace_back(SupportPointCause::FloatingExtrusion, false); } diff --git a/src/libslic3r/SupportSpotsGenerator.hpp b/src/libslic3r/SupportSpotsGenerator.hpp index b72ea5c75..dd58c9133 100644 --- a/src/libslic3r/SupportSpotsGenerator.hpp +++ b/src/libslic3r/SupportSpotsGenerator.hpp @@ -33,7 +33,7 @@ struct Params } // the algorithm should use the following units for all computations: distance [mm], mass [g], time [s], force [g*mm/s^2] - const float bridge_distance = 12.0f; // mm + const float bridge_distance = 16.0f; // mm const float max_acceleration; // mm/s^2 ; max acceleration of object in XY -- should be applicable only to printers with bed slinger, // however we do not have such info yet. The force is usually small anyway, so not such a big deal to include it everytime const int raft_layers_count; @@ -42,7 +42,7 @@ struct Params BrimType brim_type; const float brim_width; - const std::pair malformation_distance_factors = std::pair { 0.4, 1.2 }; + const std::pair malformation_distance_factors = std::pair { 0.5, 1.1 }; const float max_curled_height_factor = 10.0f; const float min_distance_between_support_points = 3.0f; //mm @@ -52,8 +52,8 @@ struct Params const float gravity_constant = 9806.65f; // mm/s^2; gravity acceleration on Earth's surface, algorithm assumes that printer is in upwards position. const double filament_density = 1.25e-3f; // g/mm^3 ; Common filaments are very lightweight, so precise number is not that important const double material_yield_strength = 33.0f * 1e6f; // (g*mm/s^2)/mm^2; 33 MPa is yield strength of ABS, which has the lowest yield strength from common materials. - const float standard_extruder_conflict_force = 5.0f * gravity_constant; // force that can occasionally push the model due to various factors (filament leaks, small curling, ... ); - const float malformations_additive_conflict_extruder_force = 100.0f * gravity_constant; // for areas with possible high layered curled filaments + const float standard_extruder_conflict_force = 10.0f * gravity_constant; // force that can occasionally push the model due to various factors (filament leaks, small curling, ... ); + const float malformations_additive_conflict_extruder_force = 65.0f * gravity_constant; // for areas with possible high layered curled filaments // MPa * 1e^6 = (g*mm/s^2)/mm^2 = g/(mm*s^2); yield strength of the bed surface double get_bed_adhesion_yield_strength() const { @@ -72,9 +72,8 @@ struct Params } } - //just return PLA adhesion value as value for supports double get_support_spots_adhesion_strength() const { - return 0.02f * 1e6; + return 0.016f * 1e6; } }; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 58134a0a3..2fd8ddd39 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4367,13 +4367,20 @@ void Plater::priv::clear_warnings() } bool Plater::priv::warnings_dialog() { - if (current_warnings.empty()) + std::vector> current_critical_warnings{}; + for (const auto& w : current_warnings) { + if (w.first.level == PrintStateBase::WarningLevel::CRITICAL) { + current_critical_warnings.push_back(w); + } + } + + if (current_critical_warnings.empty()) return true; std::string text = _u8L("There are active warnings concerning sliced models:") + "\n"; - for (auto const& it : current_warnings) { + for (auto const& it : current_critical_warnings) { size_t next_n = it.first.message.find_first_of('\n', 0); text += "\n"; - if (next_n != std::string::npos) + if (next_n != std::string::npos) text += it.first.message.substr(0, next_n); else text += it.first.message;