diff options
author | bubnikv <bubnikv@gmail.com> | 2020-02-09 11:43:15 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2020-02-09 11:43:15 +0300 |
commit | e7d2fcf0be7a524eb8bf40dd2964539534934e96 (patch) | |
tree | f90c96c4859a2371b41a51f045997793108988bf | |
parent | 76433da64c24c5aa73ac247bf963fef9c313dadf (diff) |
Fixed unit tests broken with the previous commit (Spiral Vase fix).
Fixed a crash in the previous commit.
-rw-r--r-- | src/libslic3r/PrintObject.cpp | 4 | ||||
-rw-r--r-- | t/gcode.t | 36 | ||||
-rw-r--r-- | t/shells.t | 56 | ||||
-rw-r--r-- | tests/sla_print/sla_print_tests.cpp | 2 | ||||
-rw-r--r-- | tests/sla_print/sla_test_utils.cpp | 2 | ||||
-rw-r--r-- | xs/xsp/TriangleMesh.xsp | 2 |
6 files changed, 53 insertions, 49 deletions
diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 04277f931..60ee24e80 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -829,7 +829,7 @@ void PrintObject::detect_surfaces_type() // Fill in layerm->fill_surfaces by trimming the layerm->slices by the cummulative layerm->fill_surfaces. tbb::parallel_for( tbb::blocked_range<size_t>(0, m_layers.size()), - [this, idx_region, interface_shells, &surfaces_new](const tbb::blocked_range<size_t>& range) { + [this, idx_region, interface_shells](const tbb::blocked_range<size_t>& range) { for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) { m_print->throw_if_canceled(); LayerRegion *layerm = m_layers[idx_layer]->m_regions[idx_region]; @@ -1145,7 +1145,7 @@ void PrintObject::discover_vertical_shells() coordf_t print_z = layer->print_z; int n_top_layers = region_config.top_solid_layers.value; for (int i = int(idx_layer) + 1; - i < int(m_layers.size()) && + i < int(cache_top_botom_regions.size()) && (i < int(idx_layer) + n_top_layers || m_layers[i]->print_z - print_z < region_config.top_solid_min_thickness - EPSILON); ++ i) { @@ -1,4 +1,4 @@ -use Test::More tests => 25; +use Test::More tests => 24; use strict; use warnings; @@ -199,22 +199,24 @@ use Slic3r::Test; like $gcode, qr/START:20mm_cube/, '[input_filename] is also available in custom G-code'; } -{ - my $config = Slic3r::Config::new_from_defaults; - $config->set('spiral_vase', 1); - my $print = Slic3r::Test::init_print('cube_with_hole', config => $config); - - my $spiral = 0; - Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub { - my ($self, $cmd, $args, $info) = @_; - - if ($cmd eq 'G1' && exists $args->{E} && exists $args->{Z}) { - $spiral = 1; - } - }); - - ok !$spiral, 'spiral vase is correctly disabled on layers with multiple loops'; -} +# The current Spiral Vase slicing code removes the holes and all but the largest contours from each slice, +# therefore the following test is no more valid. +#{ +# my $config = Slic3r::Config::new_from_defaults; +# $config->set('spiral_vase', 1); +# my $print = Slic3r::Test::init_print('cube_with_hole', config => $config); +# +# my $spiral = 0; +# Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub { +# my ($self, $cmd, $args, $info) = @_; +# +# if ($cmd eq 'G1' && exists $args->{E} && exists $args->{Z}) { +# $spiral = 1; +# } +# }); +# +# ok !$spiral, 'spiral vase is correctly disabled on layers with multiple loops'; +#} { diff --git a/t/shells.t b/t/shells.t index dc38ff4aa..c40131590 100644 --- a/t/shells.t +++ b/t/shells.t @@ -1,4 +1,4 @@ -use Test::More tests => 21; +use Test::More tests => 20; use strict; use warnings; @@ -293,31 +293,33 @@ use Slic3r::Test; ok !$horizontal_extrusions, 'no horizontal extrusions'; } -{ - my $config = Slic3r::Config::new_from_defaults; - $config->set('perimeters', 1); - $config->set('fill_density', 0); - $config->set('top_solid_layers', 0); - $config->set('spiral_vase', 1); - $config->set('bottom_solid_layers', 0); - $config->set('skirts', 0); - $config->set('first_layer_height', '100%'); - $config->set('start_gcode', ''); - - my $print = Slic3r::Test::init_print('two_hollow_squares', config => $config); - my $diagonal_moves = 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} > 0) { - if ($info->{dist_Z} > 0) { - $diagonal_moves++; - } - } - } - }); - is $diagonal_moves, 0, 'no spiral moves on two-island object'; -} +# The current Spiral Vase slicing code removes the holes and all but the largest contours from each slice, +# therefore the following test is no more valid. +#{ +# my $config = Slic3r::Config::new_from_defaults; +# $config->set('perimeters', 1); +# $config->set('fill_density', 0); +# $config->set('top_solid_layers', 0); +# $config->set('spiral_vase', 1); +# $config->set('bottom_solid_layers', 0); +# $config->set('skirts', 0); +# $config->set('first_layer_height', '100%'); +# $config->set('start_gcode', ''); +# +# my $print = Slic3r::Test::init_print('two_hollow_squares', config => $config); +# my $diagonal_moves = 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} > 0) { +# if ($info->{dist_Z} > 0) { +# $diagonal_moves++; +# } +# } +# } +# }); +# is $diagonal_moves, 0, 'no spiral moves on two-island object'; +#} __END__ diff --git a/tests/sla_print/sla_print_tests.cpp b/tests/sla_print/sla_print_tests.cpp index 32bca4ec0..10f5742d3 100644 --- a/tests/sla_print/sla_print_tests.cpp +++ b/tests/sla_print/sla_print_tests.cpp @@ -54,7 +54,7 @@ TEST_CASE("Support point generator should be deterministic if seeded", auto slicegrid = grid(float(gnd), float(zmax), layer_h); std::vector<ExPolygons> slices; - slicer.slice(slicegrid, CLOSING_RADIUS, &slices, []{}); + slicer.slice(slicegrid, SlicingMode::Regular, CLOSING_RADIUS, &slices, []{}); point_gen.seed(0); point_gen.execute(slices, slicegrid); diff --git a/tests/sla_print/sla_test_utils.cpp b/tests/sla_print/sla_test_utils.cpp index 44a15ff90..a844b2eae 100644 --- a/tests/sla_print/sla_test_utils.cpp +++ b/tests/sla_print/sla_test_utils.cpp @@ -98,7 +98,7 @@ void test_supports(const std::string &obj_filename, auto layer_h = 0.05f; out.slicegrid = grid(float(gnd), float(zmax), layer_h); - slicer.slice(out.slicegrid , CLOSING_RADIUS, &out.model_slices, []{}); + slicer.slice(out.slicegrid, SlicingMode::Regular, CLOSING_RADIUS, &out.model_slices, []{}); sla::cut_drainholes(out.model_slices, out.slicegrid, CLOSING_RADIUS, drainholes, []{}); // Create the special index-triangle mesh with spatial indexing which diff --git a/xs/xsp/TriangleMesh.xsp b/xs/xsp/TriangleMesh.xsp index f3153665c..230f8b2a5 100644 --- a/xs/xsp/TriangleMesh.xsp +++ b/xs/xsp/TriangleMesh.xsp @@ -182,7 +182,7 @@ TriangleMesh::slice(z) std::vector<ExPolygons> layers; TriangleMeshSlicer mslicer(THIS); - mslicer.slice(z_f, 0.049f, &layers, [](){}); + mslicer.slice(z_f, SlicingMode::Regular, 0.049f, &layers, [](){}); AV* layers_av = newAV(); size_t len = layers.size(); |