From 141aeb8a00df509f8ed7c4e01cf094e2dff2b784 Mon Sep 17 00:00:00 2001 From: Ian Bassi Date: Wed, 18 Nov 2026 09:22:04 -0300 Subject: [PATCH] Expand the first layer of a tree support raft once The non-organic tree support raft was grown by the first layer expansion on every raft layer, and its first layer by that expansion a second time. The default 2 mm put the first layer 4 mm out, and a 20 mm setting 40 mm. The second expansion came with BambuStudio's fix for this setting, which assumes the fixed 3 mm grip that Orca had replaced with the setting. Restore that grip, so the setting widens the first layer only, as it does for the other supports. Ported from Snapmaker/OrcaSlicer@0e572ec63ae6d0d909e33a4527ce39c4aaf0787d Co-authored-by: zackaree-shen --- src/libslic3r/Support/TreeSupport.cpp | 3 ++- tests/fff_print/test_tree_support.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index 9bd6fca9bc..5220f60c6f 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -1573,7 +1573,8 @@ void TreeSupport::generate_toolpaths() raft_areas.push_back(expoly); } - raft_areas = offset_ex(raft_areas, scale_(object_config.raft_first_layer_expansion)); + // A fixed grip for every raft layer, as in BambuStudio. The first layer expansion is added to the first layer below. + raft_areas = offset_ex(raft_areas, scale_(3.)); size_t layer_nr = 0; for (; layer_nr < m_slicing_params.base_raft_layers; layer_nr++) { diff --git a/tests/fff_print/test_tree_support.cpp b/tests/fff_print/test_tree_support.cpp index a2b324720d..e816144c43 100644 --- a/tests/fff_print/test_tree_support.cpp +++ b/tests/fff_print/test_tree_support.cpp @@ -6,6 +6,7 @@ #include #include "libslic3r/Config.hpp" #include "libslic3r/PrintConfig.hpp" +#include "libslic3r/BoundingBox.hpp" #include "libslic3r/Point.hpp" #include "libslic3r/Polygon.hpp" #include "libslic3r/ExPolygon.hpp" @@ -15,6 +16,8 @@ #include #include +#include +#include #include #include "libslic3r/Layer.hpp" #include "libslic3r/TriangleMesh.hpp" @@ -194,6 +197,28 @@ TEST_CASE("A raft is still generated under tree support", "[TreeSupport]") REQUIRE(rafted_object->layers().front()->print_z > unrafted_object->layers().front()->print_z); } +// With 4 raft layers, the first two are raft base layers. +TEST_CASE("The first layer expansion widens the first layer of a tree support raft by its value and no other layer", "[TreeSupport][Regression]") +{ + auto raft_base_widths = [](double expansion) { + Slic3r::Print print; + slice_with_tree_support(make_cube(20, 20, 5), print, "tree_hybrid", 30, 0, 4, { { "raft_first_layer_expansion", expansion } }); + const auto &layers = print.objects().front()->support_layers(); + REQUIRE(layers.size() > 1); + auto width = [&layers](size_t idx) { + Points points; + layers[idx]->support_fills.collect_points(points); + return unscaled(BoundingBox(points).size().x()); + }; + return std::make_pair(width(0), width(1)); + }; + const auto [first_narrow, second_narrow] = raft_base_widths(2.); + const auto [first_wide, second_wide] = raft_base_widths(6.); + // 4 mm more on each side of the first layer. + CHECK_THAT(first_wide - first_narrow, Catch::Matchers::WithinAbs(8., 0.5)); + CHECK_THAT(second_wide, Catch::Matchers::WithinAbs(second_narrow, 0.5)); +} + // drop_nodes() decides the node merges and spawns the next layer's nodes in parallel. Every one of // those decisions has to be applied in a fixed order, or the same model gives different branches on // each slice.