From 94a47725499ae357a97309d9b542f76f72eb3fdc Mon Sep 17 00:00:00 2001 From: supermerill Date: Sun, 21 Jun 2020 21:57:28 +0200 Subject: [PATCH] use first_layer_size_compasation for the lslices, so the brims are printed against the real lines. --- src/libslic3r/PrintObject.cpp | 15 +++++----- tests/superslicerlibslic3r/test_print.cpp | 35 ++++++++++++++++++++++- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 11621ef32..b5d38bac5 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -2435,13 +2435,14 @@ end: // Merge all regions' slices to get islands, chain them by a shortest path. layer->make_slices(); //FIXME: can't make it work in multi-region object, it seems useful to avoid bridge on top of first layer compensation - if (layer->regions().size() == 1 && layer_id == 0 && first_layer_compensation < 0 && m_config.raft_layers == 0) { - // The Elephant foot has been compensated, therefore the 1st layer's lslices are shrank with the Elephant foot compensation value. - // Store the uncompensated value there. - assert(! m_layers.empty()); - assert(m_layers.front()->id() == 0); - m_layers.front()->lslices = offset_ex(std::move(m_layers.front()->lslices), -first_layer_compensation); - } + //so it's disable, if you want an offset, use the offset field. + //if (layer->regions().size() == 1 && layer_id == 0 && first_layer_compensation < 0 && m_config.raft_layers == 0) { + // // The Elephant foot has been compensated, therefore the 1st layer's lslices are shrank with the Elephant foot compensation value. + // // Store the uncompensated value there. + // assert(! m_layers.empty()); + // assert(m_layers.front()->id() == 0); + // m_layers.front()->lslices = offset_ex(std::move(m_layers.front()->lslices), -first_layer_compensation); + //} } }); } diff --git a/tests/superslicerlibslic3r/test_print.cpp b/tests/superslicerlibslic3r/test_print.cpp index d442ea640..33ff474b6 100644 --- a/tests/superslicerlibslic3r/test_print.cpp +++ b/tests/superslicerlibslic3r/test_print.cpp @@ -144,7 +144,7 @@ SCENARIO("Print: Brim generation") { REQUIRE(print.brim().items_count() == 3); } } - WHEN("Brim is set to 6mm") { + WHEN("Brim is set to 6mm") { config.set_key_value("brim_width", new ConfigOptionFloat(6)); Print print{}; Slic3r::Test::init_print(print, { m }, model, &config); @@ -153,6 +153,39 @@ SCENARIO("Print: Brim generation") { REQUIRE(print.brim().items_count() == 6); } } + WHEN("Brim is set to 6mm with 1mm offset") { + config.set_key_value("brim_width", new ConfigOptionFloat(6)); + config.set_key_value("brim_offset", new ConfigOptionFloat(1)); + Print print{}; + Slic3r::Test::init_print(print, { m }, model, &config); + print.process(); + THEN("Brim Extrusion collection has 5 loops in it") { + REQUIRE(print.brim().items_count() == 5); + } + } + WHEN("Brim without first layer compensation") { + config.set_key_value("brim_width", new ConfigOptionFloat(2)); + config.set_key_value("brim_offset", new ConfigOptionFloat(0)); + Print print{}; + Slic3r::Test::init_print(print, { m }, model, &config); + print.process(); + THEN("First Brim Extrusion has a length of ~88") { + REQUIRE(unscaled(print.brim().entities.front()->length()) > 22*4); + REQUIRE(unscaled(print.brim().entities.front()->length()) < 22*4+1); + } + } + WHEN("Brim with 1mm first layer compensation") { + config.set_key_value("brim_width", new ConfigOptionFloat(2)); + config.set_key_value("brim_offset", new ConfigOptionFloat(0)); + config.set_key_value("first_layer_size_compensation", new ConfigOptionFloat(-1)); + Print print{}; + Slic3r::Test::init_print(print, { m }, model, &config); + print.process(); + THEN("First Brim Extrusion has a length of ~80") { + REQUIRE(unscaled(print.brim().entities.front()->length()) > 20 * 4); + REQUIRE(unscaled(print.brim().entities.front()->length()) < 20 * 4 + 1); + } + } WHEN("Brim is set to 6mm, extrusion width 0.5mm") { config.set_key_value("brim_width", new ConfigOptionFloat(6)); config.set_key_value("first_layer_extrusion_width", new ConfigOptionFloatOrPercent(0.5, false));