diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 97cf6b9cea..4867c99f2b 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -1222,6 +1222,8 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in toggle_line("toolchange_cyclic_first_layer", use_cyclic_ordering, -1, cyclic_order_reason); toggle_line("prime_volume",have_prime_tower && (!purge_in_primetower || !bSEMM), -1, _L("Enable the prime tower and either disable purging in the prime tower or disable single extruder multimaterial mode.")); + // Orca: the Type 1 tower takes the prime volume of each filament instead. + toggle_field("prime_volume", supports_wipe_tower_2, -1, _L("The Type 1 prime tower takes the prime volume from each filament, on its Multimaterial page.")); for (auto el : {"flush_into_infill", "flush_into_support", "flush_into_objects"}) toggle_field(el, have_prime_tower, -1, _L("Enable the prime tower to use this setting.")); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 5d223adfb9..fbb062e0e3 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -5074,6 +5074,11 @@ void TabFilament::build() optgroup->append_single_option_line("filament_tower_interface_purge_volume", "material_multimaterial#multimaterial-wipe-tower-parameters"); optgroup->append_single_option_line("filament_tower_interface_print_temp", "material_multimaterial#multimaterial-wipe-tower-parameters"); + // Orca: the Type 1 prime tower takes its prime volume from each filament, not from the process. + optgroup = page->new_optgroup(L("Prime volume"), "param_tower"); + optgroup->append_single_option_line("filament_prime_volume", "material_multimaterial#multimaterial-wipe-tower-parameters"); + optgroup->append_single_option_line("filament_prime_volume_nc", "material_multimaterial#multimaterial-wipe-tower-parameters"); + optgroup = page->new_optgroup(L("Multi Filament")); // optgroup->append_single_option_line("filament_flush_temp", "", 0); // optgroup->append_single_option_line("filament_flush_volumetric_speed", "", 0); @@ -5310,6 +5315,18 @@ void TabFilament::toggle_options() // Orca: hide specific settings for BBL printers const wxString bambu_printer_reason = _L("This setting is unavailable for Bambu Lab printers."); toggle_option("filament_minimal_purge_on_wipe_tower", !is_BBL_printer, 256 + variant_index, bambu_printer_reason); + + // Orca: only the Type 1 prime tower reads these. Bambu Lab printers always use the Type 1 tower. The tower + // takes the hotend change volume only when two filaments share an extruder but not a nozzle, so only on a + // printer whose extruder holds several nozzles, as has_multiple_nozzle tells in TabPrinter::on_preset_loaded(). + const bool type1_tower = is_BBL_printer || printer_cfg.opt_enum("wipe_tower_type") == WipeTowerType::Type1; + const auto *max_nozzle_counts = printer_cfg.option("extruder_max_nozzle_count"); + const bool has_multiple_nozzle = max_nozzle_counts != nullptr && + std::any_of(max_nozzle_counts->values.begin(), max_nozzle_counts->values.end(), + [](int v) { return v > 1 && v != ConfigOptionIntsNullable::nil_value(); }); + toggle_line("filament_prime_volume", type1_tower, -1, _L("Select wipe tower Type 1 in the printer settings to use this setting.")); + toggle_line("filament_prime_volume_nc", type1_tower && has_multiple_nozzle, -1, + _L("Select wipe tower Type 1 on a printer whose extruder holds more than one nozzle to use this setting.")); for (auto el : {"filament_loading_speed_start", "filament_loading_speed", "filament_unloading_speed_start", "filament_unloading_speed", "filament_toolchange_delay", "filament_cooling_moves", "filament_cooling_initial_speed", "filament_cooling_final_speed"}) diff --git a/tests/fff_print/test_wipe_tower.cpp b/tests/fff_print/test_wipe_tower.cpp index 5d30a75994..6cb037189b 100644 --- a/tests/fff_print/test_wipe_tower.cpp +++ b/tests/fff_print/test_wipe_tower.cpp @@ -386,6 +386,46 @@ static DynamicPrintConfig tower_estimate_config(const char *wall_type, unsigned { "raft_layers", "0" } }); } +// The filament a Type 1 tower extrudes for two 20 mm cubes on filaments 1 and 2, so every layer changes +// filament, given the process prime volume and the prime volume of each filament. +static double type1_tower_filament(const char *prime_volume, const char *filament_prime_volume) +{ + DynamicPrintConfig config = tower_estimate_config("rectangle"); + config.set_deserialize_strict({ { "wipe_tower_type", "type1" }, + { "prime_volume", prime_volume }, + { "filament_prime_volume", filament_prime_volume }, + { "wipe_tower_x", "120" }, + { "wipe_tower_y", "120" } }); + const std::vector> overrides = { {}, { { "extruder", "2" } } }; + Print print; + Model model; + init_print({ cube(20), cube(20) }, print, model, config, &overrides); + const std::string gcode = Slic3r::Test::gcode(print); + + // The filament extruded under the prime tower's role tag. + double extruded = 0.; + bool in_tower = false; + GCodeReader parser; + parser.apply_config(print.config()); + parser.parse_buffer(gcode, [&](GCodeReader &self, const GCodeReader::GCodeLine &line) { + const std::string_view raw = line.raw(); + if (raw.rfind(";TYPE:", 0) == 0 || raw.rfind("; FEATURE: ", 0) == 0) + in_tower = raw.find("Prime tower") != std::string_view::npos; + else if (in_tower && line.extruding(self)) + extruded += line.dist_E(self); + }); + return extruded; +} + +TEST_CASE("The Type 1 tower purges the prime volume of each filament, not the process one", "[WipeTower]") +{ + const double filament_45 = type1_tower_filament("45", "45,45"); + REQUIRE(filament_45 > 0.); + CHECK_THAT(type1_tower_filament("5", "45,45"), Catch::Matchers::WithinRel(filament_45, 1e-6)); + CHECK_THAT(type1_tower_filament("60", "45,45"), Catch::Matchers::WithinRel(filament_45, 1e-6)); + CHECK(type1_tower_filament("45", "15,15") < filament_45); +} + TEST_CASE("The tower is sized for the thinnest layer any object on the plate is sliced at", "[WipeTower]") { // The tower has to survive its thinnest layer, so an override finer than the preset drives