Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_custom_gcode_detection

This commit is contained in:
enricoturri1966 2021-04-22 15:30:27 +02:00
commit 70ec034281
9 changed files with 32 additions and 21 deletions

View file

@ -248,7 +248,7 @@ std::vector<ExPolygons> extract_slices_from_sla_archive(
{ {
double incr, val, prev; double incr, val, prev;
bool stop = false; bool stop = false;
tbb::spin_mutex mutex; tbb::spin_mutex mutex = {};
} st {100. / slices.size(), 0., 0.}; } st {100. / slices.size(), 0., 0.};
tbb::parallel_for(size_t(0), arch.images.size(), tbb::parallel_for(size_t(0), arch.images.size(),
@ -372,6 +372,13 @@ void fill_iniconf(ConfMap &m, const SLAPrint &print)
m["numFast"] = std::to_string(stats.fast_layers_count); m["numFast"] = std::to_string(stats.fast_layers_count);
m["printTime"] = std::to_string(stats.estimated_print_time); m["printTime"] = std::to_string(stats.estimated_print_time);
bool hollow_en = false;
auto it = print.objects().begin();
while (!hollow_en && it != print.objects().end())
hollow_en = (*it++)->config().hollowing_enable;
m["hollow"] = hollow_en ? "1" : "0";
m["action"] = "print"; m["action"] = "print";
} }

View file

@ -21,7 +21,7 @@ use Slic3r::Test;
$config->set('fill_density', 0.4); $config->set('fill_density', 0.4);
$config->set('bottom_solid_layers', 1); $config->set('bottom_solid_layers', 1);
$config->set('first_layer_extrusion_width', 2); $config->set('first_layer_extrusion_width', 2);
$config->set('first_layer_height', '100%'); $config->set('first_layer_height', $config->layer_height);
$config->set('filament_diameter', [ 3.0 ]); $config->set('filament_diameter', [ 3.0 ]);
$config->set('nozzle_diameter', [ 0.5 ]); $config->set('nozzle_diameter', [ 0.5 ]);

View file

@ -49,7 +49,7 @@ use Slic3r::Test qw(_eq);
$config->set('first_layer_height', 0.2); $config->set('first_layer_height', 0.2);
ok $test->(), "absolute first layer height"; ok $test->(), "absolute first layer height";
$config->set('first_layer_height', '60%'); $config->set('first_layer_height', 0.6 * $config->layer_height);
ok $test->(), "relative first layer height"; ok $test->(), "relative first layer height";
$config->set('z_offset', 0.9); $config->set('z_offset', 0.9);

View file

@ -181,7 +181,7 @@ use Slic3r::Test;
my $config = Slic3r::Config::new_from_defaults; my $config = Slic3r::Config::new_from_defaults;
$config->set('nozzle_diameter', [0.6,0.6,0.6,0.6]); $config->set('nozzle_diameter', [0.6,0.6,0.6,0.6]);
$config->set('layer_height', 0.4); $config->set('layer_height', 0.4);
$config->set('first_layer_height', '100%'); $config->set('first_layer_height', $config->layer_height);
$config->set('skirts', 0); $config->set('skirts', 0);
my $print = Slic3r::Test::init_print($model, config => $config); my $print = Slic3r::Test::init_print($model, config => $config);

View file

@ -84,7 +84,7 @@ use Slic3r::Test;
{ {
my $config = Slic3r::Config::new_from_defaults; my $config = Slic3r::Config::new_from_defaults;
$config->set('layer_height', 0.3); $config->set('layer_height', 0.3);
$config->set('first_layer_height', '100%'); $config->set('first_layer_height', $config->layer_height);
$config->set('bottom_solid_layers', 0); $config->set('bottom_solid_layers', 0);
$config->set('top_solid_layers', 3); $config->set('top_solid_layers', 3);
$config->set('cooling', [ 0 ]); $config->set('cooling', [ 0 ]);
@ -119,7 +119,7 @@ use Slic3r::Test;
$config->set('cooling', [ 0 ]); # prevent speed alteration $config->set('cooling', [ 0 ]); # prevent speed alteration
$config->set('first_layer_speed', '100%'); # prevent speed alteration $config->set('first_layer_speed', '100%'); # prevent speed alteration
$config->set('layer_height', 0.4); $config->set('layer_height', 0.4);
$config->set('first_layer_height', '100%'); $config->set('first_layer_height', $config->layer_height);
$config->set('extrusion_width', 0.55); $config->set('extrusion_width', 0.55);
$config->set('bottom_solid_layers', 3); $config->set('bottom_solid_layers', 3);
$config->set('top_solid_layers', 0); $config->set('top_solid_layers', 0);
@ -142,7 +142,7 @@ use Slic3r::Test;
$config->set('cooling', [ 0 ]); # prevent speed alteration $config->set('cooling', [ 0 ]); # prevent speed alteration
$config->set('first_layer_speed', '100%'); # prevent speed alteration $config->set('first_layer_speed', '100%'); # prevent speed alteration
$config->set('layer_height', 0.4); $config->set('layer_height', 0.4);
$config->set('first_layer_height', '100%'); $config->set('first_layer_height', $config->layer_height);
$config->set('bottom_solid_layers', 3); $config->set('bottom_solid_layers', 3);
$config->set('top_solid_layers', 3); $config->set('top_solid_layers', 3);
$config->set('solid_infill_speed', 99); $config->set('solid_infill_speed', 99);
@ -170,7 +170,7 @@ use Slic3r::Test;
$config->set('spiral_vase', 1); $config->set('spiral_vase', 1);
$config->set('bottom_solid_layers', 0); $config->set('bottom_solid_layers', 0);
$config->set('skirts', 0); $config->set('skirts', 0);
$config->set('first_layer_height', '100%'); $config->set('first_layer_height', $config->layer_height);
$config->set('start_gcode', ''); $config->set('start_gcode', '');
$config->set('temperature', [200]); $config->set('temperature', [200]);
$config->set('first_layer_temperature', [205]); $config->set('first_layer_temperature', [205]);
@ -231,8 +231,8 @@ use Slic3r::Test;
$config->set('bottom_solid_layers', 0); $config->set('bottom_solid_layers', 0);
$config->set('retract_layer_change', [0]); $config->set('retract_layer_change', [0]);
$config->set('skirts', 0); $config->set('skirts', 0);
$config->set('first_layer_height', '100%');
$config->set('layer_height', 0.4); $config->set('layer_height', 0.4);
$config->set('first_layer_height', $config->layer_height);
$config->set('start_gcode', ''); $config->set('start_gcode', '');
# $config->set('use_relative_e_distances', 1); # $config->set('use_relative_e_distances', 1);
$config->validate; $config->validate;
@ -310,7 +310,7 @@ use Slic3r::Test;
# $config->set('spiral_vase', 1); # $config->set('spiral_vase', 1);
# $config->set('bottom_solid_layers', 0); # $config->set('bottom_solid_layers', 0);
# $config->set('skirts', 0); # $config->set('skirts', 0);
# $config->set('first_layer_height', '100%'); # $config->set('first_layer_height', $config->layer_height);
# $config->set('start_gcode', ''); # $config->set('start_gcode', '');
# #
# my $print = Slic3r::Test::init_print('two_hollow_squares', config => $config); # my $print = Slic3r::Test::init_print('two_hollow_squares', config => $config);

View file

@ -18,7 +18,7 @@ use Slic3r::Test;
if (0) { if (0) {
my $config = Slic3r::Config::new_from_defaults; my $config = Slic3r::Config::new_from_defaults;
$config->set('layer_height', 0.2); $config->set('layer_height', 0.2);
$config->set('first_layer_height', '100%'); $config->set('first_layer_height', $config->layer_height);
$config->set('extrusion_width', 0.5); $config->set('extrusion_width', 0.5);
$config->set('first_layer_extrusion_width', '200%'); # check this one too $config->set('first_layer_extrusion_width', '200%'); # check this one too
$config->set('skirts', 0); $config->set('skirts', 0);

View file

@ -24,7 +24,7 @@ SCENARIO("Extrusion width specifics", "[Flow]") {
{ "skirts", 1 }, { "skirts", 1 },
{ "perimeters", 3 }, { "perimeters", 3 },
{ "fill_density", "40%" }, { "fill_density", "40%" },
{ "first_layer_height", "100%" } { "first_layer_height", 0.3 }
}); });
WHEN("first layer width set to 2mm") { WHEN("first layer width set to 2mm") {

View file

@ -14,9 +14,12 @@ SCENARIO("Placeholder parser scripting", "[PlaceholderParser]") {
{ "nozzle_diameter", "0.6;0.6;0.6;0.6" }, { "nozzle_diameter", "0.6;0.6;0.6;0.6" },
{ "temperature", "357;359;363;378" } { "temperature", "357;359;363;378" }
}); });
// To test the "first_layer_extrusion_width" over "first_layer_heigth" over "layer_height" chain. // To test the "first_layer_extrusion_width" over "first_layer_heigth".
config.option<ConfigOptionFloatOrPercent>("first_layer_height")->value = 150.; // "first_layer_heigth" over "layer_height" is no more supported after first_layer_height was moved from PrintObjectConfig to PrintConfig.
config.option<ConfigOptionFloatOrPercent>("first_layer_height")->percent = true; // config.option<ConfigOptionFloatOrPercent>("first_layer_height")->value = 150.;
// config.option<ConfigOptionFloatOrPercent>("first_layer_height")->percent = true;
config.option<ConfigOptionFloatOrPercent>("first_layer_height")->value = 1.5 * config.opt_float("layer_height");
config.option<ConfigOptionFloatOrPercent>("first_layer_height")->percent = false;
// To let the PlaceholderParser throw when referencing first_layer_speed if it is set to percent, as the PlaceholderParser does not know // To let the PlaceholderParser throw when referencing first_layer_speed if it is set to percent, as the PlaceholderParser does not know
// a percent to what. // a percent to what.
config.option<ConfigOptionFloatOrPercent>("first_layer_speed")->value = 50.; config.option<ConfigOptionFloatOrPercent>("first_layer_speed")->value = 50.;
@ -50,7 +53,7 @@ SCENARIO("Placeholder parser scripting", "[PlaceholderParser]") {
SECTION("math: int(-13.4)") { REQUIRE(parser.process("{int(-13.4)}") == "-13"); } SECTION("math: int(-13.4)") { REQUIRE(parser.process("{int(-13.4)}") == "-13"); }
// Test the "coFloatOrPercent" and "xxx_extrusion_width" substitutions. // Test the "coFloatOrPercent" and "xxx_extrusion_width" substitutions.
// first_layer_extrusion_width ratio_over first_layer_heigth ratio_over layer_height // first_layer_extrusion_width ratio_over first_layer_heigth.
SECTION("perimeter_extrusion_width") { REQUIRE(std::stod(parser.process("{perimeter_extrusion_width}")) == Approx(0.67500001192092896)); } SECTION("perimeter_extrusion_width") { REQUIRE(std::stod(parser.process("{perimeter_extrusion_width}")) == Approx(0.67500001192092896)); }
SECTION("first_layer_extrusion_width") { REQUIRE(std::stod(parser.process("{first_layer_extrusion_width}")) == Approx(0.9)); } SECTION("first_layer_extrusion_width") { REQUIRE(std::stod(parser.process("{first_layer_extrusion_width}")) == Approx(0.9)); }
SECTION("support_material_xy_spacing") { REQUIRE(std::stod(parser.process("{support_material_xy_spacing}")) == Approx(0.3375)); } SECTION("support_material_xy_spacing") { REQUIRE(std::stod(parser.process("{support_material_xy_spacing}")) == Approx(0.3375)); }

View file

@ -4,7 +4,7 @@ use strict;
use warnings; use warnings;
use Slic3r::XS; use Slic3r::XS;
use Test::More tests => 147; use Test::More tests => 143;
foreach my $config (Slic3r::Config->new, Slic3r::Config::Static::new_FullPrintConfig) { foreach my $config (Slic3r::Config->new, Slic3r::Config::Static::new_FullPrintConfig) {
$config->set('layer_height', 0.3); $config->set('layer_height', 0.3);
@ -70,10 +70,11 @@ foreach my $config (Slic3r::Config->new, Slic3r::Config::Static::new_FullPrintCo
ok abs($config->get('first_layer_height') - 0.3) < 1e-4, 'set/get absolute floatOrPercent'; ok abs($config->get('first_layer_height') - 0.3) < 1e-4, 'set/get absolute floatOrPercent';
is $config->opt_serialize('first_layer_height'), '0.3', 'serialize absolute floatOrPercent'; is $config->opt_serialize('first_layer_height'), '0.3', 'serialize absolute floatOrPercent';
$config->set('first_layer_height', '50%'); # This is no more supported after first_layer_height was moved from PrintObjectConfig to PrintConfig.
$config->get_abs_value('first_layer_height'); # $config->set('first_layer_height', $config->get('layer_height'));
ok abs($config->get_abs_value('first_layer_height') - 0.15) < 1e-4, 'set/get relative floatOrPercent'; # $config->get_abs_value('first_layer_height');
is $config->opt_serialize('first_layer_height'), '50%', 'serialize relative floatOrPercent'; # ok abs($config->get_abs_value('first_layer_height') - 0.15) < 1e-4, 'set/get relative floatOrPercent';
# is $config->opt_serialize('first_layer_height'), '50%', 'serialize relative floatOrPercent';
# Uh-oh, we have no point option to test at the moment # Uh-oh, we have no point option to test at the moment
#ok $config->set('print_center', [50,80]), 'valid point coordinates'; #ok $config->set('print_center', [50,80]), 'valid point coordinates';