filter out tiny gaps

This commit is contained in:
SoftFever 2022-11-04 16:44:43 +08:00
parent 1a371a9417
commit 78b9fcb71b
13 changed files with 46 additions and 7 deletions

View file

@ -4810,6 +4810,12 @@ msgstr "桥接"
msgid "Gap infill"
msgstr "填缝"
msgid "Filter out tiny gaps"
msgstr "忽略微小间隙"
msgid "Filter out gaps smaller than the threshold specified. This setting won't affact top/bottom layers"
msgstr "小于指定阈值的微小间隙不填充。本设置不会对顶/底层起作用"
msgid "Support interface"
msgstr "支撑面"

Binary file not shown.

View file

@ -467,6 +467,7 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
params.no_extrusion_overlap = surface_fill.params.overlap;
LayerRegion* layerm = this->m_regions[surface_fill.region_id];
params.config = &layerm->region().config();
for (ExPolygon& expoly : surface_fill.expolygons) {
f->no_overlap_expolygons = intersection_ex(layerm->fill_no_overlap_expolygons, ExPolygons() = { expoly });
// Spacing is modified by the filler to indicate adjustments. Reset it for each expolygon.

View file

@ -74,6 +74,8 @@ struct FillParams
bool using_internal_flow{ false };
//BBS: only used for new top surface pattern
float no_extrusion_overlap{ 0.0 };
const PrintRegionConfig* config{ nullptr };
};
static_assert(IsTriviallyCopyable<FillParams>::value, "FillParams class is not POD (and it should be - see constructor).");

View file

@ -3169,9 +3169,17 @@ void FillMonotonicLineWGapFill::fill_surface_extrusion(const Surface* surface, c
}
if (!polylines.empty() && !is_bridge(params.extrusion_role)) {
if (!surface->is_top() && !surface->is_bottom()) {
polylines.erase(std::remove_if(polylines.begin(), polylines.end(),
[&](const ThickPolyline& p) {
return p.length() < scale_(params.config->filter_out_gap_fill.value);
}), polylines.end());
}
ExtrusionEntityCollection gap_fill;
variable_width(polylines, erGapFill, params.flow, gap_fill.entities);
coll_nosort->append(std::move(gap_fill.entities));
}
}

View file

@ -172,6 +172,7 @@ void Layer::make_perimeters()
&& config.outer_wall_speed == other_config.outer_wall_speed
&& config.small_perimeter_speed == other_config.small_perimeter_speed
&& config.gap_infill_speed.value == other_config.gap_infill_speed.value
&& config.filter_out_gap_fill.value == other_config.filter_out_gap_fill.value
&& config.detect_overhang_wall == other_config.detect_overhang_wall
&& config.opt_serialize("inner_wall_line_width") == other_config.opt_serialize("inner_wall_line_width")
&& config.detect_thin_wall == other_config.detect_thin_wall

View file

@ -715,6 +715,15 @@ void PerimeterGenerator::process()
++ irun;
}
#endif
// SoftFever: don't filter out tiny gap fills for first and top layer. So that the print looks better :)
if (this->layer_id != 0 && this->upper_slices != nullptr)
{
polylines.erase(std::remove_if(polylines.begin(), polylines.end(),
[&](const ThickPolyline& p) {
return p.length() < scale_(config->filter_out_gap_fill.value);
}), polylines.end());
}
if (! polylines.empty()) {
ExtrusionEntityCollection gap_fill;
@ -729,6 +738,7 @@ void PerimeterGenerator::process()
// therefore it may cover the area, but no the volume.
last = diff_ex(last, gap_fill.polygons_covered_by_width(10.f));
this->gap_fill->append(std::move(gap_fill.entities));
}
}

View file

@ -346,6 +346,7 @@ void Preset::normalize(DynamicPrintConfig &config)
}
}
handle_legacy_sla(config);
}
@ -697,7 +698,7 @@ static std::vector<std::string> s_Preset_print_options {
#endif /* HAS_PRESSURE_EQUALIZER */
"inner_wall_speed", "outer_wall_speed", "small_perimeter_speed", "small_perimeter_threshold", "sparse_infill_speed", "internal_solid_infill_speed",
"top_surface_speed", "support_speed", "support_object_xy_distance", "support_interface_speed",
"bridge_speed", "bridge_angle", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed",
"bridge_speed", "bridge_angle", "filter_out_gap_fill", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed",
"outer_wall_acceleration", "inner_wall_acceleration", "initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "travel_acceleration", "skirt_loops", "skirt_distance", "skirt_height", "draft_shield",
"default_jerk", "outer_wall_jerk", "inner_wall_jerk", "top_surface_jerk", "initial_layer_jerk","travel_jerk",
"brim_width", "brim_object_gap", "brim_type", "enable_support", "support_type", "support_threshold_angle", "enforce_support_layers",

View file

@ -1488,6 +1488,13 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.8));
def = this->add("filter_out_gap_fill", coFloat);
def->label = L("Filter out tiny gaps");
def->category = L("Layers and Perimeters");
def->tooltip = L("Filter out gaps smaller than the threshold specified. This setting won't affact top/bottom layers");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0));
def = this->add("gap_infill_speed", coFloat);
def->label = L("Gap infill");
def->category = L("Speed");

View file

@ -679,6 +679,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionEnum<FuzzySkinType>, fuzzy_skin))
((ConfigOptionFloat, fuzzy_skin_thickness))
((ConfigOptionFloat, fuzzy_skin_point_distance))
((ConfigOptionFloat, filter_out_gap_fill))
((ConfigOptionFloat, gap_infill_speed))
((ConfigOptionInt, sparse_infill_filament))
((ConfigOptionFloat, sparse_infill_line_width))

View file

@ -673,7 +673,8 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "inner_wall_line_width"
|| opt_key == "infill_wall_overlap") {
steps.emplace_back(posPerimeters);
} else if (opt_key == "gap_infill_speed") {
} else if (opt_key == "gap_infill_speed"
|| opt_key == "filter_out_gap_fill" ) {
// Return true if gap-fill speed has changed from zero value to non-zero or from non-zero value to zero.
auto is_gap_fill_changed_state_due_to_speed = [&opt_key, &old_config, &new_config]() -> bool {
if (opt_key == "gap_infill_speed") {
@ -687,9 +688,9 @@ bool PrintObject::invalidate_state_by_config_options(
};
// Filtering of unprintable regions in multi-material segmentation depends on if gap-fill is enabled or not.
// So step posSlice is invalidated when gap-fill was enabled/disabled by option "gap_fill_enabled" or by
// So step posSlice is invalidated when gap-fill was enabled/disabled by option "filter_out_gap_fill" or by
// changing "gap_infill_speed" to force recomputation of the multi-material segmentation.
if (this->is_mm_painted() && (opt_key == "gap_infill_speed" && is_gap_fill_changed_state_due_to_speed()))
if (this->is_mm_painted() && (opt_key == "filter_out_gap_fill" && (opt_key == "gap_infill_speed" && is_gap_fill_changed_state_due_to_speed())))
steps.emplace_back(posSlice);
steps.emplace_back(posPerimeters);
} else if (

View file

@ -103,7 +103,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle
double bridge_flow = print_config.opt_float("bridge_flow");
double inner_wall_speed = print_config.opt_float("inner_wall_speed");
double outer_wall_speed = print_config.get_abs_value("outer_wall_speed", inner_wall_speed);
// double gap_infill_speed = print_config.opt_bool("gap_fill_enabled") ? print_config.opt_float("gap_infill_speed") : 0.;
// double gap_infill_speed = print_config.opt_bool("filter_out_gap_fill") ? print_config.opt_float("gap_infill_speed") : 0.;
double sparse_infill_speed = print_config.opt_float("sparse_infill_speed");
double small_perimeter_speed = print_config.get_abs_value("small_perimeter_speed", inner_wall_speed);
double internal_solid_infill_speed = print_config.opt_float("internal_solid_infill_speed");

View file

@ -1806,6 +1806,7 @@ void TabPrint::build()
optgroup->append_single_option_line("sparse_infill_pattern", "fill-patterns#infill types and their properties of sparse");
optgroup->append_single_option_line("top_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface");
optgroup->append_single_option_line("bottom_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface");
optgroup->append_single_option_line("filter_out_gap_fill");
optgroup = page->new_optgroup(L("Advanced"), L"param_advanced");
optgroup->append_single_option_line("infill_wall_overlap");