ENH: add top & bottom infill flow ratio

thanks SoftFever

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: If4b2d203d8568a7c640425702b0a77ccea3b596b
This commit is contained in:
qing.zhang 2023-06-15 18:25:56 +08:00 committed by Lane.Wei
parent d164cd0265
commit 112712e966
7 changed files with 393 additions and 9 deletions

View file

@ -3800,7 +3800,14 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
// calculate extrusion length per distance unit
auto _mm3_per_mm = path.mm3_per_mm * double(m_curr_print->calib_mode() == CalibMode::Calib_Flow_Rate ? this->config().print_flow_ratio.value : 1);
double e_per_mm = m_writer.extruder()->e_per_mm3() * _mm3_per_mm;
// calculate extrusion length per distance unit
if( path.role() == erTopSolidInfill )
_mm3_per_mm *= m_config.top_solid_infill_flow_ratio.value;
else if (path.role() == erBottomSurface)
_mm3_per_mm *= m_config.bottom_solid_infill_flow_ratio.value;
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()));
// set speed
@ -3843,8 +3850,13 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
}
}
//BBS: if not set the speed, then use the filament_max_volumetric_speed directly
if (speed == 0)
speed = EXTRUDER_CONFIG(filament_max_volumetric_speed) / path.mm3_per_mm;
if( speed == 0 )
{
if (_mm3_per_mm>0)
speed = EXTRUDER_CONFIG(filament_max_volumetric_speed) / _mm3_per_mm;
else
speed = EXTRUDER_CONFIG(filament_max_volumetric_speed) / path.mm3_per_mm;
}
if (this->on_first_layer()) {
//BBS: for solid infill of initial layer, speed can be higher as long as
//wall lines have be attached
@ -3862,11 +3874,12 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
// );
//}
if (EXTRUDER_CONFIG(filament_max_volumetric_speed) > 0) {
double extrude_speed = EXTRUDER_CONFIG(filament_max_volumetric_speed) / path.mm3_per_mm;
if (_mm3_per_mm > 0)
extrude_speed = EXTRUDER_CONFIG(filament_max_volumetric_speed) / _mm3_per_mm;
// cap speed with max_volumetric_speed anyway (even if user is not using autospeed)
speed = std::min(
speed,
EXTRUDER_CONFIG(filament_max_volumetric_speed) / path.mm3_per_mm
);
speed = std::min(speed, extrude_speed);
}
double F = speed * 60; // convert mm/sec to mm/min

View file

@ -758,7 +758,7 @@ static std::vector<std::string> s_Preset_print_options {
"timelapse_type", "internal_bridge_support_thickness",
"wall_generator", "wall_transition_length", "wall_transition_filter_deviation", "wall_transition_angle",
"wall_distribution_count", "min_feature_size", "min_bead_width", "post_process",
"seam_gap", "wipe_speed",
"seam_gap", "wipe_speed", "top_solid_infill_flow_ratio", "bottom_solid_infill_flow_ratio",
// calib
"print_flow_ratio"
};

View file

@ -698,6 +698,23 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(1));
def = this->add("top_solid_infill_flow_ratio", coFloat);
def->label = L("Top surface flow ratio");
def->tooltip = L("This factor affects the amount of material for top solid infill. "
"You can decrease it slightly to have smooth surface finish");
def->min = 0;
def->max = 2;
def->mode = comDevelop;
def->set_default_value(new ConfigOptionFloat(1));
def = this->add("bottom_solid_infill_flow_ratio", coFloat);
def->label = L("Bottom surface flow ratio");
def->tooltip = L("This factor affects the amount of material for bottom solid infill");
def->min = 0;
def->max = 2;
def->mode = comDevelop;
def->set_default_value(new ConfigOptionFloat(1));
def = this->add("only_one_wall_top", coBool);
def->label = L("Only one wall on top surfaces");
def->category = L("Quality");

View file

@ -763,6 +763,9 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, overhang_4_4_speed))
((ConfigOptionFloatOrPercent, sparse_infill_anchor))
((ConfigOptionFloatOrPercent, sparse_infill_anchor_max))
//SoftFever
((ConfigOptionFloat, top_solid_infill_flow_ratio))
((ConfigOptionFloat, bottom_solid_infill_flow_ratio))
//calib
((ConfigOptionFloat, print_flow_ratio)))