mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-11 16:39:02 +08:00
gui switchs : enforce 100% fill volume
This commit is contained in:
parent
11a940a1ae
commit
436bdac624
@ -224,23 +224,12 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
|
||||
// f->layer_height = h;
|
||||
//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);
|
||||
|
||||
/*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
|
||||
FillParams params;
|
||||
params.density = 0.01 * density;
|
||||
// params.dont_adjust = true;
|
||||
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
|
||||
// pattern generator)
|
||||
|
@ -141,7 +141,7 @@ void Fill::fill_surface_extrusion(const Surface *surface, const FillParams ¶
|
||||
return;
|
||||
// ensure it doesn't over or under-extrude
|
||||
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
|
||||
double lengthTot = 0;
|
||||
int nbLines = 0;
|
||||
|
@ -22,6 +22,7 @@ struct FillParams
|
||||
// Adjustment does not work.
|
||||
dont_adjust = true;
|
||||
flow_mult = 1.f;
|
||||
fill_exactly = false;
|
||||
}
|
||||
|
||||
bool full_infill() const { return density > 0.9999f; }
|
||||
@ -38,6 +39,9 @@ struct FillParams
|
||||
// Don't adjust spacing to fill the space evenly.
|
||||
bool dont_adjust;
|
||||
|
||||
// Try to extrude the exact amount of plastic to fill the volume requested
|
||||
bool fill_exactly;
|
||||
|
||||
// For Honeycomb.
|
||||
// we were requested to complete each loop;
|
||||
// in this case we don't try to make more continuous paths
|
||||
|
@ -35,7 +35,7 @@ namespace Slic3r {
|
||||
//a small under-overlap to prevent over-extrudion on thin surfaces (i.e. remove the overlap)
|
||||
Surface surfaceNoOverlap(*surface);
|
||||
//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::polys : 1->%i.\n", noOffsetPolys.size());
|
||||
//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;
|
||||
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,
|
||||
flow.mm3_per_mm(),
|
||||
flow.mm3_per_mm() * lengthTot,
|
||||
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]);
|
||||
|
||||
@ -113,7 +114,8 @@ namespace Slic3r {
|
||||
eec->entities, STDMOVE(polylines_layer1),
|
||||
flow.bridge ? erBridgeInfill : rolePass[0],
|
||||
//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{
|
||||
return;
|
||||
@ -173,7 +175,8 @@ namespace Slic3r {
|
||||
eec->entities, STDMOVE(polylines_layer2),
|
||||
rolePass[1],
|
||||
//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{
|
||||
return;
|
||||
@ -226,7 +229,8 @@ namespace Slic3r {
|
||||
eec->entities, STDMOVE(polylines_layer3),
|
||||
rolePass[2], //slow (if last)
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->cli = "bridge-fan-speed=i@";
|
||||
def->min = 0;
|
||||
def->max = 100;
|
||||
def->default_value = new ConfigOptionInts { 100 };
|
||||
def->default_value = new ConfigOptionInts{ 100 };
|
||||
|
||||
def = this->add("bridge_flow_ratio", coFloat);
|
||||
def->label = L("Bridge flow ratio");
|
||||
@ -326,6 +326,13 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->enum_labels.push_back("Octagram Spiral");
|
||||
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->label = L("External perimeters");
|
||||
def->category = L("Extrusion Width");
|
||||
@ -364,7 +371,7 @@ PrintConfigDef::PrintConfigDef()
|
||||
"is supported.");
|
||||
def->cli = "extra-perimeters!";
|
||||
def->default_value = new ConfigOptionBool(true);
|
||||
|
||||
|
||||
def = this->add("only_one_perimeter_top", coBool);
|
||||
def->label = "Only one perimeter on Top surfaces";
|
||||
def->category = "Layers and Perimeters";
|
||||
|
@ -391,6 +391,7 @@ public:
|
||||
ConfigOptionBool ensure_vertical_shell_thickness;
|
||||
ConfigOptionEnum<InfillPattern> top_fill_pattern;
|
||||
ConfigOptionEnum<InfillPattern> bottom_fill_pattern;
|
||||
ConfigOptionBool enforce_full_fill_volume;
|
||||
ConfigOptionFloatOrPercent external_perimeter_extrusion_width;
|
||||
ConfigOptionFloatOrPercent external_perimeter_speed;
|
||||
ConfigOptionBool external_perimeters_first;
|
||||
@ -432,6 +433,7 @@ protected:
|
||||
OPT_PTR(ensure_vertical_shell_thickness);
|
||||
OPT_PTR(top_fill_pattern);
|
||||
OPT_PTR(bottom_fill_pattern);
|
||||
OPT_PTR(enforce_full_fill_volume);
|
||||
OPT_PTR(external_perimeter_extrusion_width);
|
||||
OPT_PTR(external_perimeter_speed);
|
||||
OPT_PTR(external_perimeters_first);
|
||||
|
@ -201,6 +201,7 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|
||||
} else if (
|
||||
opt_key == "top_fill_pattern"
|
||||
|| opt_key == "bottom_fill_pattern"
|
||||
|| opt_key == "enforce_full_fill_volume"
|
||||
|| opt_key == "external_fill_link_max_length"
|
||||
|| opt_key == "fill_angle"
|
||||
|| opt_key == "fill_pattern"
|
||||
|
@ -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",
|
||||
"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",
|
||||
"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",
|
||||
"wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_bridging", "only_one_perimeter_top", "compatible_printers", "compatible_printers_condition","inherits"
|
||||
};
|
||||
|
@ -851,6 +851,7 @@ void TabPrint::build()
|
||||
optgroup->append_single_option_line("fill_pattern");
|
||||
optgroup->append_single_option_line("top_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->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;
|
||||
// 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",
|
||||
"solid_infill_extrusion_width", "solid_infill_speed" })
|
||||
for (auto el : {"top_fill_pattern", "bottom_fill_pattern", "enforce_full_fill_volume", "infill_first",
|
||||
"solid_infill_extruder", "solid_infill_extrusion_width", "solid_infill_speed" })
|
||||
get_field(el)->toggle(have_solid_infill);
|
||||
|
||||
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"));
|
||||
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 = page->new_optgroup(_(L("Cooling thresholds")), 250);
|
||||
|
Loading…
x
Reference in New Issue
Block a user