From f044a111f12ca2dbcce0dc581531eb42056ee330 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 8 Jun 2023 12:46:09 +0200 Subject: [PATCH 1/3] Revert "Fix of #9399 Thick layers + thick raft + lightning infill = crash" This reverts commit 402affb03521d0dbc159f98c24a5964edc23715b. --- src/libslic3r/Fill/Fill.cpp | 7 ++----- src/libslic3r/Fill/FillLightning.cpp | 2 +- src/libslic3r/Fill/FillLightning.hpp | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index ed735a38b..de4b4a8b8 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -468,11 +468,8 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive: f->print_config = &this->object()->print()->config(); f->print_object_config = &this->object()->config(); - if (surface_fill.params.pattern == ipLightning) { - auto *lf = dynamic_cast(f.get()); - lf->generator = lightning_generator; - lf->num_raft_layers = this->object()->slicing_parameters().raft_layers(); - } + if (surface_fill.params.pattern == ipLightning) + dynamic_cast(f.get())->generator = lightning_generator; if (surface_fill.params.pattern == ipEnsuring) { auto *fill_ensuring = dynamic_cast(f.get()); diff --git a/src/libslic3r/Fill/FillLightning.cpp b/src/libslic3r/Fill/FillLightning.cpp index 8c3ac8f1a..36a48e554 100644 --- a/src/libslic3r/Fill/FillLightning.cpp +++ b/src/libslic3r/Fill/FillLightning.cpp @@ -13,7 +13,7 @@ void Filler::_fill_surface_single( ExPolygon expolygon, Polylines &polylines_out) { - const Layer &layer = generator->getTreesForLayer(this->layer_id - this->num_raft_layers); + const Layer &layer = generator->getTreesForLayer(this->layer_id); Polylines fill_lines = layer.convertToLines(to_polygons(expolygon), scaled(0.5 * this->spacing - this->overlap)); if (params.dont_connect() || fill_lines.size() <= 1) { diff --git a/src/libslic3r/Fill/FillLightning.hpp b/src/libslic3r/Fill/FillLightning.hpp index 0705dc657..341399508 100644 --- a/src/libslic3r/Fill/FillLightning.hpp +++ b/src/libslic3r/Fill/FillLightning.hpp @@ -22,7 +22,6 @@ public: ~Filler() override = default; Generator *generator { nullptr }; - size_t num_raft_layers { 0 }; protected: Fill* clone() const override { return new Filler(*this); } From fd4ecb8db8bffaae4f501ee8fb052faceb768091 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 8 Jun 2023 12:52:28 +0200 Subject: [PATCH 2/3] Follow-up to previous commit: We also need to revert this part of 12f1cd0. --- src/libslic3r/Fill/Fill.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index de4b4a8b8..ddb444f28 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -653,11 +653,8 @@ Polylines Layer::generate_sparse_infill_polylines_for_anchoring(FillAdaptive::Oc f->print_config = &this->object()->print()->config(); f->print_object_config = &this->object()->config(); - if (surface_fill.params.pattern == ipLightning) { - auto *lf = dynamic_cast(f.get()); - lf->generator = lightning_generator; - lf->num_raft_layers = this->object()->slicing_parameters().raft_layers(); - } + if (surface_fill.params.pattern == ipLightning) + dynamic_cast(f.get())->generator = lightning_generator; // calculate flow spacing for infill pattern generation double link_max_length = 0.; From fde4aa55c38df68ac103740cbd94df2ea6b792e7 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 9 Jun 2023 08:43:51 +0200 Subject: [PATCH 3/3] Another fix related to subtracting raft layers --- src/libslic3r/Fill/Fill.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index ddb444f28..499e7b85a 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -646,7 +646,7 @@ Polylines Layer::generate_sparse_infill_polylines_for_anchoring(FillAdaptive::Oc // Create the filler object. std::unique_ptr f = std::unique_ptr(Fill::new_from_type(surface_fill.params.pattern)); f->set_bounding_box(bbox); - f->layer_id = this->id(); + f->layer_id = this->id() - this->object()->get_layer(0)->id(); // We need to subtract raft layers. f->z = this->print_z; f->angle = surface_fill.params.angle; f->adapt_fill_octree = (surface_fill.params.pattern == ipSupportCubic) ? support_fill_octree : adaptive_fill_octree;