mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 17:27:52 -06:00
Fix Only infill where needed putting insufficient material. #1412
This commit is contained in:
parent
907ba55aab
commit
10ab3bbb86
1 changed files with 33 additions and 27 deletions
|
@ -452,42 +452,48 @@ sub clip_fill_surfaces {
|
||||||
|
|
||||||
my $additional_margin = scale 3;
|
my $additional_margin = scale 3;
|
||||||
|
|
||||||
my @overhangs = ();
|
my $overhangs = []; # arrayref of polygons
|
||||||
for my $layer_id (reverse 0..$#{$self->layers}) {
|
for my $layer_id (reverse 0..$#{$self->layers}) {
|
||||||
my $layer = $self->layers->[$layer_id];
|
my $layer = $self->layers->[$layer_id];
|
||||||
|
my @layer_internal = ();
|
||||||
|
my @new_internal = ();
|
||||||
|
|
||||||
# clip this layer's internal surfaces to @overhangs
|
# clip this layer's internal surfaces to @overhangs
|
||||||
foreach my $layerm (@{$layer->regions}) {
|
foreach my $layerm (@{$layer->regions}) {
|
||||||
my @new_internal = map Slic3r::Surface->new(
|
# we assume that this step is run before bridge_over_infill() and combine_infill()
|
||||||
expolygon => $_,
|
# so these are the only internal types we might have
|
||||||
surface_type => S_TYPE_INTERNAL,
|
my (@internal, @other) = ();
|
||||||
),
|
foreach my $surface (map $_->clone, @{$layerm->fill_surfaces}) {
|
||||||
@{intersection_ex(
|
$surface->surface_type == S_TYPE_INTERNAL
|
||||||
[ map @$_, @overhangs ],
|
? push @internal, $surface
|
||||||
[ map $_->p, @{$layerm->fill_surfaces->filter_by_type(S_TYPE_INTERNAL)} ],
|
: push @other, $surface;
|
||||||
)};
|
}
|
||||||
my @new_surfaces = (
|
|
||||||
@new_internal,
|
# keep all the original internal surfaces to detect overhangs in this layer
|
||||||
(map $_->clone, @{$layerm->fill_surfaces->filter_by_type(S_TYPE_INTERNAL)}),
|
push @layer_internal, @internal;
|
||||||
);
|
|
||||||
|
push @new_internal, my @new = map Slic3r::Surface->new(
|
||||||
|
expolygon => $_,
|
||||||
|
surface_type => S_TYPE_INTERNAL,
|
||||||
|
),
|
||||||
|
@{intersection_ex(
|
||||||
|
$overhangs,
|
||||||
|
[ map $_->p, @internal ],
|
||||||
|
)};
|
||||||
|
|
||||||
$layerm->fill_surfaces->clear;
|
$layerm->fill_surfaces->clear;
|
||||||
$layerm->fill_surfaces->append(@new_surfaces);
|
$layerm->fill_surfaces->append(@new, @other);
|
||||||
}
|
}
|
||||||
|
|
||||||
# get this layer's overhangs
|
# get this layer's overhangs defined as the full slice minus the internal infill
|
||||||
|
# (thus we also consider perimeters)
|
||||||
if ($layer_id > 0) {
|
if ($layer_id > 0) {
|
||||||
my $lower_layer = $self->layers->[$layer_id-1];
|
my $solid = diff(
|
||||||
# loop through layer regions so that we can use each region's
|
[ map @$_, @{$layer->slices} ],
|
||||||
# specific overhang width
|
\@layer_internal,
|
||||||
foreach my $layerm (@{$layer->regions}) {
|
);
|
||||||
my $overhang_width = $layerm->overhang_width;
|
$overhangs = offset($solid, +$additional_margin);
|
||||||
# we want to support any solid surface, not just tops
|
push @$overhangs, @new_internal; # propagate upper overhangs
|
||||||
# (internal solids might have been generated)
|
|
||||||
push @overhangs, map @{$_->offset_ex($additional_margin)}, @{intersection_ex(
|
|
||||||
[ map @{$_->expolygon}, grep $_->surface_type != S_TYPE_INTERNAL, @{$layerm->fill_surfaces} ],
|
|
||||||
[ map @$_, map @{$_->offset_ex(-$overhang_width)}, @{$lower_layer->slices} ],
|
|
||||||
)};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue