diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2014-03-01 23:34:22 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2014-03-01 23:35:44 +0400 |
commit | a344d68257f4333daec3658d09c0a6d353f7ed32 (patch) | |
tree | 23ebbee3a489c766d63d04c79e6684e3489cba72 /t/shells.t | |
parent | 344a517ce8432db944f65659ce6d7577fe05a053 (diff) |
Use bridge speed for first solid layer above sparse infill. Includes unit test. #1792
Diffstat (limited to 't/shells.t')
-rw-r--r-- | t/shells.t | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/t/shells.t b/t/shells.t index 3d6bbfcb2..8fb2b9bb8 100644 --- a/t/shells.t +++ b/t/shells.t @@ -18,6 +18,7 @@ use Slic3r::Test; $config->set('perimeters', 0); $config->set('solid_infill_speed', 99); $config->set('top_solid_infill_speed', 99); + $config->set('bridge_speed', 72); $config->set('first_layer_speed', '100%'); $config->set('cooling', 0); @@ -27,19 +28,25 @@ use Slic3r::Test; my $print = Slic3r::Test::init_print('20mm_cube', config => $config); - my %layers_with_shells = (); # Z => $count + my %z = (); # Z => 1 + my %layers_with_solid_infill = (); # Z => $count + my %layers_with_bridge_infill = (); # Z => $count Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub { my ($self, $cmd, $args, $info) = @_; if ($self->Z > 0) { - $layers_with_shells{$self->Z} //= 0; - $layers_with_shells{$self->Z} = 1 - if $info->{extruding} - && $info->{dist_XY} > 0 - && ($args->{F} // $self->F) == $config->solid_infill_speed*60; + $z{ $self->Z } = 1; + if ($info->{extruding} && $info->{dist_XY} > 0) { + my $F = $args->{F} // $self->F; + $layers_with_solid_infill{$self->Z} = 1 + if $F == $config->solid_infill_speed*60; + $layers_with_bridge_infill{$self->Z} = 1 + if $F == $config->bridge_speed*60; + } } }); - my @shells = @layers_with_shells{sort { $a <=> $b } keys %layers_with_shells}; + my @z = sort { $a <=> $b } keys %z; + my @shells = map $layers_with_solid_infill{$_} || $layers_with_bridge_infill{$_}, @z; fail "insufficient number of bottom solid layers" unless !defined(first { !$_ } @shells[0..$config->bottom_solid_layers-1]); fail "excessive number of bottom solid layers" @@ -48,9 +55,17 @@ use Slic3r::Test; unless !defined(first { !$_ } @shells[-$config->top_solid_layers..-1]); fail "excessive number of top solid layers" unless scalar(grep $_, @shells[($#shells/2)..$#shells]) == $config->top_solid_layers; + if ($config->top_solid_layers > 0) { + fail "unexpected solid infill speed in first solid layer over sparse infill" + if $layers_with_solid_infill{ $z[-$config->top_solid_layers] }; + die "bridge speed not used in first solid layer over sparse infill" + if !$layers_with_bridge_infill{ $z[-$config->top_solid_layers] }; + } 1; }; + $config->set('top_solid_layers', 3); + $config->set('bottom_solid_layers', 3); ok $test->(), "proper number of shells is applied"; $config->set('top_solid_layers', 0); @@ -69,6 +84,7 @@ use Slic3r::Test; $config->set('bottom_solid_layers', 0); $config->set('top_solid_layers', 3); $config->set('cooling', 0); + $config->set('bridge_speed', 99); $config->set('solid_infill_speed', 99); $config->set('top_solid_infill_speed', 99); $config->set('first_layer_speed', '100%'); |