Fix top/bottom flow rate bug #680

This commit is contained in:
SoftFever 2023-04-07 22:15:50 +08:00
parent 17d6e63cf9
commit 3f7ed3829c
2 changed files with 10 additions and 10 deletions

View file

@ -3874,7 +3874,13 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
}
// calculate extrusion length per distance unit
const auto _mm3_per_mm = path.mm3_per_mm * this->config().print_flow_ratio;
auto _mm3_per_mm = path.mm3_per_mm * this->config().print_flow_ratio;
if (path.role() == erTopSolidInfill)
_mm3_per_mm *= m_config.top_solid_infill_flow_ratio;
else if (path.role() == erBottomSurface)
_mm3_per_mm *= m_config.bottom_solid_infill_flow_ratio;
double e_per_mm = m_writer.extruder()->e_per_mm3() * _mm3_per_mm;
double min_speed = double(m_config.slow_down_min_speed.get_at(m_writer.extruder()->id()));

View file

@ -22,15 +22,10 @@ Flow PrintRegion::flow(const PrintObject &object, FlowRole role, double layer_he
{
const PrintConfig &print_config = object.print()->config();
ConfigOptionFloat config_width;
double flow_ratio = 1.0;
// Get extrusion width from configuration.
// (might be an absolute value, or a percent value, or zero for auto)
if (first_layer) {
if(role != frExternalPerimeter)
flow_ratio = m_config.bottom_solid_infill_flow_ratio;
if(print_config.initial_layer_line_width.value > 0) {
config_width = print_config.initial_layer_line_width;
}
if (first_layer && print_config.initial_layer_line_width.value > 0) {
config_width = print_config.initial_layer_line_width;
} else if (role == frExternalPerimeter) {
config_width = m_config.outer_wall_line_width;
} else if (role == frPerimeter) {
@ -41,7 +36,6 @@ Flow PrintRegion::flow(const PrintObject &object, FlowRole role, double layer_he
config_width = m_config.internal_solid_infill_line_width;
} else if (role == frTopSolidInfill) {
config_width = m_config.top_surface_line_width;
flow_ratio = m_config.top_solid_infill_flow_ratio;
} else {
throw Slic3r::InvalidArgument("Unknown role");
}
@ -52,7 +46,7 @@ Flow PrintRegion::flow(const PrintObject &object, FlowRole role, double layer_he
// Get the configured nozzle_diameter for the extruder associated to the flow role requested.
// Here this->extruder(role) - 1 may underflow to MAX_INT, but then the get_at() will follback to zero'th element, so everything is all right.
auto nozzle_diameter = float(print_config.nozzle_diameter.get_at(this->extruder(role) - 1));
return Flow::new_from_config_width(role, config_width, nozzle_diameter, float(layer_height)).with_flow_ratio(flow_ratio);
return Flow::new_from_config_width(role, config_width, nozzle_diameter, float(layer_height));
}
coordf_t PrintRegion::nozzle_dmr_avg(const PrintConfig &print_config) const