Fixes to Ooze Prevention

This commit is contained in:
Alessandro Ranellucci 2014-12-29 00:51:27 +01:00
parent c43049e13b
commit e8dc981774
2 changed files with 14 additions and 3 deletions

View File

@ -219,7 +219,7 @@ sub make_skirt {
# $skirt_height_z in this case is the highest possible skirt height for safety. # $skirt_height_z in this case is the highest possible skirt height for safety.
my $skirt_height_z = -1; my $skirt_height_z = -1;
foreach my $object (@{$self->objects}) { 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}) ? scalar(@{$object->layers})
: min($self->config->skirt_height, scalar(@{$object->layers})); : min($self->config->skirt_height, scalar(@{$object->layers}));

View File

@ -147,15 +147,26 @@ sub export {
my $outer_skirt = convex_hull(\@skirt_points); my $outer_skirt = convex_hull(\@skirt_points);
my @skirts = (); my @skirts = ();
foreach my $extruder_id (@{$self->print->extruders}) { 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; 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 ]); my $convex_hull = convex_hull([ map @$_, @skirts ]);
$gcodegen->ooze_prevention->enable(1); $gcodegen->ooze_prevention->enable(1);
$gcodegen->ooze_prevention->standby_points( $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,
);
}
} }
} }