Allow value -1 for skirt_height with the meaning of: as tall as the object. This might fix an overflow on 32-bit systems when ooze_prevention is enabled

This commit is contained in:
Alessandro Ranellucci 2013-12-24 15:15:53 +01:00
parent bd133d9434
commit f9d38f6655
3 changed files with 16 additions and 12 deletions

View file

@ -271,7 +271,7 @@ sub validate {
# --skirt-height
die "Invalid value for --skirt-height\n"
if $self->skirt_height < 0;
if $self->skirt_height < -1; # -1 means as tall as the object
# --bridge-flow-ratio
die "Invalid value for --bridge-flow-ratio\n"

View file

@ -48,7 +48,7 @@ sub process_layer {
# check whether we're going to apply spiralvase logic
my $spiralvase = defined $self->spiralvase
&& ($layer->id > 0 || $self->gcodegen->config->brim_width == 0)
&& ($layer->id >= $self->gcodegen->config->skirt_height)
&& ($layer->id >= $self->gcodegen->config->skirt_height && $self->gcodegen->config->skirt_height != -1)
&& ($layer->id >= $self->gcodegen->config->bottom_solid_layers);
# if we're going to apply spiralvase to this layer, disable loop clipping
@ -71,11 +71,12 @@ sub process_layer {
}) . "\n" if $self->gcodegen->config->layer_gcode;
# extrude skirt
if ((values %{$self->skirt_done}) < $self->gcodegen->config->skirt_height && !$self->skirt_done->{$layer->print_z}) {
if (((values %{$self->skirt_done}) < $self->gcodegen->config->skirt_height || $self->gcodegen->config->skirt_height == -1)
&& !$self->skirt_done->{$layer->print_z}) {
$self->gcodegen->set_shift(@{$self->shift});
$gcode .= $self->gcodegen->set_extruder($self->extruders->[0]);
# skip skirt if we have a large brim
if ($layer->id < $self->gcodegen->config->skirt_height) {
if ($layer->id < $self->gcodegen->config->skirt_height || $self->gcodegen->config->skirt_height == -1) {
# distribute skirt loops across all extruders
my @skirt_loops = @{$self->print->skirt};
for my $i (0 .. $#skirt_loops) {

View file

@ -292,7 +292,7 @@ sub init_extruders {
# enforce tall skirt if using ooze_prevention
# NOTE: this is not idempotent (i.e. switching ooze_prevention off will not revert skirt settings)
if ($self->config->ooze_prevention && @{$self->extruders} > 1) {
$self->config->set('skirt_height', 9999999999);
$self->config->set('skirt_height', -1);
$self->config->set('skirts', 1) if $self->config->skirts == 0;
}
}
@ -823,14 +823,17 @@ sub write_gcode {
# calculate wiping points if needed
if ($self->config->ooze_prevention) {
my $outer_skirt = convex_hull([ map @$_, @{$self->skirt} ]);
my @skirts = ();
foreach my $extruder (@{$self->extruders}) {
push @skirts, my $s = $outer_skirt->clone;
$s->translate(map scale($_), @{$extruder->extruder_offset});
my @skirt_points = map @$_, @{$self->skirt};
if (@skirt_points) {
my $outer_skirt = convex_hull(\@skirt_points);
my @skirts = ();
foreach my $extruder (@{$self->extruders}) {
push @skirts, my $s = $outer_skirt->clone;
$s->translate(map scale($_), @{$extruder->extruder_offset});
}
my $convex_hull = convex_hull([ map @$_, @skirts ]);
$gcodegen->standby_points([ map $_->clone, map @$_, map $_->subdivide(scale 10), @{offset([$convex_hull], scale 3)} ]);
}
my $convex_hull = convex_hull([ map @$_, @skirts ]);
$gcodegen->standby_points([ map $_->clone, map @$_, map $_->subdivide(scale 10), @{offset([$convex_hull], scale 3)} ]);
}
# prepare the layer processor