mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-04 22:00:42 +08:00
Bugfix: avoid-crossing-perimeters was failing on layers only containing single walls. #978
This commit is contained in:
parent
8efe46e58d
commit
11637d527a
@ -727,13 +727,19 @@ sub write_gcode {
|
|||||||
# compute the offsetted convex hull for each object and repeat it for each copy.
|
# compute the offsetted convex hull for each object and repeat it for each copy.
|
||||||
my @islands = ();
|
my @islands = ();
|
||||||
foreach my $obj_idx (0 .. $#{$self->objects}) {
|
foreach my $obj_idx (0 .. $#{$self->objects}) {
|
||||||
my @island = Slic3r::ExPolygon->new(convex_hull([
|
my $convex_hull = convex_hull([
|
||||||
map @{$_->contour}, map @{$_->slices}, @{$self->objects->[$obj_idx]->layers},
|
map @{$_->contour}, map @{$_->slices}, @{$self->objects->[$obj_idx]->layers},
|
||||||
]))->translate(scale $shift[X], scale $shift[Y])->offset_ex(scale $distance_from_objects, 1, JT_SQUARE);
|
]);
|
||||||
|
# discard layers only containing thin walls (offset would fail on an empty polygon)
|
||||||
|
if (@$convex_hull) {
|
||||||
|
my @island = Slic3r::ExPolygon->new($convex_hull)
|
||||||
|
->translate(scale $shift[X], scale $shift[Y])
|
||||||
|
->offset_ex(scale $distance_from_objects, 1, JT_SQUARE);
|
||||||
foreach my $copy (@{ $self->objects->[$obj_idx]->copies }) {
|
foreach my $copy (@{ $self->objects->[$obj_idx]->copies }) {
|
||||||
push @islands, map $_->clone->translate(@$copy), @island;
|
push @islands, map $_->clone->translate(@$copy), @island;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$gcodegen->external_mp(Slic3r::GCode::MotionPlanner->new(
|
$gcodegen->external_mp(Slic3r::GCode::MotionPlanner->new(
|
||||||
islands => union_ex([ map @$_, @islands ]),
|
islands => union_ex([ map @$_, @islands ]),
|
||||||
no_internal => 1,
|
no_internal => 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user