Fix fill_exactly when multiple surface and no infill_overlap

Was overextruding by 30%.
supermerill/SuperSlicer#820
This commit is contained in:
supermerill 2021-11-06 03:24:20 +01:00
parent 37a3596b3a
commit caa27d3598
2 changed files with 5 additions and 4 deletions

View File

@ -492,6 +492,7 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
for (ExPolygon &expoly : surface_fill.expolygons) { for (ExPolygon &expoly : surface_fill.expolygons) {
//set overlap polygons //set overlap polygons
f->no_overlap_expolygons.clear();
if (surface_fill.params.config->perimeters > 0) { if (surface_fill.params.config->perimeters > 0) {
f->overlap = surface_fill.params.config->infill_overlap.get_abs_value((perimeter_spacing + (f->get_spacing())) / 2); f->overlap = surface_fill.params.config->infill_overlap.get_abs_value((perimeter_spacing + (f->get_spacing())) / 2);
if (f->overlap != 0) { if (f->overlap != 0) {

View File

@ -150,14 +150,14 @@ std::pair<float, Point> Fill::_infill_direction(const Surface *surface) const
double Fill::compute_unscaled_volume_to_fill(const Surface* surface, const FillParams& params) const { double Fill::compute_unscaled_volume_to_fill(const Surface* surface, const FillParams& params) const {
double polyline_volume = 0; double polyline_volume = 0;
for (auto poly = this->no_overlap_expolygons.begin(); poly != this->no_overlap_expolygons.end(); ++poly) { for (const ExPolygon& poly : this->no_overlap_expolygons) {
polyline_volume += params.flow.height * unscaled(unscaled(poly->area())); polyline_volume += params.flow.height * unscaled(unscaled(poly.area()));
double perimeter_gap_usage = params.config->perimeter_overlap.get_abs_value(1); double perimeter_gap_usage = params.config->perimeter_overlap.get_abs_value(1);
// add external "perimeter gap" // add external "perimeter gap"
double perimeter_round_gap = unscaled(poly->contour.length()) * params.flow.height * (1 - 0.25 * PI) * 0.5; double perimeter_round_gap = unscaled(poly.contour.length()) * params.flow.height * (1 - 0.25 * PI) * 0.5;
// add holes "perimeter gaps" // add holes "perimeter gaps"
double holes_gaps = 0; double holes_gaps = 0;
for (auto hole = poly->holes.begin(); hole != poly->holes.end(); ++hole) { for (auto hole = poly.holes.begin(); hole != poly.holes.end(); ++hole) {
holes_gaps += unscaled(hole->length()) * params.flow.height * (1 - 0.25 * PI) * 0.5; holes_gaps += unscaled(hole->length()) * params.flow.height * (1 - 0.25 * PI) * 0.5;
} }
polyline_volume += (perimeter_round_gap + holes_gaps) * perimeter_gap_usage; polyline_volume += (perimeter_round_gap + holes_gaps) * perimeter_gap_usage;