diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2014-03-02 03:28:10 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2014-03-02 03:31:17 +0400 |
commit | 2295d489478febf12b46119d6f844404b6d1a968 (patch) | |
tree | 657c206e23db08c85a38dc586172bf5de77d50d4 /t/thin.t | |
parent | a344d68257f4333daec3658d09c0a6d353f7ed32 (diff) |
Better pruning of thin walls to avoid unwanted extra extrusions. Includes regression test. #1794
Conflicts:
lib/Slic3r/Layer/Region.pm
Diffstat (limited to 't/thin.t')
-rw-r--r-- | t/thin.t | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/t/thin.t b/t/thin.t new file mode 100644 index 000000000..09b060d8b --- /dev/null +++ b/t/thin.t @@ -0,0 +1,48 @@ +use Test::More tests => 1; +use strict; +use warnings; + +BEGIN { + use FindBin; + use lib "$FindBin::Bin/../lib"; +} + +use Slic3r; +use List::Util qw(first); +use Slic3r::Geometry qw(epsilon); +use Slic3r::Test; + +{ + my $config = Slic3r::Config->new_from_defaults; + $config->set('layer_height', 0.2); + $config->set('first_layer_height', '100%'); + $config->set('extrusion_width', 0.5); + $config->set('first_layer_extrusion_width', '200%'); # check this one too + $config->set('skirts', 0); + $config->set('thin_walls', 1); + + my $print = Slic3r::Test::init_print('gt2_teeth', config => $config); + + my %extrusion_paths = (); # Z => count of continuous extrusions + my $extruding = 0; + Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub { + my ($self, $cmd, $args, $info) = @_; + + if ($cmd eq 'G1') { + if ($info->{extruding} && $info->{dist_XY}) { + if (!$extruding) { + $extrusion_paths{$self->Z} //= 0; + $extrusion_paths{$self->Z}++; + } + $extruding = 1; + } else { + $extruding = 0; + } + } + }); + + ok !(first { $_ != 3 } values %extrusion_paths), + 'no superfluous thin walls are generated for toothed profile'; +} + +__END__ |