Bugfix: brim and skirt collision was not precisely detected when they had similar offsets. #548
This commit is contained in:
parent
2616c24ffc
commit
9bfa4118a1
@ -6,7 +6,7 @@ require Exporter;
|
|||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT_OK = qw(explode_expolygon explode_expolygons safety_offset offset
|
our @EXPORT_OK = qw(explode_expolygon explode_expolygons safety_offset offset
|
||||||
diff_ex diff union_ex intersection_ex xor_ex PFT_EVENODD JT_MITER JT_ROUND
|
diff_ex diff union_ex intersection_ex xor_ex PFT_EVENODD JT_MITER JT_ROUND
|
||||||
is_counter_clockwise);
|
JT_SQUARE is_counter_clockwise);
|
||||||
|
|
||||||
use Math::Clipper 1.09 ':all';
|
use Math::Clipper 1.09 ':all';
|
||||||
use Slic3r::Geometry qw(scale);
|
use Slic3r::Geometry qw(scale);
|
||||||
|
@ -5,7 +5,7 @@ use File::Basename qw(basename fileparse);
|
|||||||
use Math::ConvexHull 1.0.4 qw(convex_hull);
|
use Math::ConvexHull 1.0.4 qw(convex_hull);
|
||||||
use Slic3r::ExtrusionPath ':roles';
|
use Slic3r::ExtrusionPath ':roles';
|
||||||
use Slic3r::Geometry qw(X Y Z X1 Y1 X2 Y2 PI scale unscale move_points);
|
use Slic3r::Geometry qw(X Y Z X1 Y1 X2 Y2 PI scale unscale move_points);
|
||||||
use Slic3r::Geometry::Clipper qw(diff_ex union_ex intersection_ex offset JT_ROUND);
|
use Slic3r::Geometry::Clipper qw(diff_ex union_ex intersection_ex offset JT_ROUND JT_SQUARE);
|
||||||
use Time::HiRes qw(gettimeofday tv_interval);
|
use Time::HiRes qw(gettimeofday tv_interval);
|
||||||
|
|
||||||
has 'config' => (is => 'rw', default => sub { Slic3r::Config->new_from_defaults }, trigger => 1);
|
has 'config' => (is => 'rw', default => sub { Slic3r::Config->new_from_defaults }, trigger => 1);
|
||||||
@ -520,10 +520,11 @@ sub make_brim {
|
|||||||
my $flow = $Slic3r::first_layer_flow || $Slic3r::flow;
|
my $flow = $Slic3r::first_layer_flow || $Slic3r::flow;
|
||||||
my $num_loops = sprintf "%.0f", $Slic3r::Config->brim_width / $flow->width;
|
my $num_loops = sprintf "%.0f", $Slic3r::Config->brim_width / $flow->width;
|
||||||
for my $i (reverse 1 .. $num_loops) {
|
for my $i (reverse 1 .. $num_loops) {
|
||||||
|
# JT_SQUARE ensures no vertex is outside the given offset distance
|
||||||
push @{$self->brim}, Slic3r::ExtrusionLoop->pack(
|
push @{$self->brim}, Slic3r::ExtrusionLoop->pack(
|
||||||
polygon => Slic3r::Polygon->new($_),
|
polygon => Slic3r::Polygon->new($_),
|
||||||
role => EXTR_ROLE_SKIRT,
|
role => EXTR_ROLE_SKIRT,
|
||||||
) for @{Math::Clipper::offset(\@islands, $i * scale $flow->spacing)};
|
) for @{Math::Clipper::offset(\@islands, $i * scale $flow->spacing, 100, JT_SQUARE)};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,7 +620,7 @@ sub write_gcode {
|
|||||||
$gcodegen->shift_y($shift[Y]);
|
$gcodegen->shift_y($shift[Y]);
|
||||||
$gcode .= $gcodegen->set_acceleration($Slic3r::Config->perimeter_acceleration);
|
$gcode .= $gcodegen->set_acceleration($Slic3r::Config->perimeter_acceleration);
|
||||||
# skip skirt if we have a large brim
|
# skip skirt if we have a large brim
|
||||||
if ($layer_id < $Slic3r::Config->skirt_height && ($layer_id != 0 || $Slic3r::Config->skirt_distance + ($Slic3r::Config->skirts * $Slic3r::flow->width) > $Slic3r::Config->brim_width)) {
|
if ($layer_id < $Slic3r::Config->skirt_height && ($layer_id != 0 || $Slic3r::Config->skirt_distance + (($Slic3r::Config->skirts - 1) * $Slic3r::flow->spacing) > $Slic3r::Config->brim_width)) {
|
||||||
$gcode .= $gcodegen->extrude_loop($_, 'skirt') for @{$self->skirt};
|
$gcode .= $gcodegen->extrude_loop($_, 'skirt') for @{$self->skirt};
|
||||||
}
|
}
|
||||||
$skirt_done++;
|
$skirt_done++;
|
||||||
|
Loading…
Reference in New Issue
Block a user