Fixed unit tests broken with the previous commit (Spiral Vase fix).
Fixed a crash in the previous commit.
This commit is contained in:
parent
76433da64c
commit
e7d2fcf0be
@ -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) {
|
||||
|
36
t/gcode.t
36
t/gcode.t
@ -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';
|
||||
#}
|
||||
|
||||
|
||||
{
|
||||
|
56
t/shells.t
56
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__
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user