diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index 5220f60c6f..98ee8e3a99 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -3435,6 +3435,13 @@ void TreeSupport::drop_nodes() } } + // Layer 0 is never dropped from, so its nodes are not checked at the top of the loop. + if (layer_nr_next == 0 && support_on_buildplate_only) { + for (SupportNode *node : contact_nodes[layer_nr_next]) + if (!node->to_buildplate) + unsupported_branch_leaves.push_front({ layer_nr_next, node }); + } + #ifdef SUPPORT_TREE_DEBUG_TO_SVG if (contact_nodes[layer_nr].empty() == false) { draw_contours_and_nodes_to_svg(debug_out_path("contact_points_%.2f.svg", contact_nodes[layer_nr][0]->print_z), get_collision(0,obj_layer_nr_next), diff --git a/tests/fff_print/test_tree_support.cpp b/tests/fff_print/test_tree_support.cpp index e816144c43..d307b0a578 100644 --- a/tests/fff_print/test_tree_support.cpp +++ b/tests/fff_print/test_tree_support.cpp @@ -197,6 +197,25 @@ TEST_CASE("A raft is still generated under tree support", "[TreeSupport]") REQUIRE(rafted_object->layers().front()->print_z > unrafted_object->layers().front()->print_z); } +// A plate on a column overhangs a slab that covers the whole bed, so support could only land on the slab. +TEST_CASE("Tree support on the build plate only leaves out branches that land on the first layer of the model", "[TreeSupport][Regression]") +{ + const double slab_height = GENERATE(0.2, 0.6); + CAPTURE(slab_height); + TriangleMesh mesh = make_cube(80, 80, slab_height); + TriangleMesh column = make_cube(6, 6, 5.1 - slab_height); + TriangleMesh plate = make_cube(30, 30, 1); + // Each part overlaps the one below rather than resting on it; a coplanar join slices ambiguously. + column.translate(37.f, 37.f, float(slab_height) - 0.05f); + plate.translate(25.f, 25.f, 5.f); + mesh.merge(column); + mesh.merge(plate); + + Slic3r::Print print; + slice_with_tree_support(mesh, print, "tree_slim", 30, 1); + CHECK(support_points(print).empty()); +} + // 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]") {