Bugfix: recent changes broke the "Infill every N layers" feature

This commit is contained in:
Alessandro Ranellucci 2011-11-13 21:46:32 +01:00
parent ba1b59f54c
commit 8f32ee8f5a
3 changed files with 21 additions and 4 deletions

View File

@ -8,6 +8,7 @@ use Slic3r::Fill::HilbertCurve;
use Slic3r::Fill::OctagramSpiral; use Slic3r::Fill::OctagramSpiral;
use Slic3r::Fill::Rectilinear; use Slic3r::Fill::Rectilinear;
use Slic3r::Fill::Rectilinear2; use Slic3r::Fill::Rectilinear2;
use Slic3r::Geometry qw(shortest_path);
use XXX; use XXX;
@ -40,7 +41,19 @@ sub make_fill {
} }
printf "Filling layer %d:\n", $layer->id; printf "Filling layer %d:\n", $layer->id;
# organize $layer->fill_surfaces using a shortest path search
@{ $layer->fill_surfaces } = @{shortest_path([
map [ $_->[0]->contour->points->[0], $_ ], grep @$_, @{ $layer->fill_surfaces },
])};
foreach my $surfaces (@{ $layer->fill_surfaces }) { foreach my $surfaces (@{ $layer->fill_surfaces }) {
# organize $surfaces using a shortest path search
@$surfaces = @{shortest_path([
map [ $_->contour->points->[0], $_ ], @$surfaces,
])};
SURFACE: foreach my $surface (@$surfaces) { SURFACE: foreach my $surface (@$surfaces) {
Slic3r::debugf " Processing surface %s:\n", $surface->id; Slic3r::debugf " Processing surface %s:\n", $surface->id;

View File

@ -31,11 +31,14 @@ sub diff_ex {
$clipper->clear; $clipper->clear;
$clipper->add_subject_polygons($subject); $clipper->add_subject_polygons($subject);
$clipper->add_clip_polygons($clip); $clipper->add_clip_polygons($clip);
return $clipper->ex_execute(CT_DIFFERENCE, PFT_NONZERO, PFT_NONZERO); return [
map Slic3r::ExPolygon->new($_),
@{ $clipper->ex_execute(CT_DIFFERENCE, PFT_NONZERO, PFT_NONZERO) },
];
} }
sub diff { sub diff {
return [ map { $_->{outer}, $_->{holes} } diff_ex(@_) ]; return [ map @$_, diff_ex(@_) ];
} }
sub union_ex { sub union_ex {

View File

@ -365,6 +365,7 @@ sub infill_every_layers {
[ map $_->p, grep $_->surface_type eq 'internal', @$surfaces ], [ map $_->p, grep $_->surface_type eq 'internal', @$surfaces ],
); );
next if !@$intersection; next if !@$intersection;
my $intersection_offsetted = safety_offset([ map @$_, @$intersection ]);
# new fill surfaces of the current layer are: # new fill surfaces of the current layer are:
# - any non-internal surface # - any non-internal surface
@ -387,7 +388,7 @@ sub infill_every_layers {
map $_->p, grep $_->surface_type eq 'internal' && $_->depth_layers == $depth, map $_->p, grep $_->surface_type eq 'internal' && $_->depth_layers == $depth,
@$surfaces, @$surfaces,
], ],
safety_offset($intersection), $intersection_offsetted,
)}; )};
} }
@$surfaces = @new_surfaces; @$surfaces = @new_surfaces;
@ -408,7 +409,7 @@ sub infill_every_layers {
map $_->p, grep $_->surface_type eq 'internal' && $_->depth_layers == $depth, map $_->p, grep $_->surface_type eq 'internal' && $_->depth_layers == $depth,
@$lower_surfaces, @$lower_surfaces,
], ],
safety_offset($intersection), $intersection_offsetted,
)}; )};
} }
@$lower_surfaces = @new_surfaces; @$lower_surfaces = @new_surfaces;