Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2014-02-13 19:06:52 +0400
committerAlessandro Ranellucci <aar@cpan.org>2014-02-13 19:11:12 +0400
commit49d290accf838fee25e0c7b8598a4774fef44ad3 (patch)
treea189d79f1ce49590bd32bc729af744c9a22ba36a /t/shells.t
parent0060873f1c01013a02e5a4d66ec868fb8952f794 (diff)
Fixed spiral vase regressions. Includes regression tests. #1773
Diffstat (limited to 't/shells.t')
-rw-r--r--t/shells.t53
1 files changed, 32 insertions, 21 deletions
diff --git a/t/shells.t b/t/shells.t
index 1f9f422d0..492530d74 100644
--- a/t/shells.t
+++ b/t/shells.t
@@ -1,4 +1,4 @@
-use Test::More tests => 17;
+use Test::More tests => 16;
use strict;
use warnings;
@@ -11,7 +11,7 @@ use List::Util qw(first sum);
use Slic3r;
use Slic3r::Geometry qw(epsilon);
use Slic3r::Test;
-goto T;
+
{
my $config = Slic3r::Config->new_from_defaults;
$config->set('skirts', 0);
@@ -148,6 +148,7 @@ goto T;
$config->set('bottom_solid_layers', 0);
$config->set('skirts', 0);
$config->set('first_layer_height', '100%');
+ $config->set('start_gcode', '');
# TODO: this needs to be tested with a model with sloping edges, where starting
# points of each layer are not aligned - in that case we would test that no
@@ -162,25 +163,33 @@ goto T;
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
my ($self, $cmd, $args, $info) = @_;
- $started_extruding = 1 if $info->{extruding};
- push @z_steps, ($args->{Z} - $self->Z)
- if $started_extruding && exists $args->{Z};
- $travel_moves_after_first_extrusion++
- if $info->{travel} && $started_extruding && !exists $args->{Z};
- print "\n\n\n\n" if $info->{travel} && $started_extruding && !exists $args->{Z};
+ if ($cmd eq 'G1') {
+ $started_extruding = 1 if $info->{extruding};
+ push @z_steps, $info->{dist_Z}
+ if $started_extruding && $info->{dist_Z} > 0;
+ $travel_moves_after_first_extrusion++
+ if $info->{travel} && $started_extruding && !exists $args->{Z};
+ }
});
- is $travel_moves_after_first_extrusion, 0, "no gaps in spiral vase ($description)";
- ok !(grep { $_ > $config->layer_height } @z_steps), "no gaps in Z ($description)";
+
+ # we allow one travel move after first extrusion: i.e. when moving to the first
+ # spiral point after moving to second layer (bottom layer had loop clipping, so
+ # we're slightly distant from the starting point of the loop)
+ ok $travel_moves_after_first_extrusion <= 1, "no gaps in spiral vase ($description)";
+ ok !(grep { $_ > $config->layer_height + epsilon } @z_steps), "no gaps in Z ($description)";
};
$test->('20mm_cube', 'solid model');
- $test->('40x10', 'hollow model');
$config->set('z_offset', -10);
$test->('20mm_cube', 'solid model with negative z-offset');
+
+ ### Disabled because the current unreliable medial axis code doesn't
+ ### always produce valid loops.
+ ###$test->('40x10', 'hollow model with negative z-offset');
}
-T: {
+{
my $config = Slic3r::Config->new_from_defaults;
$config->set('spiral_vase', 1);
$config->set('bottom_solid_layers', 0);
@@ -190,8 +199,7 @@ T: {
$config->set('start_gcode', '');
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
- my $first_z_move_done = 0;
- my $first_layer_done = 0;
+ my $z_moves = 0;
my @this_layer = (); # [ dist_Z, dist_XY ], ...
my $bottom_layer_not_flat = 0;
@@ -204,12 +212,14 @@ T: {
my ($self, $cmd, $args, $info) = @_;
if ($cmd eq 'G1') {
- if (!$first_z_move_done) {
- $bottom_layer_not_flat = 1
- if $info->{dist_Z} != $config->layer_height;
- $first_z_move_done = 1;
- } elsif (!$first_layer_done) {
- $first_layer_done = 1 if $info->{dist_Z} > 0;
+ if ($z_moves < 2) {
+ # skip everything up to the second Z move
+ # (i.e. start of second layer)
+ if (exists $args->{Z}) {
+ $z_moves++;
+ $bottom_layer_not_flat = 1
+ if $info->{dist_Z} > 0 && $info->{dist_Z} != $config->layer_height;
+ }
} elsif ($info->{dist_Z} == 0 && $args->{Z}) {
$null_z_moves_not_layer_changes = 1
if $info->{dist_XY} != 0;
@@ -221,6 +231,7 @@ T: {
my $total_dist_XY = sum(map $_->[1], @this_layer);
$sum_of_partial_z_equals_to_layer_height = 1
if abs(sum(map $_->[0], @this_layer) - $config->layer_height) > epsilon;
+ exit if $sum_of_partial_z_equals_to_layer_height;
foreach my $segment (@this_layer) {
# check that segment's dist_Z is proportioned to its dist_XY
$all_layer_segments_have_same_slope = 1
@@ -228,7 +239,7 @@ T: {
}
@this_layer = ();
- } else {
+ } elsif ($info->{extruding} && $info->{dist_XY} > 0) {
$horizontal_extrusions = 1
if $info->{dist_Z} == 0;
push @this_layer, [ $info->{dist_Z}, $info->{dist_XY} ];