Allow user to adjust top solid infill flowrate

This commit is contained in:
SoftFever 2022-09-12 00:22:38 +08:00
parent a189784c16
commit bc545cf90e
5 changed files with 18 additions and 2 deletions

View file

@ -683,7 +683,9 @@ static std::vector<std::string> s_Preset_print_options {
"gcode_add_line_number", "enable_arc_fitting", "infill_combination", "adaptive_layer_height", "gcode_add_line_number", "enable_arc_fitting", "infill_combination", "adaptive_layer_height",
"support_bottom_interface_spacing", "enable_overhang_speed", "overhang_1_4_speed", "overhang_2_4_speed", "overhang_3_4_speed", "overhang_4_4_speed", "support_bottom_interface_spacing", "enable_overhang_speed", "overhang_1_4_speed", "overhang_2_4_speed", "overhang_3_4_speed", "overhang_4_4_speed",
"initial_layer_infill_speed", "only_one_wall_top", "only_one_wall_first_layer", "initial_layer_infill_speed", "only_one_wall_top", "only_one_wall_first_layer",
"timelapse_type" "timelapse_type",
//SoftFever
"top_solid_infill_flow_ratio"
}; };

View file

@ -640,6 +640,16 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(1)); def->set_default_value(new ConfigOptionFloat(1));
def = this->add("top_solid_infill_flow_ratio", coFloat);
def->label = L("Top surface flow ratio");
def->category = L("Advanced");
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 = comAdvanced;
def->set_default_value(new ConfigOptionFloat(1));
def = this->add("only_one_wall_top", coBool); def = this->add("only_one_wall_top", coBool);
def->label = L("Only one wall on top surfaces"); def->label = L("Only one wall on top surfaces");
def->category = L("Quality"); def->category = L("Quality");

View file

@ -654,6 +654,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, bridge_flow)) ((ConfigOptionFloat, bridge_flow))
((ConfigOptionFloat, bridge_speed)) ((ConfigOptionFloat, bridge_speed))
((ConfigOptionEnum<InfillPattern>, top_surface_pattern)) ((ConfigOptionEnum<InfillPattern>, top_surface_pattern))
((ConfigOptionFloat, top_solid_infill_flow_ratio))
((ConfigOptionEnum<InfillPattern>, bottom_surface_pattern)) ((ConfigOptionEnum<InfillPattern>, bottom_surface_pattern))
((ConfigOptionFloat, outer_wall_line_width)) ((ConfigOptionFloat, outer_wall_line_width))
((ConfigOptionFloat, outer_wall_speed)) ((ConfigOptionFloat, outer_wall_speed))

View file

@ -22,6 +22,7 @@ Flow PrintRegion::flow(const PrintObject &object, FlowRole role, double layer_he
{ {
const PrintConfig &print_config = object.print()->config(); const PrintConfig &print_config = object.print()->config();
ConfigOptionFloat config_width; ConfigOptionFloat config_width;
double flow_ratio = 1.0;
// Get extrusion width from configuration. // Get extrusion width from configuration.
// (might be an absolute value, or a percent value, or zero for auto) // (might be an absolute value, or a percent value, or zero for auto)
if (first_layer && print_config.initial_layer_line_width.value > 0) { if (first_layer && print_config.initial_layer_line_width.value > 0) {
@ -36,6 +37,7 @@ Flow PrintRegion::flow(const PrintObject &object, FlowRole role, double layer_he
config_width = m_config.internal_solid_infill_line_width; config_width = m_config.internal_solid_infill_line_width;
} else if (role == frTopSolidInfill) { } else if (role == frTopSolidInfill) {
config_width = m_config.top_surface_line_width; config_width = m_config.top_surface_line_width;
flow_ratio = m_config.top_solid_infill_flow_ratio;
} else { } else {
throw Slic3r::InvalidArgument("Unknown role"); throw Slic3r::InvalidArgument("Unknown role");
} }
@ -46,7 +48,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. // 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. // 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)); 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)); return Flow::new_from_config_width(role, config_width, nozzle_diameter, float(layer_height)).with_flow_ratio(flow_ratio);
} }
coordf_t PrintRegion::nozzle_dmr_avg(const PrintConfig &print_config) const coordf_t PrintRegion::nozzle_dmr_avg(const PrintConfig &print_config) const

View file

@ -1782,6 +1782,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Advanced")); optgroup = page->new_optgroup(L("Advanced"));
optgroup->append_single_option_line("wall_infill_order"); optgroup->append_single_option_line("wall_infill_order");
optgroup->append_single_option_line("bridge_flow"); optgroup->append_single_option_line("bridge_flow");
optgroup->append_single_option_line("top_solid_infill_flow_ratio");
optgroup->append_single_option_line("only_one_wall_top"); optgroup->append_single_option_line("only_one_wall_top");
optgroup->append_single_option_line("only_one_wall_first_layer"); optgroup->append_single_option_line("only_one_wall_first_layer");
optgroup->append_single_option_line("detect_overhang_wall"); optgroup->append_single_option_line("detect_overhang_wall");