From e8dc9817745343b73317ac90c9853ac3533edea9 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 29 Dec 2014 00:51:27 +0100 Subject: [PATCH] Fixes to Ooze Prevention --- lib/Slic3r/Print.pm | 2 +- lib/Slic3r/Print/GCode.pm | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 69df1c900..b68e191a5 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -219,7 +219,7 @@ sub make_skirt { # $skirt_height_z in this case is the highest possible skirt height for safety. my $skirt_height_z = -1; foreach my $object (@{$self->objects}) { - my $skirt_height = ($self->config->skirt_height == -1) + my $skirt_height = ($self->config->skirt_height == -1 || $self->config->ooze_prevention) ? scalar(@{$object->layers}) : min($self->config->skirt_height, scalar(@{$object->layers})); diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index dae9eb3a7..a40a64e28 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -147,15 +147,26 @@ sub export { my $outer_skirt = convex_hull(\@skirt_points); my @skirts = (); foreach my $extruder_id (@{$self->print->extruders}) { + my $extruder_offset = $self->config->get_at('extruder_offset', $extruder_id); push @skirts, my $s = $outer_skirt->clone; - $s->translate(map scale($_), @{$self->config->get_at('extruder_offset', $extruder_id)}); + $s->translate(-scale($extruder_offset->x), -scale($extruder_offset->y)); #) } my $convex_hull = convex_hull([ map @$_, @skirts ]); $gcodegen->ooze_prevention->enable(1); $gcodegen->ooze_prevention->standby_points( - [ map $_->clone, map @$_, map $_->subdivide(scale 10), @{offset([$convex_hull], scale 3)} ] + [ map @{$_->equally_spaced_points(scale 10)}, @{offset([$convex_hull], scale 3)} ] ); + + if (0) { + require "Slic3r/SVG.pm"; + Slic3r::SVG::output( + "ooze_prevention.svg", + polygons => [$outer_skirt], + red_polygons => \@skirts, + points => $gcodegen->ooze_prevention->standby_points, + ); + } } }