From 1e23b82e240b3550e237440b73b6afc6a4e37750 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 9 Jun 2015 16:04:26 +0200 Subject: [PATCH] Bugfix: small gaps were left between infill and perimeters when solid infill extrusion width was much thinner than internal infill extrusion width. #2895 --- lib/Slic3r/Fill.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/Slic3r/Fill.pm b/lib/Slic3r/Fill.pm index 09fba7a29..a39b77fc4 100644 --- a/lib/Slic3r/Fill.pm +++ b/lib/Slic3r/Fill.pm @@ -1,6 +1,7 @@ package Slic3r::Fill; use Moo; +use List::Util qw(max); use Slic3r::ExtrusionPath ':roles'; use Slic3r::Fill::3DHoneycomb; use Slic3r::Fill::Base; @@ -143,8 +144,12 @@ sub make_fill { # we are going to grow such regions by overlapping them with the void (if any) # TODO: detect and investigate whether there could be narrow regions without # any void neighbors - my $distance_between_surfaces = $infill_flow->scaled_spacing; { + my $distance_between_surfaces = max( + $infill_flow->scaled_spacing, + $solid_infill_flow->scaled_spacing, + $top_solid_infill_flow->scaled_spacing, + ); my $collapsed = diff( [ map @{$_->expolygon}, @surfaces ], offset2([ map @{$_->expolygon}, @surfaces ], -$distance_between_surfaces/2, +$distance_between_surfaces/2), @@ -163,9 +168,6 @@ sub make_fill { )}; } - # add spacing between surfaces - @surfaces = map @{$_->offset(-$distance_between_surfaces / 2)}, @surfaces; - if (0) { require "Slic3r/SVG.pm"; Slic3r::SVG::output("fill_" . $layerm->print_z . ".svg", @@ -234,11 +236,14 @@ sub make_fill { $f->z($layerm->print_z); $f->angle(deg2rad($layerm->config->fill_angle)); $f->loop_clipping(scale($flow->nozzle_diameter) * &Slic3r::LOOP_CLIPPING_LENGTH_OVER_NOZZLE_DIAMETER); - my @polylines = $f->fill_surface( - $surface, + + # apply half spacing using this flow's own spacing and generate infill + my @polylines = map $f->fill_surface( + $_, density => $density/100, layer_height => $h, - ); + ), @{ $surface->offset(-scale($f->spacing)/2) }; + next unless @polylines; # calculate actual flow from spacing (which might have been adjusted by the infill