diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index e5c36d34c7..6f7cdce70f 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -157,7 +157,9 @@ static unsigned int region_filament(const ExtrusionEntityCollection &extrusions, return config.bottom_surface_filament_id.value; return config.internal_solid_filament_id.value; } - // Walls, and the gap fill between them. + // Orca: Classic gap fill lies inside the outer wall. With one wall, the inner wall filament is not in use. + if (extrusions.role() == erGapFill) + return config.wall_loops.value > 1 ? config.inner_wall_filament_id.value : config.outer_wall_filament_id.value; const ExtrusionEntitiesPtr &walls = extrusions.entities; return !walls.empty() && std::all_of(walls.begin(), walls.end(), [](const ExtrusionEntity *ee) { return is_inner_wall(*ee); }) ? config.inner_wall_filament_id.value : config.outer_wall_filament_id.value; diff --git a/tests/fff_print/test_multifilament.cpp b/tests/fff_print/test_multifilament.cpp index 049e3b4494..2e11470d34 100644 --- a/tests/fff_print/test_multifilament.cpp +++ b/tests/fff_print/test_multifilament.cpp @@ -492,6 +492,37 @@ TEST_CASE("Gap fill between walls does not schedule the sparse infill filament", CHECK(idle_tool_changes(gcode) == 0); } +// Gap fill lies inside the outer wall, so choosing the outer wall filament must not move it. +TEST_CASE("Gap fill between walls prints with the inner wall filament", "[MultiFilament]") +{ + const std::string gcode = slice({ make_cube(20., 1.9, 5.) }, + multifilament_config(2, { + { "wall_generator", "classic" }, + { "wall_loops", 2 }, + { "outer_wall_filament_id", 2 }, + { "skirt_loops", 0 }, + { "brim_type", "no_brim" }, + })); + REQUIRE(tools_for_feature(gcode, "Gap infill") == std::set{ 0 }); + CHECK(tools_for_feature(gcode, "Outer wall") == std::set{ 1 }); + CHECK(idle_tool_changes(gcode) == 0); +} + +// One wall leaves a 1.1mm plate a gap between its two sides, and the inner wall filament is not in use. +TEST_CASE("Gap fill with a single wall does not use the inner wall filament", "[MultiFilament]") +{ + const std::string gcode = slice({ make_cube(20., 1.1, 5.) }, + multifilament_config(2, { + { "wall_generator", "classic" }, + { "wall_loops", 1 }, + { "inner_wall_filament_id", 2 }, + { "skirt_loops", 0 }, + { "brim_type", "no_brim" }, + })); + REQUIRE(tools_for_feature(gcode, "Gap infill") == std::set{ 0 }); + CHECK(idle_tool_changes(gcode) == 0); +} + // A 20x20x2mm base carrying a 0.5mm fin: the fin's layers fit a single wall, so they must not switch to the inner // wall filament the base uses. TEST_CASE("A layer without inner walls does not switch to the inner wall filament", "[MultiFilament]")