Use Slic3r::Surface::Collection for Layer::Region->slices
This commit is contained in:
parent
5885be881c
commit
7534c1e6d9
@ -25,7 +25,7 @@ has 'overhang_width' => (is => 'lazy');
|
||||
|
||||
# collection of surfaces generated by slicing the original geometry
|
||||
# divided by type top/bottom/internal
|
||||
has 'slices' => (is => 'rw', default => sub { [] });
|
||||
has 'slices' => (is => 'rw', default => sub { Slic3r::Surface::Collection->new });
|
||||
|
||||
# collection of polygons or polylines representing thin walls contained
|
||||
# in the original geometry
|
||||
@ -89,7 +89,8 @@ sub make_surfaces {
|
||||
my ($loops) = @_;
|
||||
|
||||
return if !@$loops;
|
||||
$self->slices([ _merge_loops($loops) ]);
|
||||
$self->slices->clear;
|
||||
$self->slices->append(_merge_loops($loops));
|
||||
|
||||
# detect thin walls by offsetting slices by half extrusion inwards
|
||||
if ($Slic3r::Config->thin_walls) {
|
||||
|
@ -305,8 +305,12 @@ sub _simplify_slices {
|
||||
my ($distance) = @_;
|
||||
|
||||
foreach my $layer (map @{$_->layers}, @{$self->objects}) {
|
||||
@$_ = map $_->simplify($distance), @$_
|
||||
for $layer->slices, (map $_->slices, @{$layer->regions});
|
||||
$layer->slices([ map $_->simplify($distance), @{$layer->slices} ]);
|
||||
foreach my $layerm (@{$layer->regions}) {
|
||||
my @new = map $_->simplify($distance), @{$layerm->slices};
|
||||
$layerm->slices->clear;
|
||||
$layerm->slices->append(@new);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,9 +232,12 @@ sub slice {
|
||||
[ map $_->expolygon->holes, @upper_surfaces, @lower_surfaces, ],
|
||||
);
|
||||
|
||||
@{$layerm->slices} = map Slic3r::Surface->new
|
||||
(expolygon => $_, surface_type => S_TYPE_INTERNAL),
|
||||
@$diff;
|
||||
$layerm->slices->clear;
|
||||
$layerm->slices->append(
|
||||
map Slic3r::Surface->new
|
||||
(expolygon => $_, surface_type => S_TYPE_INTERNAL),
|
||||
@$diff
|
||||
);
|
||||
}
|
||||
|
||||
# update layer slices after repairing the single regions
|
||||
@ -418,7 +421,8 @@ sub detect_surfaces_type {
|
||||
);
|
||||
|
||||
# save surfaces to layer
|
||||
@{$layerm->slices} = (@bottom, @top, @internal);
|
||||
$layerm->slices->clear;
|
||||
$layerm->slices->append(@bottom, @top, @internal);
|
||||
|
||||
Slic3r::debugf " layer %d has %d bottom, %d top and %d internal surfaces\n",
|
||||
$layerm->id, scalar(@bottom), scalar(@top), scalar(@internal);
|
||||
|
@ -42,10 +42,6 @@ use Slic3r::Test;
|
||||
$self->init_extruders;
|
||||
$_->slice for @{$self->objects};
|
||||
$_->make_perimeters for @{$self->objects};
|
||||
foreach my $layer (map @{$_->layers}, @{$self->objects}) {
|
||||
@$_ = map $_->simplify(&Slic3r::SCALED_RESOLUTION), @$_
|
||||
for $layer->slices, (map $_->slices, @{$layer->regions});
|
||||
}
|
||||
$_->detect_surfaces_type for @{$self->objects};
|
||||
$_->prepare_fill_surfaces for map @{$_->regions}, map @{$_->layers}, @{$self->objects};
|
||||
$_->process_external_surfaces for map @{$_->regions}, map @{$_->layers}, @{$self->objects};
|
||||
|
Loading…
Reference in New Issue
Block a user