gui switchs : enforce 100% fill volume

This commit is contained in:
supermerill 2018-06-26 20:01:37 +02:00
parent 11a940a1ae
commit 436bdac624
9 changed files with 34 additions and 26 deletions

View File

@ -224,23 +224,12 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
// f->layer_height = h; // f->layer_height = h;
//give the overlap size, it's not the real value (it can depend of the external_perimeter_extrusion_width) //give the overlap size, it's not the real value (it can depend of the external_perimeter_extrusion_width)
f->overlap = layerm.region()->config.infill_overlap.get_abs_value(flow.nozzle_diameter); f->overlap = layerm.region()->config.infill_overlap.get_abs_value(flow.nozzle_diameter);
/*printf("infill_overlap : widdth=%d scaled=%d unscaled=%d, widdth=%d scaled=%d unscaled=%d, infill_overlap=%d, absvalue_scaled=%d, absvalue_UNscaled=%d.\n",
layerm.region()->config.perimeter_extrusion_width.getFloat(),
scale_(layerm.region()->config.perimeter_extrusion_width.getFloat()),
unscale(layerm.region()->config.perimeter_extrusion_width.getFloat()),
layerm.flow(frPerimeter).width,
scale_(layerm.flow(frPerimeter).width),
unscale(layerm.flow(frPerimeter).width),
layerm.region()->config.infill_overlap.getFloat(),
layerm.region()->config.infill_overlap.get_abs_value(layerm.region()->config.perimeter_extrusion_width),
f->overlap);*/
// apply half spacing using this flow's own spacing and generate infill // apply half spacing using this flow's own spacing and generate infill
FillParams params; FillParams params;
params.density = 0.01 * density; params.density = 0.01 * density;
// params.dont_adjust = true;
params.dont_adjust = false; params.dont_adjust = false;
params.fill_exactly = layerm.region()->config.enforce_full_fill_volume.getBool();
// calculate actual flow from spacing (which might have been adjusted by the infill // calculate actual flow from spacing (which might have been adjusted by the infill
// pattern generator) // pattern generator)

View File

@ -141,7 +141,7 @@ void Fill::fill_surface_extrusion(const Surface *surface, const FillParams &para
return; return;
// ensure it doesn't over or under-extrude // ensure it doesn't over or under-extrude
double multFlow = 1; double multFlow = 1;
if (!params.dont_adjust && params.density == 1 && !flow.bridge){ if (!params.dont_adjust && params.full_infill() && !flow.bridge && params.fill_exactly){
// compute the path of the nozzle -> extruded volume // compute the path of the nozzle -> extruded volume
double lengthTot = 0; double lengthTot = 0;
int nbLines = 0; int nbLines = 0;

View File

@ -22,6 +22,7 @@ struct FillParams
// Adjustment does not work. // Adjustment does not work.
dont_adjust = true; dont_adjust = true;
flow_mult = 1.f; flow_mult = 1.f;
fill_exactly = false;
} }
bool full_infill() const { return density > 0.9999f; } bool full_infill() const { return density > 0.9999f; }
@ -38,6 +39,9 @@ struct FillParams
// Don't adjust spacing to fill the space evenly. // Don't adjust spacing to fill the space evenly.
bool dont_adjust; bool dont_adjust;
// Try to extrude the exact amount of plastic to fill the volume requested
bool fill_exactly;
// For Honeycomb. // For Honeycomb.
// we were requested to complete each loop; // we were requested to complete each loop;
// in this case we don't try to make more continuous paths // in this case we don't try to make more continuous paths

View File

@ -35,7 +35,7 @@ namespace Slic3r {
//a small under-overlap to prevent over-extrudion on thin surfaces (i.e. remove the overlap) //a small under-overlap to prevent over-extrudion on thin surfaces (i.e. remove the overlap)
Surface surfaceNoOverlap(*surface); Surface surfaceNoOverlap(*surface);
//remove the overlap (prevent over-extruding) if possible //remove the overlap (prevent over-extruding) if possible
ExPolygons noOffsetPolys = offset2_ex(surfaceNoOverlap.expolygon, -scale_(this->overlap) * 1, 0); ExPolygons noOffsetPolys = offset2_ex(surfaceNoOverlap.expolygon, -scale_(this->overlap) * (flow.bridge?0:1), 0);
//printf("FillSmooth::fill_surface() : overlap=%f->%f.\n", overlap, -scale_(this->overlap)); //printf("FillSmooth::fill_surface() : overlap=%f->%f.\n", overlap, -scale_(this->overlap));
//printf("FillSmooth::polys : 1->%i.\n", noOffsetPolys.size()); //printf("FillSmooth::polys : 1->%i.\n", noOffsetPolys.size());
//printf("FillSmooth::polys : %f %f->%f.\n", surface->expolygon.area(), surfaceNoOverlap.expolygon.area(), noOffsetPolys[0].area()); //printf("FillSmooth::polys : %f %f->%f.\n", surface->expolygon.area(), surfaceNoOverlap.expolygon.area(), noOffsetPolys[0].area());
@ -97,12 +97,13 @@ namespace Slic3r {
double extrudedVolume = flow.mm3_per_mm() * lengthTot; double extrudedVolume = flow.mm3_per_mm() * lengthTot;
volumeToOccupy += poylineVolume; volumeToOccupy += poylineVolume;
printf("FillSmooth: request extruding of %f length, with mm3_per_mm of %f =volume=> %f / %f (%f)\n", printf("FillSmooth: request extruding of %f length, with mm3_per_mm of %f =volume=> %f / %f (%f) %s\n",
lengthTot, lengthTot,
flow.mm3_per_mm(), flow.mm3_per_mm(),
flow.mm3_per_mm() * lengthTot, flow.mm3_per_mm() * lengthTot,
flow.height*unscale(unscale(surfaceNoOverlap.area())), flow.height*unscale(unscale(surfaceNoOverlap.area())),
(flow.mm3_per_mm() * lengthTot) / (flow.height*unscale(unscale(surfaceNoOverlap.area()))) (flow.mm3_per_mm() * lengthTot) / (flow.height*unscale(unscale(surfaceNoOverlap.area()))),
params.fill_exactly ? "ready" : "only for info"
); );
printf("FillSmooth: extruding flow mult %f vs old: %f\n", percentFlow[0] * poylineVolume / extrudedVolume, percentFlow[0] / percentWidth[0]); printf("FillSmooth: extruding flow mult %f vs old: %f\n", percentFlow[0] * poylineVolume / extrudedVolume, percentFlow[0] / percentWidth[0]);
@ -113,7 +114,8 @@ namespace Slic3r {
eec->entities, STDMOVE(polylines_layer1), eec->entities, STDMOVE(polylines_layer1),
flow.bridge ? erBridgeInfill : rolePass[0], flow.bridge ? erBridgeInfill : rolePass[0],
//reduced flow height for a better view (it's only a gui thing) //reduced flow height for a better view (it's only a gui thing)
params.flow_mult * flow.mm3_per_mm() * percentFlow[0] * poylineVolume / extrudedVolume, (float)flow.width*percentFlow[0] * poylineVolume / extrudedVolume, (float)flow.height*0.8); params.flow_mult * flow.mm3_per_mm() * percentFlow[0] * (params.fill_exactly? poylineVolume / extrudedVolume : 1),
(float)(flow.width*percentFlow[0] * (params.fill_exactly ? poylineVolume / extrudedVolume : 1)), (float)flow.height*0.8);
} }
else{ else{
return; return;
@ -173,7 +175,8 @@ namespace Slic3r {
eec->entities, STDMOVE(polylines_layer2), eec->entities, STDMOVE(polylines_layer2),
rolePass[1], rolePass[1],
//reduced flow width for a better view (it's only a gui thing) //reduced flow width for a better view (it's only a gui thing)
params.flow_mult * flow.mm3_per_mm() * percentFlow[1] * volumeToOccupy / extrudedVolume, (float)flow.width*(percentFlow[1] < 0.1 ? 0.1 : percentFlow[1]), (float)flow.height); params.flow_mult * flow.mm3_per_mm() * percentFlow[1] * (params.fill_exactly ? volumeToOccupy / extrudedVolume : 1),
(float)(flow.width*(percentFlow[1] < 0.1 ? 0.1 : percentFlow[1])), (float)flow.height);
} }
else{ else{
return; return;
@ -226,7 +229,8 @@ namespace Slic3r {
eec->entities, STDMOVE(polylines_layer3), eec->entities, STDMOVE(polylines_layer3),
rolePass[2], //slow (if last) rolePass[2], //slow (if last)
//reduced flow width for a better view (it's only a gui thing) //reduced flow width for a better view (it's only a gui thing)
params.flow_mult * flow.mm3_per_mm() * percentFlow[2] * volumeToOccupy / extrudedVolume, (float)flow.width*(percentFlow[2] < 0.1 ? 0.1 : percentFlow[2]), (float)flow.height); params.flow_mult * flow.mm3_per_mm() * percentFlow[2] * (params.fill_exactly ? volumeToOccupy / extrudedVolume : 1),
(float)(flow.width*(percentFlow[2] < 0.1 ? 0.1 : percentFlow[2])), (float)flow.height);
} }
} }

View File

@ -100,7 +100,7 @@ PrintConfigDef::PrintConfigDef()
def->cli = "bridge-fan-speed=i@"; def->cli = "bridge-fan-speed=i@";
def->min = 0; def->min = 0;
def->max = 100; def->max = 100;
def->default_value = new ConfigOptionInts { 100 }; def->default_value = new ConfigOptionInts{ 100 };
def = this->add("bridge_flow_ratio", coFloat); def = this->add("bridge_flow_ratio", coFloat);
def->label = L("Bridge flow ratio"); def->label = L("Bridge flow ratio");
@ -326,6 +326,13 @@ PrintConfigDef::PrintConfigDef()
def->enum_labels.push_back("Octagram Spiral"); def->enum_labels.push_back("Octagram Spiral");
def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear); def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
def = this->add("enforce_full_fill_volume", coBool);
def->label = L("Enforce full fill volume");
def->category = L("Infill");
def->tooltip = L("Experimental option wich modify (top/bottom) fill flow to have the exact amount of plastic inside the volume to fill.");
def->cli = "enforce-full-fill-volume!";
def->default_value = new ConfigOptionBool(true);
def = this->add("external_perimeter_extrusion_width", coFloatOrPercent); def = this->add("external_perimeter_extrusion_width", coFloatOrPercent);
def->label = L("External perimeters"); def->label = L("External perimeters");
def->category = L("Extrusion Width"); def->category = L("Extrusion Width");
@ -364,7 +371,7 @@ PrintConfigDef::PrintConfigDef()
"is supported."); "is supported.");
def->cli = "extra-perimeters!"; def->cli = "extra-perimeters!";
def->default_value = new ConfigOptionBool(true); def->default_value = new ConfigOptionBool(true);
def = this->add("only_one_perimeter_top", coBool); def = this->add("only_one_perimeter_top", coBool);
def->label = "Only one perimeter on Top surfaces"; def->label = "Only one perimeter on Top surfaces";
def->category = "Layers and Perimeters"; def->category = "Layers and Perimeters";

View File

@ -391,6 +391,7 @@ public:
ConfigOptionBool ensure_vertical_shell_thickness; ConfigOptionBool ensure_vertical_shell_thickness;
ConfigOptionEnum<InfillPattern> top_fill_pattern; ConfigOptionEnum<InfillPattern> top_fill_pattern;
ConfigOptionEnum<InfillPattern> bottom_fill_pattern; ConfigOptionEnum<InfillPattern> bottom_fill_pattern;
ConfigOptionBool enforce_full_fill_volume;
ConfigOptionFloatOrPercent external_perimeter_extrusion_width; ConfigOptionFloatOrPercent external_perimeter_extrusion_width;
ConfigOptionFloatOrPercent external_perimeter_speed; ConfigOptionFloatOrPercent external_perimeter_speed;
ConfigOptionBool external_perimeters_first; ConfigOptionBool external_perimeters_first;
@ -432,6 +433,7 @@ protected:
OPT_PTR(ensure_vertical_shell_thickness); OPT_PTR(ensure_vertical_shell_thickness);
OPT_PTR(top_fill_pattern); OPT_PTR(top_fill_pattern);
OPT_PTR(bottom_fill_pattern); OPT_PTR(bottom_fill_pattern);
OPT_PTR(enforce_full_fill_volume);
OPT_PTR(external_perimeter_extrusion_width); OPT_PTR(external_perimeter_extrusion_width);
OPT_PTR(external_perimeter_speed); OPT_PTR(external_perimeter_speed);
OPT_PTR(external_perimeters_first); OPT_PTR(external_perimeters_first);

View File

@ -201,6 +201,7 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
} else if ( } else if (
opt_key == "top_fill_pattern" opt_key == "top_fill_pattern"
|| opt_key == "bottom_fill_pattern" || opt_key == "bottom_fill_pattern"
|| opt_key == "enforce_full_fill_volume"
|| opt_key == "external_fill_link_max_length" || opt_key == "external_fill_link_max_length"
|| opt_key == "fill_angle" || opt_key == "fill_angle"
|| opt_key == "fill_pattern" || opt_key == "fill_pattern"

View File

@ -297,7 +297,7 @@ const std::vector<std::string>& Preset::print_options()
"ooze_prevention", "standby_temperature_delta", "interface_shells", "extrusion_width", "first_layer_extrusion_width", "ooze_prevention", "standby_temperature_delta", "interface_shells", "extrusion_width", "first_layer_extrusion_width",
"perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width", "perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width",
"top_infill_extrusion_width", "support_material_extrusion_width", "infill_overlap", "bridge_flow_ratio", "top_infill_extrusion_width", "support_material_extrusion_width", "infill_overlap", "bridge_flow_ratio",
"over_bridge_flow_ratio", "clip_multipart_objects", "over_bridge_flow_ratio", "clip_multipart_objects", "enforce_full_fill_volume",
"elefant_foot_compensation", "xy_size_compensation", "threads", "resolution", "wipe_tower", "wipe_tower_x", "wipe_tower_y", "elefant_foot_compensation", "xy_size_compensation", "threads", "resolution", "wipe_tower", "wipe_tower_x", "wipe_tower_y",
"wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_bridging", "only_one_perimeter_top", "compatible_printers", "compatible_printers_condition","inherits" "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_bridging", "only_one_perimeter_top", "compatible_printers", "compatible_printers_condition","inherits"
}; };

View File

@ -851,6 +851,7 @@ void TabPrint::build()
optgroup->append_single_option_line("fill_pattern"); optgroup->append_single_option_line("fill_pattern");
optgroup->append_single_option_line("top_fill_pattern"); optgroup->append_single_option_line("top_fill_pattern");
optgroup->append_single_option_line("bottom_fill_pattern"); optgroup->append_single_option_line("bottom_fill_pattern");
optgroup->append_single_option_line("enforce_full_fill_volume");
optgroup = page->new_optgroup(_(L("Reducing printing time"))); optgroup = page->new_optgroup(_(L("Reducing printing time")));
optgroup->append_single_option_line("infill_every_layers"); optgroup->append_single_option_line("infill_every_layers");
@ -1190,8 +1191,8 @@ void TabPrint::update()
bool have_solid_infill = m_config->opt_int("top_solid_layers") > 0 || m_config->opt_int("bottom_solid_layers") > 0; bool have_solid_infill = m_config->opt_int("top_solid_layers") > 0 || m_config->opt_int("bottom_solid_layers") > 0;
// solid_infill_extruder uses the same logic as in Print::extruders() // solid_infill_extruder uses the same logic as in Print::extruders()
for (auto el : {"top_fill_pattern", "bottom_fill_pattern", "infill_first", "solid_infill_extruder", for (auto el : {"top_fill_pattern", "bottom_fill_pattern", "enforce_full_fill_volume", "infill_first",
"solid_infill_extrusion_width", "solid_infill_speed" }) "solid_infill_extruder", "solid_infill_extrusion_width", "solid_infill_speed" })
get_field(el)->toggle(have_solid_infill); get_field(el)->toggle(have_solid_infill);
for (auto el : {"fill_angle", "bridge_angle", "infill_extrusion_width", for (auto el : {"fill_angle", "bridge_angle", "infill_extrusion_width",
@ -1301,7 +1302,7 @@ void TabFilament::build()
line.append_option(optgroup->get_option("max_fan_speed")); line.append_option(optgroup->get_option("max_fan_speed"));
optgroup->append_line(line); optgroup->append_line(line);
optgroup->append_single_option_line("bridge_fan_speed"); optgroup->append_single_option_line("bridge_fan_speed");
optgroup->append_single_option_line("disable_fan_first_layers"); optgroup->append_single_option_line("disable_fan_first_layers");
optgroup = page->new_optgroup(_(L("Cooling thresholds")), 250); optgroup = page->new_optgroup(_(L("Cooling thresholds")), 250);