From 43c13a81689fa71ff1e298a63e8e4ba16907702a Mon Sep 17 00:00:00 2001 From: supermerill Date: Sun, 17 Nov 2019 21:04:30 +0100 Subject: [PATCH] 1) change only_one_perimeter_top to respect external_infill_margin. Old behavior can be reproduced by setting external_infill_margin to 0 2) change first_layer_height from % of layer_height to % of the diameter of the nozzle of the first extruder. It's safer and more logical that way. --- src/libslic3r/Flow.cpp | 8 ++++++-- src/libslic3r/GCode.cpp | 8 ++++++-- src/libslic3r/PerimeterGenerator.cpp | 4 +++- src/libslic3r/PrintConfig.cpp | 12 ++++++++---- src/libslic3r/Slicing.cpp | 6 ++++-- 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/libslic3r/Flow.cpp b/src/libslic3r/Flow.cpp index b87edf00f..2f58bbf79 100644 --- a/src/libslic3r/Flow.cpp +++ b/src/libslic3r/Flow.cpp @@ -132,12 +132,16 @@ Flow support_material_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; + float slice_height = layer_height; + if (layer_height <= 0.f && !object->print()->config().nozzle_diameter.empty()){ + slice_height = (float)(object->config().first_layer_height.get_abs_value(object->print()->config().nozzle_diameter.get_at(0))); + } return Flow::new_from_config_width( 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. (width.value > 0) ? width : object->config().extrusion_width, - float(object->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)), + float(object->print()->config().nozzle_diameter.get_at(object->config().support_material_extruder - 1)), + slice_height, // bridge_flow_ratio 0.f); } diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 1c800e218..9b06cda08 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -948,7 +948,7 @@ void GCode::_do_export(Print &print, FILE *file) // 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 = first_object->config().first_layer_height.get_abs_value(layer_height); + const double first_layer_height = first_object->config().first_layer_height.get_abs_value(m_config.nozzle_diameter.empty()?0.:m_config.nozzle_diameter.get_at(0)); for (const PrintRegion* region : print.regions()) { _write_format(file, "; external perimeters extrusion width = %.2fmm\n", region->flow(frExternalPerimeter, layer_height, false, false, -1., *first_object).width); _write_format(file, "; perimeters extrusion width = %.2fmm\n", region->flow(frPerimeter, layer_height, false, false, -1., *first_object).width); @@ -2642,7 +2642,11 @@ std::string GCode::extrude_loop(const ExtrusionLoop &original_loop, const std::s //no-seam code path redirect if (original_loop.role() == ExtrusionRole::erExternalPerimeter && this->m_config.external_perimeters_vase && !this->m_config.spiral_vase //but not for the first layer - && this->m_layer->id() > 0) { + && this->m_layer->id() > 0 + //exclude if min_layer_height * 2 > layer_height (increase from 2 to 3 because it's working but uses in-between) + && this->m_layer->height < EXTRUDER_CONFIG(min_layer_height) * 3 + ) { + return extrude_loop_vase(original_loop, description, speed, lower_layer_edge_grid); } diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index eb719d18f..4e4670672 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -509,7 +509,9 @@ void PerimeterGenerator::process() //store surface for top infill if only_one_perimeter_top if(i==0 && config->only_one_perimeter_top && this->upper_slices != NULL){ //split the polygons with top/not_top - ExPolygons upper_polygons(this->upper_slices->expolygons); + coord_t offset_top_surface = scale_(config->external_infill_margin.get_abs_value( + config->perimeters == 0 ? 0 : (ext_perimeter_width + perimeter_spacing * (config->perimeters - 1)))); + ExPolygons upper_polygons = offset_ex(this->upper_slices->expolygons, offset_top_surface); ExPolygons top_polygons = diff_ex(last, (upper_polygons), true); ExPolygons inner_polygons = diff_ex(last, top_polygons, true); // increase a bit the inner space to fill the frontier between last and stored. diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 8373bf145..02a3869ea 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -645,7 +645,11 @@ void PrintConfigDef::init_fff_params() def->label = L("in vase mode (no seam)"); def->full_label = L("ExternalPerimeter in vase mode"); def->category = OptionCategory::perimeter; - def->tooltip = L("Print contour perimeters in two circle, in a contiunous way, like for a vase mode. It needs the external_perimeters_first parameter do work."); + def->tooltip = L("Print contour perimeters in two circle, in a contiunous way, like for a vase mode. It needs the external_perimeters_first parameter do work." + " \nDoesn't work for the first layer, as it may damage the bed overwise." + " \nNote that It will use min_layer_height from your hardware setting as the base height (it doesn't start at 0)" + ", so be sure to put here the lowest value your printer can handle." + " if it's not lower than two times the current layer height, it falls back to the normal algorithm, as there are not enough room to do two loops."); def->mode = comExpert; def->set_default_value(new ConfigOptionBool(false)); @@ -1267,13 +1271,13 @@ void PrintConfigDef::init_fff_params() def->category = OptionCategory::perimeter; 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. " - "This can be expressed as an absolute value or as a percentage (for example: 150%) " - "over the default layer height."); + "This can be expressed as an absolute value or as a percentage (for example: 75%) " + "over the default nozzle width."); def->sidetext = L("mm or %"); def->ratio_over = "layer_height"; def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloatOrPercent(0.2, false)); + def->set_default_value(new ConfigOptionFloatOrPercent(75, true)); def = this->add("first_layer_speed", coFloatOrPercent); def->label = L("Default"); diff --git a/src/libslic3r/Slicing.cpp b/src/libslic3r/Slicing.cpp index 49c2c3ab4..04efe87ee 100644 --- a/src/libslic3r/Slicing.cpp +++ b/src/libslic3r/Slicing.cpp @@ -47,9 +47,11 @@ SlicingParameters SlicingParameters::create_from_config( coordf_t object_height, const std::vector &object_extruders) { - coordf_t first_layer_height = (object_config.first_layer_height.get_abs_value(object_config.layer_height.value) <= 0) ? + //first layer height is got from the first_layer_height setting unless the value was garbage. + // if the first_layer_height setting depends of the nozzle width, use the first one. + coordf_t first_layer_height = (object_config.first_layer_height.get_abs_value(print_config.nozzle_diameter.empty() ? 0. : print_config.nozzle_diameter.get_at(0)) <= 0) ? object_config.layer_height.value : - object_config.first_layer_height.get_abs_value(object_config.layer_height.value); + object_config.first_layer_height.get_abs_value(print_config.nozzle_diameter.get_at(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, // which is consistent with the requirement that if support_material_extruder == 0 resp. support_material_interface_extruder == 0,