Browse Source

fix full-fill assert

supermerill 1 year ago
parent
commit
3bdc368af1

+ 5 - 3
src/libslic3r/Fill/Fill.cpp

@@ -692,13 +692,15 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
                         fills_by_priority[(size_t)surface_fill.params.priority]->entities()[idx]->visit(compute_volume);
                         fills_by_priority[(size_t)surface_fill.params.priority]->entities()[idx]->visit(compute_volume_no_gap_fill);
                     }
-                    ExPolygons temp = intersection_ex(ExPolygons{surface_fill.surface.expolygon}, f->no_overlap_expolygons);
+                    ExPolygons temp = f->no_overlap_expolygons.empty() ?
+                                        ExPolygons{surface_fill.surface.expolygon} :
+                                        intersection_ex(ExPolygons{surface_fill.surface.expolygon}, f->no_overlap_expolygons);
                     double real_surface = 0;
                     for(auto &t : temp) real_surface += t.area();
                     assert(compute_volume.volume < unscaled(unscaled(surface_fill.surface.area())) * surface_fill.params.layer_height + EPSILON);
                     double area = unscaled(unscaled(real_surface));
-                    assert(compute_volume.volume <= area * surface_fill.params.layer_height * 1.001);
-                    assert(compute_volume.volume >= area * surface_fill.params.layer_height * 0.999 || area < std::max(1.,surface_fill.params.config->solid_infill_below_area.value));
+                    assert(compute_volume.volume <= area * surface_fill.params.layer_height * 1.001 || f->debug_verify_flow_mult <= 0.8);
+                    assert(compute_volume.volume >= area * surface_fill.params.layer_height * 0.999 || f->debug_verify_flow_mult >= 1.3 || area < std::max(1.,surface_fill.params.config->solid_infill_below_area.value));
                 }
 #endif
             }

+ 4 - 1
src/libslic3r/Fill/FillBase.cpp

@@ -215,8 +215,8 @@ void Fill::fill_surface_extrusion(const Surface *surface, const FillParams &para
 
 
             // ensure it doesn't over or under-extrude
-            double mult_flow = 1;
             if (!params.dont_adjust && params.full_infill() && !params.flow.bridge() && params.fill_exactly) {
+            double mult_flow = 1;
                 // compute real volume
                 double polyline_volume = compute_unscaled_volume_to_fill(surface, params);
                 if (extruded_volume != 0 && polyline_volume != 0) mult_flow *= polyline_volume / extruded_volume;
@@ -282,6 +282,9 @@ void Fill::fill_surface_extrusion(const Surface *surface, const FillParams &para
                 if (mult_flow < 0.8) mult_flow = 0.8;
                 BOOST_LOG_TRIVIAL(info) << "Layer " << layer_id << ": Fill process extrude " << extruded_volume << " mm3 for a volume of " << polyline_volume << " mm3 : we mult the flow by " << mult_flow;
             }
+#if _DEBUG
+            this->debug_verify_flow_mult = mult_flow;
+#endif
 
             // Save into layer.
             auto* eec = new ExtrusionEntityCollection();

+ 3 - 0
src/libslic3r/Fill/FillBase.hpp

@@ -124,6 +124,9 @@ public:
 
     // Octree builds on mesh for usage in the adaptive cubic infill
     FillAdaptive::Octree* adapt_fill_octree = nullptr;
+#if _DEBUG
+    mutable double debug_verify_flow_mult = 0;
+#endif
 protected:
     // in unscaled coordinates, please use init (after settings all others settings) as some algos want to modify the value
     coordf_t    spacing_priv;

+ 3 - 0
src/libslic3r/Fill/FillSmooth.cpp

@@ -114,6 +114,9 @@ namespace Slic3r {
                 BOOST_LOG_TRIVIAL(info) << "Layer " << layer_id << " Ironing process " << idx << " extrude " << extruded_volume << " mm3 for a volume of " << volume_to_occupy << " mm3 : we mult the flow by " << mult_flow;
                 
             }
+#if _DEBUG
+            this->debug_verify_flow_mult = mult_flow;
+#endif
             extrusion_entities_append_paths(
                 eec, std::move(polylines_layer),
                 good_role,