From d868261399a0236c5db8dfea6fbb8935ad685d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Mon, 25 Apr 2022 12:35:40 +0200 Subject: [PATCH] Updated the default values for wall_add_middle_threshold and wall_split_middle_threshold, which should decrease the number of missing tiny islands. --- .../Arachne/SkeletalTrapezoidationGraph.hpp | 2 +- src/libslic3r/Arachne/WallToolPaths.cpp | 24 +++++-------------- src/libslic3r/Arachne/WallToolPaths.hpp | 17 +------------ src/libslic3r/PerimeterGenerator.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 13 +++++----- src/libslic3r/PrintConfig.hpp | 2 +- src/slic3r/GUI/ConfigManipulation.cpp | 11 +++++++++ 7 files changed, 28 insertions(+), 43 deletions(-) diff --git a/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.hpp b/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.hpp index 49e93f1272..cfdbfecdaf 100644 --- a/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.hpp +++ b/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.hpp @@ -81,7 +81,7 @@ public: * | | > Don't collapse this edge only. * o o */ - void collapseSmallEdges(coord_t snap_dist = 5000); + void collapseSmallEdges(coord_t snap_dist = 5); void makeRib(edge_t*& prev_edge, Point start_source_point, Point end_source_point, bool is_next_to_start_or_end); diff --git a/src/libslic3r/Arachne/WallToolPaths.cpp b/src/libslic3r/Arachne/WallToolPaths.cpp index 2aa28d7cd8..0229d92c5f 100644 --- a/src/libslic3r/Arachne/WallToolPaths.cpp +++ b/src/libslic3r/Arachne/WallToolPaths.cpp @@ -21,25 +21,8 @@ namespace Slic3r::Arachne { -WallToolPaths::WallToolPaths(const Polygons& outline, const coord_t nominal_bead_width, const size_t inset_count, const coord_t wall_0_inset, - const PrintObjectConfig &print_object_config) - : outline(outline) - , bead_width_0(nominal_bead_width) - , bead_width_x(nominal_bead_width) - , inset_count(inset_count) - , wall_0_inset(wall_0_inset) - , strategy_type(print_object_config.beading_strategy_type.value) - , print_thin_walls(Slic3r::Arachne::fill_outline_gaps) - , min_feature_size(scaled(print_object_config.min_feature_size.value)) - , min_bead_width(scaled(print_object_config.min_bead_width.value)) - , small_area_length(static_cast(nominal_bead_width) / 2.) - , toolpaths_generated(false) - , print_object_config(print_object_config) -{ -} - WallToolPaths::WallToolPaths(const Polygons& outline, const coord_t bead_width_0, const coord_t bead_width_x, - const size_t inset_count, const coord_t wall_0_inset, const PrintObjectConfig &print_object_config) + const size_t inset_count, const coord_t wall_0_inset, const PrintObjectConfig &print_object_config, const PrintConfig &print_config) : outline(outline) , bead_width_0(bead_width_0) , bead_width_x(bead_width_x) @@ -52,6 +35,11 @@ WallToolPaths::WallToolPaths(const Polygons& outline, const coord_t bead_width_0 , toolpaths_generated(false) , print_object_config(print_object_config) { + if (const auto &min_bead_width_opt = print_object_config.min_bead_width; min_bead_width_opt.percent) { + assert(!print_config.nozzle_diameter.empty()); + double min_nozzle_diameter = *std::min_element(print_config.nozzle_diameter.values.begin(), print_config.nozzle_diameter.values.end()); + min_bead_width = scaled(min_bead_width_opt.value * 0.01 * min_nozzle_diameter); + } } void simplify(Polygon &thiss, const int64_t smallest_line_segment_squared, const int64_t allowed_error_distance_squared) diff --git a/src/libslic3r/Arachne/WallToolPaths.hpp b/src/libslic3r/Arachne/WallToolPaths.hpp index bc974e09e6..733db1400e 100644 --- a/src/libslic3r/Arachne/WallToolPaths.hpp +++ b/src/libslic3r/Arachne/WallToolPaths.hpp @@ -23,15 +23,6 @@ constexpr coord_t meshfix_maximum_extrusion_area_deviation = scaled(2.) class WallToolPaths { public: - /*! - * A class that creates the toolpaths given an outline, nominal bead width and maximum amount of walls - * \param outline An outline of the area in which the ToolPaths are to be generated - * \param nominal_bead_width The nominal bead width used in the generation of the toolpaths - * \param inset_count The maximum number of parallel extrusion lines that make up the wall - * \param wall_0_inset How far to inset the outer wall, to make it adhere better to other walls. - */ - WallToolPaths(const Polygons& outline, const coord_t nominal_bead_width, const size_t inset_count, const coord_t wall_0_inset, const PrintObjectConfig &print_object_config); - /*! * A class that creates the toolpaths given an outline, nominal bead width and maximum amount of walls * \param outline An outline of the area in which the ToolPaths are to be generated @@ -40,7 +31,7 @@ public: * \param inset_count The maximum number of parallel extrusion lines that make up the wall * \param wall_0_inset How far to inset the outer wall, to make it adhere better to other walls. */ - WallToolPaths(const Polygons& outline, const coord_t bead_width_0, const coord_t bead_width_x, const size_t inset_count, const coord_t wall_0_inset, const PrintObjectConfig &print_object_config); + WallToolPaths(const Polygons& outline, coord_t bead_width_0, coord_t bead_width_x, size_t inset_count, coord_t wall_0_inset, const PrintObjectConfig &print_object_config, const PrintConfig &print_config); /*! * Generates the Toolpaths @@ -54,12 +45,6 @@ public: */ const std::vector &getToolPaths(); - /*! - * Alternate 'get', for when the vector that'll be inserted in already exists. - * \param The already existing (or empty) paths these new toolpaths are pushed into. - */ - void pushToolPaths(std::vector &paths); - /*! * Compute the inner contour of the walls. This contour indicates where the walled area ends and its infill begins. * The inside can then be filled, e.g. with skin/infill for the walls of a part, or with a pattern in the case of diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 26838e34f7..76364c5c82 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -317,7 +317,7 @@ void PerimeterGenerator::process_arachne() coord_t bead_width_x = perimeter_spacing; coord_t wall_0_inset = 0; - Arachne::WallToolPaths wallToolPaths(last_p, bead_width_0, bead_width_x, coord_t(loop_number + 1), wall_0_inset, *this->object_config); + Arachne::WallToolPaths wallToolPaths(last_p, bead_width_0, bead_width_x, coord_t(loop_number + 1), wall_0_inset, *this->object_config, *this->print_config); wallToolPaths.generate(); std::vector perimeters = wallToolPaths.getToolPaths(); diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 70fde7ec2f..b5bb9b3409 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3113,7 +3113,7 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->min = 1; def->max = 99; - def->set_default_value(new ConfigOptionPercent(90)); + def->set_default_value(new ConfigOptionPercent(50)); def = this->add("wall_add_middle_threshold", coPercent); def->label = L("Add Middle Line Threshold"); @@ -3128,7 +3128,7 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->min = 1; def->max = 99; - def->set_default_value(new ConfigOptionPercent(80)); + def->set_default_value(new ConfigOptionPercent(75)); def = this->add("min_feature_size", coFloat); def->label = L("Minimum Feature Size"); @@ -3141,16 +3141,17 @@ void PrintConfigDef::init_fff_params() def->min = 0; def->set_default_value(new ConfigOptionFloat(0.1)); - def = this->add("min_bead_width", coFloat); + def = this->add("min_bead_width", coFloatOrPercent); def->label = L("Minimum Wall Line Width"); def->category = L("Advanced"); def->tooltip = L("Width of the wall that will replace thin features (according to the Minimum Feature Size) " "of the model. If the Minimum Wall Line Width is thinner than the thickness of the feature," - " the wall will become as thick as the feature itself."); - def->sidetext = L("mm"); + " the wall will become as thick as the feature itself. " + "If expressed as percentage (for example 85%), it will be computed over nozzle diameter."); + def->sidetext = L("mm or %"); def->mode = comExpert; def->min = 0; - def->set_default_value(new ConfigOptionFloat(0.2)); + def->set_default_value(new ConfigOptionFloatOrPercent(85, true)); // Declare retract values for filament profile, overriding the printer's extruder profile. for (const char *opt_key : { diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index b2b90dbf97..0e829086cf 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -495,7 +495,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionPercent, wall_split_middle_threshold)) ((ConfigOptionPercent, wall_add_middle_threshold)) ((ConfigOptionFloat, min_feature_size)) - ((ConfigOptionFloat, min_bead_width)) + ((ConfigOptionFloatOrPercent, min_bead_width)) ((ConfigOptionBool, support_material)) // Automatic supports (generated based on support_material_threshold). ((ConfigOptionBool, support_material_auto)) diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 8defc45544..595182c7f9 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -317,6 +317,17 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config) bool have_avoid_crossing_perimeters = config->opt_bool("avoid_crossing_perimeters"); toggle_field("avoid_crossing_perimeters_max_detour", have_avoid_crossing_perimeters); + + bool have_arachne = config->opt_enum("slicing_engine") == SlicingEngine::Arachne; + toggle_field("wall_transition_length", have_arachne); + toggle_field("wall_transition_filter_distance", have_arachne); + toggle_field("wall_transition_angle", have_arachne); + toggle_field("wall_distribution_count", have_arachne); + toggle_field("wall_split_middle_threshold", have_arachne); + toggle_field("wall_add_middle_threshold", have_arachne); + toggle_field("min_feature_size", have_arachne); + toggle_field("min_bead_width", have_arachne); + toggle_field("thin_walls", !have_arachne); } void ConfigManipulation::update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config/* = false*/)