#101 add ratio /distribution for the smoothing flow in ironing (see tooltip)

This commit is contained in:
supermerill 2019-10-29 16:44:00 +01:00
parent 26db1722ae
commit 86fbd247b7
9 changed files with 30 additions and 10 deletions

View File

@ -96,7 +96,7 @@ bridge_acceleration = 1000
bridge_angle = 0 bridge_angle = 0
bridge_flow_ratio = 80% bridge_flow_ratio = 80%
over_bridge_flow_ratio = 120% over_bridge_flow_ratio = 120%
fill_top_flow_ratio = 120% fill_top_flow_ratio = 100%
bridge_speed = 20 bridge_speed = 20
brim_width = 0 brim_width = 0
clip_multipart_objects = 1 clip_multipart_objects = 1

View File

@ -18,6 +18,7 @@ namespace Slic3r {
return polylines_out; return polylines_out;
} }
/// @idx: the index of the step (0 = first step, 1 = second step, ...) The first lay down the volume and the others smoothen the surface.
void FillSmooth::perform_single_fill(const int idx, ExtrusionEntityCollection &eecroot, const Surface &srf_source, void FillSmooth::perform_single_fill(const int idx, ExtrusionEntityCollection &eecroot, const Surface &srf_source,
const FillParams &params, const double volume){ const FillParams &params, const double volume){
if (srf_source.expolygon.empty()) return; if (srf_source.expolygon.empty()) return;
@ -26,14 +27,18 @@ namespace Slic3r {
ExtrusionEntityCollection *eec = new ExtrusionEntityCollection(); ExtrusionEntityCollection *eec = new ExtrusionEntityCollection();
eec->no_sort = false; eec->no_sort = false;
FillParams params_modifided = params; FillParams params_modifided = params;
if (params.config != NULL && rolePass[idx] == ExtrusionRole::erTopSolidInfill) params_modifided.density /= (float)params.config->fill_smooth_width.get_abs_value(1); if (params.config != NULL && idx > 0) params_modifided.density /= (float)params.config->fill_smooth_width.get_abs_value(1);
else if (params.config != NULL && idx == 0) params_modifided.density *= 1;
else params_modifided.density *= (float)percentWidth[idx]; else params_modifided.density *= (float)percentWidth[idx];
// reduce flow for each increase in density // reduce flow for each increase in density
params_modifided.flow_mult *= params.density; params_modifided.flow_mult *= params.density;
params_modifided.flow_mult /= params_modifided.density; params_modifided.flow_mult /= params_modifided.density;
// split the flow between steps // split the flow between steps
params_modifided.flow_mult *= (float)percentFlow[idx]; if (params.config != NULL && idx > 0) params_modifided.flow_mult *= (float)params.config->fill_smooth_distribution.get_abs_value(1);
else if (params.config != NULL && idx == 0) params_modifided.flow_mult *= (1.f - (float)params.config->fill_smooth_distribution.get_abs_value(1));
else params_modifided.flow_mult *= (float)percentFlow[idx];
//choose if we are going to extrude with or without overlap
if ((params.flow->bridge && idx == 0) || has_overlap[idx]){ if ((params.flow->bridge && idx == 0) || has_overlap[idx]){
this->fill_expolygon(idx, *eec, srf_source, params_modifided, volume); this->fill_expolygon(idx, *eec, srf_source, params_modifided, volume);
} }
@ -86,11 +91,11 @@ namespace Slic3r {
good_role = params.flow->bridge && idx == 0 ? erBridgeInfill : rolePass[idx]; good_role = params.flow->bridge && idx == 0 ? erBridgeInfill : rolePass[idx];
} }
// print // print
float mult_flow = (params.fill_exactly && idx == 0 ? std::min(2., volume / extrudedVolume) : 1); float mult_flow = (params.fill_exactly /*&& idx == 0*/ ? std::min(2., volume / extrudedVolume) : 1);
extrusion_entities_append_paths( extrusion_entities_append_paths(
eec.entities, std::move(polylines_layer), eec.entities, std::move(polylines_layer),
good_role, good_role,
params.flow_mult * params.flow->mm3_per_mm() * mult_flow, params.flow->mm3_per_mm() * params.flow_mult * mult_flow,
//min-reduced flow width for a better view (it's only a gui thing) //min-reduced flow width for a better view (it's only a gui thing)
(float)(params.flow->width * (params.flow_mult* mult_flow < 0.1 ? 0.1 : params.flow_mult * mult_flow)), (float)params.flow->height); (float)(params.flow->width * (params.flow_mult* mult_flow < 0.1 ? 0.1 : params.flow_mult * mult_flow)), (float)params.flow->height);
} }

View File

@ -44,7 +44,7 @@ protected:
int nbPass=2; int nbPass=2;
// this parameter is now erased by fill_smooth_width when available. // this parameter is now erased by fill_smooth_width when available.
double percentWidth[3]; double percentWidth[3];
// this parameter is now modified by fill_top_flow_ratio when available. // this parameter is now modified by fill_smooth_distribution when available. (note that fill_top_flow_ratio can also increasse the params.flow_mult passed by fill.cpp)
double percentFlow[3]; double percentFlow[3];
//angle to add to base angle //angle to add to base angle
float anglePass[3]; float anglePass[3];
@ -76,7 +76,7 @@ public:
rolePass[0] = erTopSolidInfill;//erSolidInfill rolePass[0] = erTopSolidInfill;//erSolidInfill
rolePass[1] = erSolidInfill; rolePass[1] = erSolidInfill;
rolePass[2] = erTopSolidInfill; rolePass[2] = erTopSolidInfill;
percentWidth[0] = 1.4; //0.8 percentWidth[0] = 1; //0.8
percentWidth[1] = 1.5; percentWidth[1] = 1.5;
percentWidth[2] = 2.8; percentWidth[2] = 2.8;
percentFlow[0] = 1; //0.7 percentFlow[0] = 1; //0.7

View File

@ -1164,11 +1164,21 @@ void PrintConfigDef::init_fff_params()
def = this->add("fill_smooth_width", coFloatOrPercent); def = this->add("fill_smooth_width", coFloatOrPercent);
def->label = L("width"); def->label = L("width");
def->full_label = L("Ironing width"); def->full_label = L("Ironing width");
def->tooltip = L("This is the width of the ironing pass, in a % of the top width, should be no more than 50%."); def->tooltip = L("This is the width of the ironing pass, in a % of the top extrusion width, should not be more than 50%.");
def->min = 0; def->min = 0;
def->mode = comExpert; def->mode = comExpert;
def->set_default_value(new ConfigOptionFloatOrPercent(50, true)); def->set_default_value(new ConfigOptionFloatOrPercent(50, true));
def = this->add("fill_smooth_distribution", coFloatOrPercent);
def->label = L("distribution");
def->full_label = L("Ironing flow distribution");
def->tooltip = L("This is the percentage of the flow that is used for the second ironing pass. Typical 0-20%. "
"Should not be lower than 20%, unless you have your top extrusion width greatly superior to your nozzle width.");
def->min = 0;
def->max = 0.9;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloatOrPercent(10, true));
def = this->add("first_layer_acceleration", coFloat); def = this->add("first_layer_acceleration", coFloat);
def->label = L("First layer"); def->label = L("First layer");
def->full_label = L("First layer acceleration"); def->full_label = L("First layer acceleration");

View File

@ -592,6 +592,7 @@ public:
ConfigOptionPercent fill_density; ConfigOptionPercent fill_density;
ConfigOptionEnum<InfillPattern> fill_pattern; ConfigOptionEnum<InfillPattern> fill_pattern;
ConfigOptionFloatOrPercent fill_top_flow_ratio; ConfigOptionFloatOrPercent fill_top_flow_ratio;
ConfigOptionFloatOrPercent fill_smooth_distribution;
ConfigOptionFloatOrPercent fill_smooth_width; ConfigOptionFloatOrPercent fill_smooth_width;
ConfigOptionBool gap_fill; ConfigOptionBool gap_fill;
ConfigOptionFloatOrPercent gap_fill_min_area; ConfigOptionFloatOrPercent gap_fill_min_area;
@ -659,6 +660,7 @@ protected:
OPT_PTR(fill_density); OPT_PTR(fill_density);
OPT_PTR(fill_pattern); OPT_PTR(fill_pattern);
OPT_PTR(fill_top_flow_ratio); OPT_PTR(fill_top_flow_ratio);
OPT_PTR(fill_smooth_distribution);
OPT_PTR(fill_smooth_width); OPT_PTR(fill_smooth_width);
OPT_PTR(gap_fill); OPT_PTR(gap_fill);
OPT_PTR(gap_fill_min_area); OPT_PTR(gap_fill_min_area);

View File

@ -560,6 +560,7 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|| opt_key == "fill_pattern" || opt_key == "fill_pattern"
|| opt_key == "fill_top_flow_ratio" || opt_key == "fill_top_flow_ratio"
|| opt_key == "fill_smooth_width" || opt_key == "fill_smooth_width"
|| opt_key == "fill_smooth_distribution"
|| opt_key == "top_infill_extrusion_width" || opt_key == "top_infill_extrusion_width"
|| opt_key == "first_layer_extrusion_width") { || opt_key == "first_layer_extrusion_width") {
steps.emplace_back(posInfill); steps.emplace_back(posInfill);

View File

@ -279,7 +279,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
// gap fill can appear in infill // gap fill can appear in infill
//toggle_field("gap_fill_speed", have_perimeters && config->opt_bool("gap_fill")); //toggle_field("gap_fill_speed", have_perimeters && config->opt_bool("gap_fill"));
for (auto el : {"fill_smooth_width" }) for (auto el : {"fill_smooth_width, fill_smooth_distribution" })
toggle_field(el, config->opt_enum<InfillPattern>("top_fill_pattern") == InfillPattern::ipSmooth); toggle_field(el, config->opt_enum<InfillPattern>("top_fill_pattern") == InfillPattern::ipSmooth);
bool have_top_solid_infill = config->opt_int("top_solid_layers") > 0; bool have_top_solid_infill = config->opt_int("top_solid_layers") > 0;

View File

@ -385,6 +385,7 @@ const std::vector<std::string>& Preset::print_options()
, "fill_pattern" , "fill_pattern"
, "fill_top_flow_ratio" , "fill_top_flow_ratio"
, "fill_smooth_width" , "fill_smooth_width"
, "fill_smooth_distribution"
, "top_fill_pattern" , "top_fill_pattern"
, "bottom_fill_pattern" , "bottom_fill_pattern"
, "solid_fill_pattern", , "solid_fill_pattern",

View File

@ -1145,6 +1145,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(_(L("Advanced Infill"))); optgroup = page->new_optgroup(_(L("Advanced Infill")));
line.append_option(optgroup->get_option("fill_smooth_width")); line.append_option(optgroup->get_option("fill_smooth_width"));
line.append_option(optgroup->get_option("fill_smooth_distribution"));
optgroup->append_line(line); optgroup->append_line(line);
page = add_options_page(_(L("Skirt and brim")), "skirt+brim"); page = add_options_page(_(L("Skirt and brim")), "skirt+brim");