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

This commit is contained in:
enricoturri1966 2021-04-21 14:52:52 +02:00
commit 82d577645e
9 changed files with 19 additions and 23 deletions

View file

@ -89,18 +89,11 @@ double Flow::extrusion_width(const std::string& opt_key, const ConfigOptionFloat
if (opt->percent) {
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)
throw_on_missing_variable(opt_key, opt_key_layer_height);
double layer_height = opt_layer_height->getFloat();
if (first_layer && static_cast<const ConfigOptionFloatOrPercent*>(opt_layer_height)->percent) {
// 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);
assert(! first_layer || ! static_cast<const ConfigOptionFloatOrPercent*>(opt_layer_height)->percent);
return opt->get_abs_value(opt_layer_height->getFloat());
}
if (opt->value == 0.) {

View file

@ -1111,7 +1111,8 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
// Write some terse information on the slicing parameters.
const PrintObject *first_object = print.objects().front();
const double layer_height = first_object->config().layer_height.value;
const double first_layer_height = print.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()) {
_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());

View file

@ -1464,7 +1464,8 @@ std::string Print::validate(std::string* warning) const
}
// 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;
if (object->has_raft()) {
// 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
{
if (m_objects.empty())
throw Slic3r::InvalidArgument("skirt_first_layer_height() can't be called without PrintObjects");
return m_objects.front()->config().get_abs_value("first_layer_height");
assert(! m_config.first_layer_height.percent);
return m_config.first_layer_height.value;
}
Flow Print::brim_flow() const

View file

@ -64,9 +64,9 @@ SlicingParameters SlicingParameters::create_from_config(
coordf_t object_height,
const std::vector<unsigned int> &object_extruders)
{
assert(! print_config.first_layer_height.percent);
coordf_t first_layer_height = (print_config.first_layer_height.value <= 0) ?
object_config.layer_height.value :
print_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,
// 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,