ENH: add option "remove_small_overhang"

Let the user choose remove or not.

Github issue: #1810
Jira: STUDIO-2992

Change-Id: I9c5e087d171d16d8d7318b36efe825a6cbc29c33
This commit is contained in:
Arthur 2023-05-31 15:05:28 +08:00 committed by Lane.Wei
parent 5ae0adde16
commit 0ce835dcd4
11 changed files with 27 additions and 7 deletions

View file

@ -728,7 +728,8 @@ static std::vector<std::string> s_Preset_print_options {
"independent_support_layer_height",
"support_angle", "support_interface_top_layers", "support_interface_bottom_layers",
"support_interface_pattern", "support_interface_spacing", "support_interface_loop_pattern",
"support_top_z_distance", "support_on_build_plate_only","support_critical_regions_only", "bridge_no_support", "thick_bridges", "max_bridge_length", "print_sequence",
"support_top_z_distance", "support_on_build_plate_only","support_critical_regions_only", "support_remove_small_overhang",
"bridge_no_support", "thick_bridges", "max_bridge_length", "print_sequence",
"filename_format", "wall_filament", "support_bottom_z_distance",
"sparse_infill_filament", "solid_infill_filament", "support_filament", "support_interface_filament",
"ooze_prevention", "standby_temperature_delta", "interface_shells", "line_width", "initial_layer_line_width",

View file

@ -2566,6 +2566,13 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("support_remove_small_overhang", coBool);
def->label = L("Remove small overhangs");
def->category = L("Support");
def->tooltip = L("Remove small overhangs that possibly need no supports.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(true));
// BBS: change type to common float.
// It may be rounded to mulitple layer height when independent_support_layer_height is false.
def = this->add("support_top_z_distance", coFloat);
@ -4025,7 +4032,7 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
, "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative"
#endif /* HAS_PRESSURE_EQUALIZER */
// BBS
, "support_sharp_tails","remove_small_overhangs", "support_with_sheath",
, "support_sharp_tails","support_remove_small_overhangs", "support_with_sheath",
"tree_support_branch_diameter_angle", "tree_support_collision_resolution", "tree_support_with_infill",
"small_perimeter_speed", "max_volumetric_speed", "max_print_speed",
"support_closing_radius",

View file

@ -649,6 +649,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, support_angle))
((ConfigOptionBool, support_on_build_plate_only))
((ConfigOptionBool, support_critical_regions_only))
((ConfigOptionBool, support_remove_small_overhang))
((ConfigOptionFloat, support_top_z_distance))
((ConfigOptionFloat, support_bottom_z_distance))
((ConfigOptionInt, enforce_support_layers))

View file

@ -762,6 +762,7 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "support_angle"
|| opt_key == "support_on_build_plate_only"
|| opt_key == "support_critical_regions_only"
|| opt_key == "support_remove_small_overhang"
|| opt_key == "enforce_support_layers"
|| opt_key == "support_filament"
|| opt_key == "support_line_width"

View file

@ -2351,7 +2351,8 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
return MyLayersPtr();
// BBS group overhang clusters
if (g_config_remove_small_overhangs) {
const bool config_remove_small_overhangs = m_object_config->support_remove_small_overhang.value;
if (config_remove_small_overhangs) {
std::vector<OverhangCluster> clusters;
double fw_scaled = scale_(m_object_config->line_width);
std::set<ExPolygon*> removed_overhang;

View file

@ -726,6 +726,7 @@ void TreeSupport::detect_overhangs(bool detect_first_sharp_tail_only)
const coordf_t max_bridge_length = scale_(config.max_bridge_length.value);
const bool bridge_no_support = max_bridge_length > 0;
const bool support_critical_regions_only = config.support_critical_regions_only.value;
const bool config_remove_small_overhangs = config.support_remove_small_overhang.value;
const int enforce_support_layers = config.enforce_support_layers.value;
const double area_thresh_well_supported = SQ(scale_(6));
const double length_thresh_well_supported = scale_(6);
@ -1043,7 +1044,7 @@ void TreeSupport::detect_overhangs(bool detect_first_sharp_tail_only)
auto blockers = m_object->slice_support_blockers();
m_object->project_and_append_custom_facets(false, EnforcerBlockerType::ENFORCER, enforcers);
m_object->project_and_append_custom_facets(false, EnforcerBlockerType::BLOCKER, blockers);
if (is_auto(stype) && g_config_remove_small_overhangs) {
if (is_auto(stype) && config_remove_small_overhangs) {
if (blockers.size() < m_object->layer_count())
blockers.resize(m_object->layer_count());
for (auto& cluster : overhangClusters) {

View file

@ -90,7 +90,6 @@ static constexpr bool RELATIVE_E_AXIS = 1;
//BBS: some global const config which user can not change, but developer can
static constexpr bool g_config_support_sharp_tails = true;
static constexpr bool g_config_remove_small_overhangs = true;
static constexpr float g_config_tree_support_collision_resolution = 0.2;
// Write slices as SVG images into out directory during the 2D processing of the slices.