From 39a6c13c8167ffdbbf72d55e042eea77ebaf15c1 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 20 Oct 2021 14:34:22 +0200 Subject: [PATCH 1/6] Use proper morphological closing for pad creation. --- src/libslic3r/SLA/ConcaveHull.cpp | 42 ++++++------------------------- 1 file changed, 7 insertions(+), 35 deletions(-) diff --git a/src/libslic3r/SLA/ConcaveHull.cpp b/src/libslic3r/SLA/ConcaveHull.cpp index 1724089894..cfce36d162 100644 --- a/src/libslic3r/SLA/ConcaveHull.cpp +++ b/src/libslic3r/SLA/ConcaveHull.cpp @@ -40,36 +40,6 @@ Point ConcaveHull::centroid(const Points &pp) return c; } -// As it shows, the current offset_ex in ClipperUtils hangs if used in jtRound -// mode -template -static ClipperLib::Paths fast_offset(PolygonsProvider &&paths, - coord_t delta, - ClipperLib::JoinType jointype) -{ - using ClipperLib::ClipperOffset; - using ClipperLib::etClosedPolygon; - using ClipperLib::Paths; - using ClipperLib::Path; - - ClipperOffset offs; - offs.ArcTolerance = scaled(0.01); - - for (auto &p : paths) - // If the input is not at least a triangle, we can not do this algorithm - if(p.size() < 3) { - BOOST_LOG_TRIVIAL(error) << "Invalid geometry for offsetting!"; - return {}; - } - - offs.AddPaths(std::forward(paths), jointype, etClosedPolygon); - - Paths result; - offs.Execute(result, static_cast(delta)); - - return result; -} - Points ConcaveHull::calculate_centroids() const { // We get the centroids of all the islands in the 2D slice @@ -158,15 +128,17 @@ ExPolygons ConcaveHull::to_expolygons() const ExPolygons offset_waffle_style_ex(const ConcaveHull &hull, coord_t delta) { - ExPolygons ret = ClipperPaths_to_Slic3rExPolygons( - fast_offset(fast_offset(ClipperUtils::PolygonsProvider(hull.polygons()), 2 * delta, ClipperLib::jtRound), -delta, ClipperLib::jtRound)); - for (ExPolygon &p : ret) p.holes.clear(); - return ret; + return to_expolygons(offset_waffle_style(hull, delta)); } Polygons offset_waffle_style(const ConcaveHull &hull, coord_t delta) { - return to_polygons(offset_waffle_style_ex(hull, delta)); + Polygons res = closing(hull.polygons(), 2 * delta, delta, ClipperLib::jtRound); + + auto it = std::remove_if(res.begin(), res.end(), [](Polygon &p) { return p.is_clockwise(); }); + res.erase(it, res.end()); + + return res; } }} // namespace Slic3r::sla From ed67fb506e2885dd9772d02358ceb493fc7c40f3 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 20 Oct 2021 15:08:33 +0200 Subject: [PATCH 2/6] Fix some warnings on gcc 11 --- src/PrusaSlicer.cpp | 2 +- src/libnest2d/include/libnest2d/placers/nfpplacer.hpp | 2 +- src/libnest2d/include/libnest2d/placers/placer_boilerplate.hpp | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp index 0da5e73808..41d5231f16 100644 --- a/src/PrusaSlicer.cpp +++ b/src/PrusaSlicer.cpp @@ -705,7 +705,7 @@ bool CLI::setup(int argc, char **argv) // Initialize with defaults. for (const t_optiondef_map *options : { &cli_actions_config_def.options, &cli_transform_config_def.options, &cli_misc_config_def.options }) - for (const std::pair &optdef : *options) + for (const t_optiondef_map::value_type &optdef : *options) m_config.option(optdef.first, true); set_data_dir(m_config.opt_string("datadir")); diff --git a/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp b/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp index 47ba7bbdc5..00f6a999fb 100644 --- a/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp +++ b/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp @@ -577,7 +577,7 @@ private: template - Shapes calcnfp(const Item &trsh, Level) + Shapes calcnfp(const Item &/*trsh*/, Level) { // Function for arbitrary level of nfp implementation // TODO: implement diff --git a/src/libnest2d/include/libnest2d/placers/placer_boilerplate.hpp b/src/libnest2d/include/libnest2d/placers/placer_boilerplate.hpp index dc1bbd4f1f..486996f0d6 100644 --- a/src/libnest2d/include/libnest2d/placers/placer_boilerplate.hpp +++ b/src/libnest2d/include/libnest2d/placers/placer_boilerplate.hpp @@ -33,7 +33,8 @@ public: PackResult(Item& item): item_ptr_(&item), move_(item.translation()), - rot_(item.rotation()) {} + rot_(item.rotation()), + overfit_(1.0) {} PackResult(double overfit = 1.0): item_ptr_(nullptr), overfit_(overfit) {} From 6887fa829ee4b059ae4366605bda5a8f12a91e77 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 20 Oct 2021 15:48:39 +0200 Subject: [PATCH 3/6] Another warning fix for gcc 11 --- src/libslic3r/SLAPrint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 1bc5489145..43ac958b59 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -1216,7 +1216,7 @@ DynamicConfig SLAPrintStatistics::config() const DynamicConfig SLAPrintStatistics::placeholders() { DynamicConfig config; - for (const std::string &key : { + for (const char *key : { "print_time", "total_cost", "total_weight", "objects_used_material", "support_used_material" }) config.set_key_value(key, new ConfigOptionString(std::string("{") + key + "}")); From 482841b39e4210a6d737fb3b059f0c55a61a5114 Mon Sep 17 00:00:00 2001 From: Justin Schuh Date: Fri, 23 Jul 2021 07:16:21 -0700 Subject: [PATCH 4/6] Disable acceleration control if default_acceleration is zero --- src/libslic3r/GCode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index ff0a7c0273..116fcbe7fb 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2807,7 +2807,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, gcode += this->unretract(); // adjust acceleration - { + if (m_config.default_acceleration.value > 0) { double acceleration; if (this->on_first_layer() && m_config.first_layer_acceleration.value > 0) { acceleration = m_config.first_layer_acceleration.value; From 97d3c3e00afd801809fe90e9683d218cf8434cb8 Mon Sep 17 00:00:00 2001 From: Hannes Hauswedell Date: Sun, 21 Feb 2021 17:58:17 +0000 Subject: [PATCH 5/6] GLGizmoHollow: Increase hole diameter slider range (PR #6101) --- src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp index d45a2e6137..614e838114 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp @@ -621,7 +621,7 @@ RENDER_AGAIN: ImGui::PushItemWidth(window_width - diameter_slider_left); float diam = 2.f * m_new_hole_radius; - m_imgui->slider_float("##hole_diameter", &diam, 1.f, 15.f, "%.1f mm", 1.f, false); + m_imgui->slider_float("##hole_diameter", &diam, 1.f, 25.f, "%.1f mm", 1.f, false); // Let's clamp the value (which could have been entered by keyboard) to a larger range // than the slider. This allows entering off-scale values and still protects against //complete non-sense. From fc5560aac2a093948b51860c8a23458c37bb6381 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 20 Oct 2021 21:59:07 +0200 Subject: [PATCH 6/6] Fix of #3270 (Confusing cooling hint when min and max fan speed are equal) --- src/slic3r/GUI/PresetHints.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/PresetHints.cpp b/src/slic3r/GUI/PresetHints.cpp index 5c5ed26124..ce709d9eb8 100644 --- a/src/slic3r/GUI/PresetHints.cpp +++ b/src/slic3r/GUI/PresetHints.cpp @@ -34,11 +34,17 @@ std::string PresetHints::cooling_description(const Preset &preset) "so that no less than %3%s are spent on that layer " "(however, speed will never be reduced below %4%mm/s)."), slowdown_below_layer_time, max_fan_speed, slowdown_below_layer_time, min_print_speed); - if (fan_below_layer_time > slowdown_below_layer_time) - out += "\n" + - GUI::format(_L("If estimated layer time is greater, but still below ~%1%s, " + if (fan_below_layer_time > slowdown_below_layer_time) { + out += "\n"; + if (min_fan_speed != max_fan_speed) + out += GUI::format(_L("If estimated layer time is greater, but still below ~%1%s, " "fan will run at a proportionally decreasing speed between %2%%% and %3%%%."), fan_below_layer_time, max_fan_speed, min_fan_speed); + else + out += GUI::format(_L("If estimated layer time is greater, but still below ~%1%s, " + "fan will run at %2%%%"), + fan_below_layer_time, min_fan_speed); + } out += "\n"; } if (preset.config.opt_bool("fan_always_on", 0)) {