From c2301c5796713ee50025c565a0b5a44f69d9f97d Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 29 Apr 2013 15:53:15 +0200 Subject: [PATCH] Don't extend solid layers when fill density is 0 --- lib/Slic3r/Layer/Region.pm | 10 ++++++++-- lib/Slic3r/Print/Object.pm | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/Slic3r/Layer/Region.pm b/lib/Slic3r/Layer/Region.pm index bdabbd09c..551c3ac63 100644 --- a/lib/Slic3r/Layer/Region.pm +++ b/lib/Slic3r/Layer/Region.pm @@ -473,17 +473,23 @@ sub process_external_surfaces { my @top = grep $_->surface_type == S_TYPE_TOP, @{$self->fill_surfaces}; my @bottom = grep $_->surface_type == S_TYPE_BOTTOM, @{$self->fill_surfaces}; + # if we're slicing with no infill, we can't extend external surfaces + # over non-existent infill + my @fill_boundaries = $Slic3r::Config->fill_density > 0 + ? @{$self->fill_surfaces} + : grep $_->surface_type != S_TYPE_INTERNAL, @{$self->fill_surfaces}; + # offset them and intersect the results with the actual fill boundaries my $margin = scale 3; # TODO: ensure this is greater than the total thickness of the perimeters @top = @{intersection_ex( [ Slic3r::Geometry::Clipper::offset([ map $_->p, @top ], +$margin) ], - [ map $_->p, @{$self->fill_surfaces} ], + [ map $_->p, @fill_boundaries ], undef, 1, # to ensure adjacent expolygons are unified )}; @bottom = @{intersection_ex( [ Slic3r::Geometry::Clipper::offset([ map $_->p, @bottom ], +$margin) ], - [ map $_->p, @{$self->fill_surfaces} ], + [ map $_->p, @fill_boundaries ], undef, 1, # to ensure adjacent expolygons are unified )}; diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index d4052fcc9..7b21db874 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -637,10 +637,15 @@ sub discover_horizontal_shells { # if some parts are going to collapse, let's grow them and add the extra area to the neighbor layer # as well as to our original surfaces so that we support this additional area in the next shell too if (@$too_narrow) { + # consider the actual fill area + my @fill_boundaries = $Slic3r::Config->fill_density > 0 + ? @neighbor_fill_surfaces + : grep $_->surface_type != S_TYPE_INTERNAL, @neighbor_fill_surfaces; + # make sure our grown surfaces don't exceed the fill area my @grown = map @$_, @{intersection_ex( [ offset([ map @$_, @$too_narrow ], +$margin) ], - [ map $_->p, @neighbor_fill_surfaces ], + [ map $_->p, @fill_boundaries ], )}; $new_internal_solid = union_ex([ @grown, (map @$_, @$new_internal_solid) ]); $solid = union_ex([ @grown, (map @$_, @$solid) ]);