ENH: filter small gap
thanks SoftFever Signed-off-by: qing.zhang <qing.zhang@bambulab.com> Change-Id: I9bffe629419455b2a7b4494aa595b711619939da
This commit is contained in:
parent
346321379a
commit
739d8c9b28
|
@ -479,6 +479,7 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
|
|||
if (surface_fill.params.pattern == ipGrid)
|
||||
params.can_reverse = false;
|
||||
LayerRegion* layerm = this->m_regions[surface_fill.region_id];
|
||||
params.filter_out_gap_fill = layerm->region().config().filter_out_gap_fill.value;
|
||||
for (ExPolygon& expoly : surface_fill.expolygons) {
|
||||
f->no_overlap_expolygons = intersection_ex(surface_fill.no_overlap_expolygons, ExPolygons() = {expoly}, ApplySafetyOffset::Yes);
|
||||
// Spacing is modified by the filler to indicate adjustments. Reset it for each expolygon.
|
||||
|
|
|
@ -40,7 +40,7 @@ struct FillParams
|
|||
bool full_infill() const { return density > 0.9999f; }
|
||||
// Don't connect the fill lines around the inner perimeter.
|
||||
bool dont_connect() const { return anchor_length_max < 0.05f; }
|
||||
|
||||
double filter_out_gap_fill { 0.0 };
|
||||
// Fill density, fraction in <0, 1>
|
||||
float density { 0.f };
|
||||
|
||||
|
|
|
@ -3174,6 +3174,11 @@ void FillMonotonicLineWGapFill::fill_surface_extrusion(const Surface* surface, c
|
|||
|
||||
if (!polylines.empty() && !is_bridge(params.extrusion_role)) {
|
||||
ExtrusionEntityCollection gap_fill;
|
||||
// SoftFever: filter out tiny gap fills
|
||||
polylines.erase(std::remove_if(polylines.begin(), polylines.end(), [&](const ThickPolyline &p) {
|
||||
return p.length() < scale_(params.filter_out_gap_fill);
|
||||
}), polylines.end());
|
||||
|
||||
variable_width(polylines, erGapFill, params.flow, gap_fill.entities);
|
||||
coll_nosort->append(std::move(gap_fill.entities));
|
||||
}
|
||||
|
|
|
@ -172,6 +172,7 @@ void Layer::make_perimeters()
|
|||
&& config.outer_wall_speed == other_config.outer_wall_speed
|
||||
&& config.gap_infill_speed.value == other_config.gap_infill_speed.value
|
||||
&& config.detect_overhang_wall == other_config.detect_overhang_wall
|
||||
&& config.filter_out_gap_fill.value == other_config.filter_out_gap_fill.value
|
||||
&& config.opt_serialize("inner_wall_line_width") == other_config.opt_serialize("inner_wall_line_width")
|
||||
&& config.detect_thin_wall == other_config.detect_thin_wall
|
||||
//&& config.wall_infill_order == other_config.wall_infill_order
|
||||
|
|
|
@ -1194,6 +1194,10 @@ void PerimeterGenerator::process_classic()
|
|||
++ irun;
|
||||
}
|
||||
#endif
|
||||
// SoftFever: filter out tiny gap fills
|
||||
polylines.erase(std::remove_if(polylines.begin(), polylines.end(), [&](const ThickPolyline &p) {
|
||||
return p.length()< scale_(this->config->filter_out_gap_fill.value);
|
||||
}), polylines.end());
|
||||
|
||||
if (! polylines.empty()) {
|
||||
ExtrusionEntityCollection gap_fill;
|
||||
|
|
|
@ -762,6 +762,7 @@ static std::vector<std::string> s_Preset_print_options {
|
|||
"wall_distribution_count", "min_feature_size", "min_bead_width", "post_process",
|
||||
"seam_gap", "wipe_speed", "top_solid_infill_flow_ratio", "bottom_solid_infill_flow_ratio",
|
||||
"default_jerk", "outer_wall_jerk", "inner_wall_jerk", "infill_jerk", "top_surface_jerk", "initial_layer_jerk", "travel_jerk",
|
||||
"filter_out_gap_fill",
|
||||
// calib
|
||||
"print_flow_ratio"
|
||||
};
|
||||
|
|
|
@ -1580,6 +1580,12 @@ void PrintConfigDef::init_fff_params()
|
|||
def->mode = comSimple;
|
||||
def->set_default_value(new ConfigOptionFloat(0.8));
|
||||
|
||||
def = this->add("filter_out_gap_fill", coFloat);
|
||||
def->label = L("Filter out tiny gaps");
|
||||
def->tooltip = L("Filter out gaps smaller than the threshold specified. This setting won't affact top/bottom layers");
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionFloat(0));
|
||||
|
||||
def = this->add("gap_infill_speed", coFloat);
|
||||
def->label = L("Gap infill");
|
||||
def->category = L("Speed");
|
||||
|
|
|
@ -766,6 +766,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
//SoftFever
|
||||
((ConfigOptionFloat, top_solid_infill_flow_ratio))
|
||||
((ConfigOptionFloat, bottom_solid_infill_flow_ratio))
|
||||
((ConfigOptionFloat, filter_out_gap_fill))
|
||||
//calib
|
||||
((ConfigOptionFloat, print_flow_ratio)))
|
||||
|
||||
|
|
|
@ -715,7 +715,7 @@ 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") {
|
||||
|
@ -731,7 +731,7 @@ 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
|
||||
// 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 == "gap_infill_speed" || opt_key == "filter_out_gap_fill") && is_gap_fill_changed_state_due_to_speed()))
|
||||
steps.emplace_back(posSlice);
|
||||
steps.emplace_back(posPerimeters);
|
||||
} else if (
|
||||
|
|
|
@ -8311,7 +8311,7 @@ void Plater::calib_flowrate(int pass)
|
|||
_obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(1));
|
||||
_obj->config.set_key_value("top_shell_layers", new ConfigOptionInt(5));
|
||||
_obj->config.set_key_value("detect_thin_wall", new ConfigOptionBool(true));
|
||||
// _obj->config.set_key_value("filter_out_gap_fill", new ConfigOptionFloat(0)); // todo: SoftFever parameter
|
||||
_obj->config.set_key_value("filter_out_gap_fill", new ConfigOptionFloat(0)); // todo: SoftFever parameter
|
||||
_obj->config.set_key_value("sparse_infill_pattern", new ConfigOptionEnum<InfillPattern>(ipRectilinear));
|
||||
_obj->config.set_key_value("top_surface_line_width", new ConfigOptionFloat(nozzle_diameter * 1.2f));
|
||||
_obj->config.set_key_value("internal_solid_infill_line_width", new ConfigOptionFloat(nozzle_diameter * 1.2f));
|
||||
|
|
|
@ -1905,6 +1905,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("sparse_infill_anchor");
|
||||
optgroup->append_single_option_line("sparse_infill_anchor_max");
|
||||
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");
|
||||
|
|
|
@ -274,7 +274,7 @@ void CalibUtils::calib_flowrate(int pass, const CalibInfo& calib_info, std::stri
|
|||
_obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(1));
|
||||
_obj->config.set_key_value("top_shell_layers", new ConfigOptionInt(5));
|
||||
_obj->config.set_key_value("detect_thin_wall", new ConfigOptionBool(true));
|
||||
//_obj->config.set_key_value("filter_out_gap_fill", new ConfigOptionFloat(0)); // SoftFever parameter
|
||||
_obj->config.set_key_value("filter_out_gap_fill", new ConfigOptionFloat(0)); // SoftFever parameter
|
||||
_obj->config.set_key_value("sparse_infill_pattern", new ConfigOptionEnum<InfillPattern>(ipRectilinear));
|
||||
_obj->config.set_key_value("top_surface_line_width", new ConfigOptionFloat(nozzle_diameter * 1.2f));
|
||||
_obj->config.set_key_value("internal_solid_infill_line_width", new ConfigOptionFloat(nozzle_diameter * 1.2f));
|
||||
|
|
Loading…
Reference in New Issue