Merge branch 'master' into fs_CenterSupportForIsland

This commit is contained in:
Filip Sykala 2021-04-21 17:31:49 +02:00
commit 5af87d285b
23 changed files with 71 additions and 58 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 221 KiB

View File

@ -471,8 +471,8 @@ bool ConfigBase::set_deserialize_nothrow(const t_config_option_key &opt_key_src,
{ {
t_config_option_key opt_key = opt_key_src; t_config_option_key opt_key = opt_key_src;
std::string value = value_src; std::string value = value_src;
// Both opt_key and value may be modified by _handle_legacy(). // Both opt_key and value may be modified by handle_legacy().
// If the opt_key is no more valid in this version of Slic3r, opt_key is cleared by _handle_legacy(). // If the opt_key is no more valid in this version of Slic3r, opt_key is cleared by handle_legacy().
this->handle_legacy(opt_key, value); this->handle_legacy(opt_key, value);
if (opt_key.empty()) if (opt_key.empty())
// Ignore the option. // Ignore the option.

View File

@ -89,18 +89,11 @@ double Flow::extrusion_width(const std::string& opt_key, const ConfigOptionFloat
if (opt->percent) { if (opt->percent) {
auto opt_key_layer_height = first_layer ? "first_layer_height" : "layer_height"; auto opt_key_layer_height = first_layer ? "first_layer_height" : "layer_height";
auto opt_layer_height = config.option(opt_key_layer_height); auto opt_layer_height = config.option(opt_key_layer_height);
if (opt_layer_height == nullptr) if (opt_layer_height == nullptr)
throw_on_missing_variable(opt_key, opt_key_layer_height); throw_on_missing_variable(opt_key, opt_key_layer_height);
double layer_height = opt_layer_height->getFloat(); assert(! first_layer || ! static_cast<const ConfigOptionFloatOrPercent*>(opt_layer_height)->percent);
if (first_layer && static_cast<const ConfigOptionFloatOrPercent*>(opt_layer_height)->percent) { return opt->get_abs_value(opt_layer_height->getFloat());
// first_layer_height depends on layer_height.
opt_layer_height = config.option("layer_height");
if (opt_layer_height == nullptr)
throw_on_missing_variable(opt_key, "layer_height");
layer_height *= 0.01 * opt_layer_height->getFloat();
}
return opt->get_abs_value(layer_height);
} }
if (opt->value == 0.) { if (opt->value == 0.) {
@ -238,13 +231,14 @@ Flow support_material_flow(const PrintObject *object, float layer_height)
Flow support_material_1st_layer_flow(const PrintObject *object, float layer_height) Flow support_material_1st_layer_flow(const PrintObject *object, float layer_height)
{ {
const auto &width = (object->print()->config().first_layer_extrusion_width.value > 0) ? object->print()->config().first_layer_extrusion_width : object->config().support_material_extrusion_width; const PrintConfig &print_config = object->print()->config();
const auto &width = (print_config.first_layer_extrusion_width.value > 0) ? print_config.first_layer_extrusion_width : object->config().support_material_extrusion_width;
return Flow::new_from_config_width( return Flow::new_from_config_width(
frSupportMaterial, frSupportMaterial,
// The width parameter accepted by new_from_config_width is of type ConfigOptionFloatOrPercent, the Flow class takes care of the percent to value substitution. // The width parameter accepted by new_from_config_width is of type ConfigOptionFloatOrPercent, the Flow class takes care of the percent to value substitution.
(width.value > 0) ? width : object->config().extrusion_width, (width.value > 0) ? width : object->config().extrusion_width,
float(object->print()->config().nozzle_diameter.get_at(object->config().support_material_extruder-1)), float(print_config.nozzle_diameter.get_at(object->config().support_material_extruder-1)),
(layer_height > 0.f) ? layer_height : float(object->config().first_layer_height.get_abs_value(object->config().layer_height.value))); (layer_height > 0.f) ? layer_height : float(print_config.first_layer_height.get_abs_value(object->config().layer_height.value)));
} }
Flow support_material_interface_flow(const PrintObject *object, float layer_height) Flow support_material_interface_flow(const PrintObject *object, float layer_height)

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

@ -1111,7 +1111,8 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
// Write some terse information on the slicing parameters. // Write some terse information on the slicing parameters.
const PrintObject *first_object = print.objects().front(); const PrintObject *first_object = print.objects().front();
const double layer_height = first_object->config().layer_height.value; const double layer_height = first_object->config().layer_height.value;
const double first_layer_height = first_object->config().first_layer_height.get_abs_value(layer_height); assert(! print.config().first_layer_height.percent);
const double first_layer_height = print.config().first_layer_height.value;
for (const PrintRegion* region : print.regions()) { for (const PrintRegion* region : print.regions()) {
_write_format(file, "; external perimeters extrusion width = %.2fmm\n", region->flow(*first_object, frExternalPerimeter, layer_height).width()); _write_format(file, "; external perimeters extrusion width = %.2fmm\n", region->flow(*first_object, frExternalPerimeter, layer_height).width());
_write_format(file, "; perimeters extrusion width = %.2fmm\n", region->flow(*first_object, frPerimeter, layer_height).width()); _write_format(file, "; perimeters extrusion width = %.2fmm\n", region->flow(*first_object, frPerimeter, layer_height).width());

View File

@ -296,6 +296,13 @@ void Preset::normalize(DynamicPrintConfig &config)
if (auto *gap_fill_enabled = config.option<ConfigOptionBool>("gap_fill_enabled", false); gap_fill_enabled) if (auto *gap_fill_enabled = config.option<ConfigOptionBool>("gap_fill_enabled", false); gap_fill_enabled)
gap_fill_enabled->value = false; gap_fill_enabled->value = false;
} }
if (auto *first_layer_height = config.option<ConfigOptionFloatOrPercent>("first_layer_height", false); first_layer_height && first_layer_height->percent)
if (const auto *layer_height = config.option<ConfigOptionFloat>("layer_height", false); layer_height) {
// Legacy conversion - first_layer_height moved from PrintObject setting to a Print setting, thus we are getting rid of the dependency
// of first_layer_height on PrintObject specific layer_height. Covert the first layer heigth to an absolute value.
first_layer_height->value = first_layer_height->get_abs_value(layer_height->value);
first_layer_height->percent = false;
}
} }
std::string Preset::remove_invalid_keys(DynamicPrintConfig &config, const DynamicPrintConfig &default_config) std::string Preset::remove_invalid_keys(DynamicPrintConfig &config, const DynamicPrintConfig &default_config)

View File

@ -1464,7 +1464,8 @@ std::string Print::validate(std::string* warning) const
} }
// validate first_layer_height // validate first_layer_height
double first_layer_height = object->config().get_abs_value("first_layer_height"); assert(! m_config.first_layer_height.percent);
double first_layer_height = m_config.first_layer_height.value;
double first_layer_min_nozzle_diameter; double first_layer_min_nozzle_diameter;
if (object->has_raft()) { if (object->has_raft()) {
// if we have raft layers, only support material extruder is used on first layer // if we have raft layers, only support material extruder is used on first layer
@ -1561,9 +1562,8 @@ BoundingBox Print::total_bounding_box() const
double Print::skirt_first_layer_height() const double Print::skirt_first_layer_height() const
{ {
if (m_objects.empty()) assert(! m_config.first_layer_height.percent);
throw Slic3r::InvalidArgument("skirt_first_layer_height() can't be called without PrintObjects"); return m_config.first_layer_height.value;
return m_objects.front()->config().get_abs_value("first_layer_height");
} }
Flow Print::brim_flow() const Flow Print::brim_flow() const

View File

@ -995,10 +995,8 @@ void PrintConfigDef::init_fff_params()
def->label = L("First layer height"); def->label = L("First layer height");
def->category = L("Layers and Perimeters"); def->category = L("Layers and Perimeters");
def->tooltip = L("When printing with very low layer heights, you might still want to print a thicker " def->tooltip = L("When printing with very low layer heights, you might still want to print a thicker "
"bottom layer to improve adhesion and tolerance for non perfect build plates. " "bottom layer to improve adhesion and tolerance for non perfect build plates.");
"This can be expressed as an absolute value or as a percentage (for example: 150%) " def->sidetext = L("mm");
"over the default layer height.");
def->sidetext = L("mm or %");
def->ratio_over = "layer_height"; def->ratio_over = "layer_height";
def->set_default_value(new ConfigOptionFloatOrPercent(0.35, false)); def->set_default_value(new ConfigOptionFloatOrPercent(0.35, false));
@ -3628,7 +3626,7 @@ std::string FullPrintConfig::validate()
return "--layer-height must be a multiple of print resolution"; return "--layer-height must be a multiple of print resolution";
// --first-layer-height // --first-layer-height
if (this->get_abs_value("first_layer_height") <= 0) if (first_layer_height.value <= 0)
return "Invalid value for --first-layer-height"; return "Invalid value for --first-layer-height";
// --filament-diameter // --filament-diameter

View File

@ -496,7 +496,6 @@ public:
ConfigOptionBool dont_support_bridges; ConfigOptionBool dont_support_bridges;
ConfigOptionFloat elefant_foot_compensation; ConfigOptionFloat elefant_foot_compensation;
ConfigOptionFloatOrPercent extrusion_width; ConfigOptionFloatOrPercent extrusion_width;
ConfigOptionFloatOrPercent first_layer_height;
ConfigOptionBool infill_only_where_needed; ConfigOptionBool infill_only_where_needed;
// Force the generation of solid shells between adjacent materials/volumes. // Force the generation of solid shells between adjacent materials/volumes.
ConfigOptionBool interface_shells; ConfigOptionBool interface_shells;
@ -555,7 +554,6 @@ protected:
OPT_PTR(dont_support_bridges); OPT_PTR(dont_support_bridges);
OPT_PTR(elefant_foot_compensation); OPT_PTR(elefant_foot_compensation);
OPT_PTR(extrusion_width); OPT_PTR(extrusion_width);
OPT_PTR(first_layer_height);
OPT_PTR(infill_only_where_needed); OPT_PTR(infill_only_where_needed);
OPT_PTR(interface_shells); OPT_PTR(interface_shells);
OPT_PTR(layer_height); OPT_PTR(layer_height);
@ -950,6 +948,7 @@ public:
ConfigOptionFloat first_layer_acceleration; ConfigOptionFloat first_layer_acceleration;
ConfigOptionInts first_layer_bed_temperature; ConfigOptionInts first_layer_bed_temperature;
ConfigOptionFloatOrPercent first_layer_extrusion_width; ConfigOptionFloatOrPercent first_layer_extrusion_width;
ConfigOptionFloatOrPercent first_layer_height;
ConfigOptionFloatOrPercent first_layer_speed; ConfigOptionFloatOrPercent first_layer_speed;
ConfigOptionInts first_layer_temperature; ConfigOptionInts first_layer_temperature;
ConfigOptionInts full_fan_speed_layer; ConfigOptionInts full_fan_speed_layer;
@ -1025,6 +1024,7 @@ protected:
OPT_PTR(first_layer_acceleration); OPT_PTR(first_layer_acceleration);
OPT_PTR(first_layer_bed_temperature); OPT_PTR(first_layer_bed_temperature);
OPT_PTR(first_layer_extrusion_width); OPT_PTR(first_layer_extrusion_width);
OPT_PTR(first_layer_height);
OPT_PTR(first_layer_speed); OPT_PTR(first_layer_speed);
OPT_PTR(first_layer_temperature); OPT_PTR(first_layer_temperature);
OPT_PTR(full_fan_speed_layer); OPT_PTR(full_fan_speed_layer);

View File

@ -64,9 +64,9 @@ SlicingParameters SlicingParameters::create_from_config(
coordf_t object_height, coordf_t object_height,
const std::vector<unsigned int> &object_extruders) const std::vector<unsigned int> &object_extruders)
{ {
coordf_t first_layer_height = (object_config.first_layer_height.value <= 0) ? assert(! print_config.first_layer_height.percent);
object_config.layer_height.value : coordf_t first_layer_height = (print_config.first_layer_height.value <= 0) ?
object_config.first_layer_height.get_abs_value(object_config.layer_height.value); object_config.layer_height.value : print_config.first_layer_height.value;
// If object_config.support_material_extruder == 0 resp. object_config.support_material_interface_extruder == 0, // If object_config.support_material_extruder == 0 resp. object_config.support_material_interface_extruder == 0,
// print_config.nozzle_diameter.get_at(size_t(-1)) returns the 0th nozzle diameter, // print_config.nozzle_diameter.get_at(size_t(-1)) returns the 0th nozzle diameter,
// which is consistent with the requirement that if support_material_extruder == 0 resp. support_material_interface_extruder == 0, // which is consistent with the requirement that if support_material_extruder == 0 resp. support_material_interface_extruder == 0,

View File

@ -45,7 +45,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
// layer_height shouldn't be equal to zero // layer_height shouldn't be equal to zero
if (config->opt_float("layer_height") < EPSILON) if (config->opt_float("layer_height") < EPSILON)
{ {
const wxString msg_text = _(L("Zero layer height is not valid.\n\nThe layer height will be reset to 0.01.")); const wxString msg_text = _(L("Layer height is not valid.\n\nThe layer height will be reset to 0.01."));
wxMessageDialog dialog(nullptr, msg_text, _(L("Layer height")), wxICON_WARNING | wxOK); wxMessageDialog dialog(nullptr, msg_text, _(L("Layer height")), wxICON_WARNING | wxOK);
DynamicPrintConfig new_conf = *config; DynamicPrintConfig new_conf = *config;
is_msg_dlg_already_exist = true; is_msg_dlg_already_exist = true;
@ -55,9 +55,9 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
is_msg_dlg_already_exist = false; is_msg_dlg_already_exist = false;
} }
if (fabs(config->option<ConfigOptionFloatOrPercent>("first_layer_height")->value - 0) < EPSILON) if (config->option<ConfigOptionFloatOrPercent>("first_layer_height")->value < EPSILON)
{ {
const wxString msg_text = _(L("Zero first layer height is not valid.\n\nThe first layer height will be reset to 0.01.")); const wxString msg_text = _(L("First layer height is not valid.\n\nThe first layer height will be reset to 0.01."));
wxMessageDialog dialog(nullptr, msg_text, _(L("First layer height")), wxICON_WARNING | wxOK); wxMessageDialog dialog(nullptr, msg_text, _(L("First layer height")), wxICON_WARNING | wxOK);
DynamicPrintConfig new_conf = *config; DynamicPrintConfig new_conf = *config;
is_msg_dlg_already_exist = true; is_msg_dlg_already_exist = true;

View File

@ -244,10 +244,11 @@ private:
// credits infornation // credits infornation
credits = title + " " + credits = title + " " +
_L("is based on Slic3r by Alessandro Ranellucci and the RepRap community.") + "\n\n" + _L("is based on Slic3r by Alessandro Ranellucci and the RepRap community.") + "\n" +
_L("Developed by Prusa Research.")+ "\n\n" +
title + " " + _L("is licensed under the") + " " + _L("GNU Affero General Public License, version 3") + "\n\n" + title + " " + _L("is licensed under the") + " " + _L("GNU Affero General Public License, version 3") + "\n\n" +
_L("Contributions by Vojtech Bubnik, Enrico Turri, Oleksandra Iushchenko, Tamas Meszaros, Lukas Matena, Vojtech Kral, David Kocik and numerous others.") + "\n\n" + _L("Contributions by Vojtech Bubnik, Enrico Turri, Oleksandra Iushchenko, Tamas Meszaros, Lukas Matena, Vojtech Kral, David Kocik and numerous others.") + "\n\n" +
_L("Artwork model by Nora Al-Badri and Jan Nikolai Nelles"); _L("Artwork model by M Boyer");
title_font = version_font = credits_font = init_font; title_font = version_font = credits_font = init_font;
} }

View File

@ -86,7 +86,8 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle
// Print config values // Print config values
double layer_height = print_config.opt_float("layer_height"); double layer_height = print_config.opt_float("layer_height");
double first_layer_height = print_config.get_abs_value("first_layer_height", layer_height); assert(! print_config.option<ConfigOptionFloatOrPercent>("first_layer_height")->percent);
double first_layer_height = print_config.opt_float("first_layer_height");
double support_material_speed = print_config.opt_float("support_material_speed"); double support_material_speed = print_config.opt_float("support_material_speed");
double support_material_interface_speed = print_config.get_abs_value("support_material_interface_speed", support_material_speed); double support_material_interface_speed = print_config.get_abs_value("support_material_interface_speed", support_material_speed);
double bridge_speed = print_config.opt_float("bridge_speed"); double bridge_speed = print_config.opt_float("bridge_speed");

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

@ -29,7 +29,7 @@ SCENARIO("SupportMaterial: support_layers_z and contact_distance", "[SupportMate
{ {
ConstSupportLayerPtrsAdaptor support_layers = print.objects().front()->support_layers(); ConstSupportLayerPtrsAdaptor support_layers = print.objects().front()->support_layers();
first_support_layer_height_ok = support_layers.front()->print_z == print.default_object_config().first_layer_height.value; first_support_layer_height_ok = support_layers.front()->print_z == print.config().first_layer_height.value;
layer_height_minimum_ok = true; layer_height_minimum_ok = true;
layer_height_maximum_ok = true; layer_height_maximum_ok = true;

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';