From 906203438359735ef94916de34ec5d43b4cddcf4 Mon Sep 17 00:00:00 2001 From: igiannakas Date: Mon, 13 May 2024 15:45:13 +0100 Subject: [PATCH 1/4] Implemented minimum skirt extrusion length parameter --- src/libslic3r/GCode.cpp | 14 ++++++++------ src/libslic3r/Preset.cpp | 2 +- src/libslic3r/Print.cpp | 10 ++++++---- src/libslic3r/Print.hpp | 3 ++- src/libslic3r/PrintConfig.cpp | 10 ++++++++++ src/libslic3r/PrintConfig.hpp | 1 + src/slic3r/GUI/Plater.cpp | 2 +- src/slic3r/GUI/Tab.cpp | 1 + 8 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index f65fabe5aad..71614cda043 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -3452,13 +3452,15 @@ namespace Skirt { size_t lines_per_extruder = (n_loops + n_tools - 1) / n_tools; // BBS. Extrude skirt with first extruder if min_skirt_length is zero - const PrintConfig &config = print.config(); - if (Print::min_skirt_length < EPSILON) { + //ORCA: Always extrude skirt with first extruder, independantly of if the minimum skirt length is zero or not. The code below + // is left as a placeholder for when a multiextruder support is implemented. Then we will need to extrude the skirt loops for each extruder. + //const PrintConfig &config = print.config(); + //if (config.min_skirt_length.value < EPSILON) { skirt_loops_per_extruder_out[layer_tools.extruders.front()] = std::pair(0, n_loops); - } else { - for (size_t i = 0; i < n_loops; i += lines_per_extruder) - skirt_loops_per_extruder_out[layer_tools.extruders[i / lines_per_extruder]] = std::pair(i, std::min(i + lines_per_extruder, n_loops)); - } + //} else { + // for (size_t i = 0; i < n_loops; i += lines_per_extruder) + // skirt_loops_per_extruder_out[layer_tools.extruders[i / lines_per_extruder]] = std::pair(i, std::min(i + lines_per_extruder, n_loops)); + //} } static std::map> make_skirt_loops_per_extruder_1st_layer( diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 826358f0b13..b766a160218 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -781,7 +781,7 @@ static std::vector s_Preset_print_options { "inner_wall_speed", "outer_wall_speed", "sparse_infill_speed", "internal_solid_infill_speed", "top_surface_speed", "support_speed", "support_object_xy_distance", "support_interface_speed", "bridge_speed", "internal_bridge_speed", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed", - "outer_wall_acceleration", "initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "skirt_loops", "skirt_speed", "skirt_distance", "skirt_height", "draft_shield", + "outer_wall_acceleration", "initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance", "skirt_height", "draft_shield", "brim_width", "brim_object_gap", "brim_type", "brim_ears_max_angle", "brim_ears_detection_length", "enable_support", "support_type", "support_threshold_angle", "enforce_support_layers", "raft_layers", "raft_first_layer_density", "raft_first_layer_expansion", "raft_contact_distance", "raft_expansion", "support_base_pattern", "support_base_pattern_spacing", "support_expansion", "support_style", diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 93bbc7c94ba..3c0d2db9d47 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -76,7 +76,8 @@ PrintRegion::PrintRegion(const PrintRegionConfig &config) : PrintRegion(config, PrintRegion::PrintRegion(PrintRegionConfig &&config) : PrintRegion(std::move(config), config.hash()) {} //BBS -float Print::min_skirt_length = 0; +// ORCA: Now this is a parameter +//float Print::min_skirt_length = 0; void Print::clear() { @@ -239,6 +240,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n opt_key == "skirt_loops" || opt_key == "skirt_speed" || opt_key == "skirt_height" + || opt_key == "min_skirt_length" || opt_key == "draft_shield" || opt_key == "skirt_distance" || opt_key == "ooze_prevention" @@ -2331,15 +2333,15 @@ void Print::_make_skirt() ))); eloop.paths.back().polyline = loop.split_at_first_point(); m_skirt.append(eloop); - if (Print::min_skirt_length > 0) { + if (m_config.min_skirt_length.value > 0) { // The skirt length is limited. Sum the total amount of filament length extruded, in mm. extruded_length[extruder_idx] += unscale(loop.length()) * extruders_e_per_mm[extruder_idx]; - if (extruded_length[extruder_idx] < Print::min_skirt_length) { + if (extruded_length[extruder_idx] < m_config.min_skirt_length.value) { // Not extruded enough yet with the current extruder. Add another loop. if (i == 1) ++ i; } else { - assert(extruded_length[extruder_idx] >= Print::min_skirt_length); + assert(extruded_length[extruder_idx] >= m_config.min_skirt_length.value); // Enough extruded with the current extruder. Extrude with the next one, // until the prescribed number of skirt loops is extruded. if (extruder_idx + 1 < extruders.size()) diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index f48466e575d..23a3a001591 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -1027,7 +1027,8 @@ class Print : public PrintBaseWithState public: //BBS: this was a print config and now seems to be useless so we move it to here - static float min_skirt_length; + // ORCA: parameter below is now back to being a user option (min_skirt_length) + //static float min_skirt_length; }; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index b74fadbf987..7834132376e 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3831,6 +3831,16 @@ def = this->add("filament_loading_speed", coFloats); def->sidetext = L("mm/s"); def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(50.0)); + + def = this->add("min_skirt_length", coFloat); + def->label = L("Skirt minimum extrusion length"); + def->full_label = L("Skirt minimum extrusion length"); + def->tooltip = L("Minimum filament extrusion length in mm when printing the skirt. Zero means this feature is disabled.\n\n" + "Using a non zero value is useful if the printer is set up to print without a prime line."); + def->min = 0; + def->sidetext = L("mm"); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(0.0)); def = this->add("slow_down_layer_time", coFloats); def->label = L("Layer time"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 9d6c88a2b82..836d326e7d5 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1215,6 +1215,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionInt, skirt_height)) ((ConfigOptionInt, skirt_loops)) ((ConfigOptionFloat, skirt_speed)) + ((ConfigOptionFloat, min_skirt_length)) ((ConfigOptionFloats, slow_down_layer_time)) ((ConfigOptionBool, spiral_mode)) ((ConfigOptionBool, spiral_mode_smooth)) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f812ae2b069..2d3fdaab6f6 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2697,7 +2697,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) , config(Slic3r::DynamicPrintConfig::new_from_defaults_keys({ "printable_area", "bed_exclude_area", "bed_custom_texture", "bed_custom_model", "print_sequence", "extruder_clearance_radius", "extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod", - "nozzle_height", "skirt_loops", "skirt_speed", "skirt_distance", + "nozzle_height", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance", "brim_width", "brim_object_gap", "brim_type", "nozzle_diameter", "single_extruder_multi_material", "preferred_orientation", "enable_prime_tower", "wipe_tower_x", "wipe_tower_y", "prime_tower_width", "prime_tower_brim_width", "prime_volume", "extruder_colour", "filament_colour", "material_colour", "printable_height", "printer_model", "printer_technology", diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 2bd2f1ea551..f397b5cc9f4 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2269,6 +2269,7 @@ void TabPrint::build() page = add_options_page(L("Others"), "advanced"); optgroup = page->new_optgroup(L("Bed adhension"), L"param_adhension"); optgroup->append_single_option_line("skirt_loops"); + optgroup->append_single_option_line("min_skirt_length"); optgroup->append_single_option_line("skirt_distance"); optgroup->append_single_option_line("skirt_height"); optgroup->append_single_option_line("skirt_speed"); From bf5d17a6109a0475ef3db32758ad78bbf67daef4 Mon Sep 17 00:00:00 2001 From: igiannakas Date: Tue, 14 May 2024 14:06:10 +0100 Subject: [PATCH 2/4] Enabled draft shield option --- src/libslic3r/PrintConfig.cpp | 14 ++++++++------ src/slic3r/GUI/Tab.cpp | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 7834132376e..1a72af35778 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3798,12 +3798,14 @@ def = this->add("filament_loading_speed", coFloats); def->set_default_value(new ConfigOptionInt(1)); def = this->add("draft_shield", coEnum); - //def->label = L("Draft shield"); - def->label = "Draft shield"; - //def->tooltip = L("With draft shield active, the skirt will be printed skirt_distance from the object, possibly intersecting brim.\n" - // "Enabled = skirt is as tall as the highest printed object.\n" - // "Limited = skirt is as tall as specified by skirt_height.\n" - // "This is useful to protect an ABS or ASA print from warping and detaching from print bed due to wind draft."); + def->label = L("Draft shield"); + def->tooltip = L("A draft shield is useful to protect an ABS or ASA print from warping and detaching from print bed due to wind draft. " + "It is usually needed only with open frame printers, i.e. without an enclosure. \n\n" + "Options:\n" + "Enabled = skirt is as tall as the highest printed object.\n" + "Limited = skirt is as tall as specified by skirt height.\n\n" + "Note: With the draft shield active, the skirt will be printed at skirt distance from the object. Therefore, if brims " + "are active it may intersect with them. To avoid this, increase the skirt distance value.\n"); def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); def->enum_values.push_back("disabled"); def->enum_values.push_back("limited"); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index f397b5cc9f4..dcc01b961cb 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2273,7 +2273,7 @@ void TabPrint::build() optgroup->append_single_option_line("skirt_distance"); optgroup->append_single_option_line("skirt_height"); optgroup->append_single_option_line("skirt_speed"); - //optgroup->append_single_option_line("draft_shield"); + optgroup->append_single_option_line("draft_shield"); optgroup->append_single_option_line("brim_type", "auto-brim"); optgroup->append_single_option_line("brim_width", "auto-brim#manual"); optgroup->append_single_option_line("brim_object_gap", "auto-brim#brim-object-gap"); From f08fade2ccb6ceecf5fc530dba9080bb4d1fc073 Mon Sep 17 00:00:00 2001 From: igiannakas Date: Tue, 14 May 2024 14:50:04 +0100 Subject: [PATCH 3/4] Update Tab.cpp --- src/slic3r/GUI/Tab.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index dcc01b961cb..cf0df73a898 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2267,13 +2267,15 @@ void TabPrint::build() optgroup->append_single_option_line("tree_support_brim_width"); page = add_options_page(L("Others"), "advanced"); - optgroup = page->new_optgroup(L("Bed adhension"), L"param_adhension"); + optgroup = page->new_optgroup(L("Skirt"), L"param_adhension"); optgroup->append_single_option_line("skirt_loops"); optgroup->append_single_option_line("min_skirt_length"); optgroup->append_single_option_line("skirt_distance"); optgroup->append_single_option_line("skirt_height"); optgroup->append_single_option_line("skirt_speed"); optgroup->append_single_option_line("draft_shield"); + + optgroup = page->new_optgroup(L("Brim"), L"param_adhension"); optgroup->append_single_option_line("brim_type", "auto-brim"); optgroup->append_single_option_line("brim_width", "auto-brim#manual"); optgroup->append_single_option_line("brim_object_gap", "auto-brim#brim-object-gap"); From 5992daca2403ba59043bb0d59060b6263e3a5d1a Mon Sep 17 00:00:00 2001 From: igiannakas Date: Sun, 19 May 2024 19:30:08 +0100 Subject: [PATCH 4/4] Updated draft shield to be visible in the Advanced mode --- src/libslic3r/PrintConfig.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index a72a2f92066..c07553503e5 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3817,7 +3817,7 @@ def = this->add("filament_loading_speed", coFloats); def->enum_labels.push_back("Disabled"); def->enum_labels.push_back("Limited"); def->enum_labels.push_back("Enabled"); - def->mode = comDevelop; + def->mode = comAdvanced; def->set_default_value(new ConfigOptionEnum(dsDisabled)); def = this->add("skirt_loops", coInt);