Skip to content

Commit

Permalink
Support threshold overlap (#6606)
Browse files Browse the repository at this point in the history
* Support threshold overlap

* Update tooltip
  • Loading branch information
vovodroid authored Jan 23, 2025
1 parent 1b1288c commit 7a5746b
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ static std::vector<std::string> s_Preset_print_options {
"top_surface_speed", "support_speed", "support_object_xy_distance", "support_interface_speed",
"bridge_speed", "internal_bridge_speed", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed",
"outer_wall_acceleration", "initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "skirt_type", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance", "skirt_start_angle", "skirt_height", "draft_shield",
"brim_width", "brim_object_gap", "brim_type", "brim_ears_max_angle", "brim_ears_detection_length", "enable_support", "support_type", "support_threshold_angle", "enforce_support_layers",
"brim_width", "brim_object_gap", "brim_type", "brim_ears_max_angle", "brim_ears_detection_length", "enable_support", "support_type", "support_threshold_angle", "support_threshold_overlap","enforce_support_layers",
"raft_layers", "raft_first_layer_density", "raft_first_layer_expansion", "raft_contact_distance", "raft_expansion",
"support_base_pattern", "support_base_pattern_spacing", "support_expansion", "support_style",
"independent_support_layer_height",
Expand Down
13 changes: 12 additions & 1 deletion src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4722,11 +4722,22 @@ void PrintConfigDef::init_fff_params()
def->category = L("Support");
def->tooltip = L("Support will be generated for overhangs whose slope angle is below the threshold.");
def->sidetext = L("°");
def->min = 1;
def->min = 0;
def->max = 90;
def->mode = comSimple;
def->set_default_value(new ConfigOptionInt(30));

def = this->add("support_threshold_overlap", coFloatOrPercent);
def->label = L("Threshold overlap");
def->category = L("Support");
def->tooltip = L("If threshold angle is zero, support will be generated for overhangs whose overlap is below the threshold. The smaller this value is, the steeper the overhang that can be printed without support.");
def->sidetext = L("mm or %");
def->min = 0;
def->max = 100;
def->max_literal = 0.5;
def->mode = comSimple;
def->set_default_value(new ConfigOptionFloatOrPercent(50., true));

def = this->add("tree_support_branch_angle", coFloat);
def->label = L("Tree support branch angle");
def->category = L("Support");
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionEnum<InternalBridgeFilter>, dont_filter_internal_bridges))
// Overhang angle threshold.
((ConfigOptionInt, support_threshold_angle))
((ConfigOptionFloatOrPercent, support_threshold_overlap))
((ConfigOptionFloat, support_object_xy_distance))
((ConfigOptionFloat, xy_hole_compensation))
((ConfigOptionFloat, xy_contour_compensation))
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "support_expansion"
//|| opt_key == "independent_support_layer_height" // BBS
|| opt_key == "support_threshold_angle"
|| opt_key == "support_threshold_overlap"
|| opt_key == "raft_expansion"
|| opt_key == "raft_first_layer_density"
|| opt_key == "raft_first_layer_expansion"
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/Support/SupportMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,8 +1517,8 @@ static inline ExPolygons detect_overhangs(
(threshold_rad > 0. ?
// Overhang defined by an angle.
float(scale_(lower_layer.height / tan(threshold_rad))) :
// Overhang defined by half the extrusion width.
0.5f * fw);
// Overhang defined by overlap.
fw - float(scale_(object_config.support_threshold_overlap.get_abs_value(unscale_(fw)))));
// Overhang polygons for this layer and region.
Polygons diff_polygons;
Polygons layerm_polygons = to_polygons(layerm->slices.surfaces);
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Support/TreeSupport3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ static std::vector<std::pair<TreeSupportSettings, std::vector<size_t>>> group_me
for (const LayerRegion *layerm : lower_layer.regions())
external_perimeter_width += layerm->flow(frExternalPerimeter).scaled_width();
external_perimeter_width /= lower_layer.region_count();
lower_layer_offset = float(0.5 * external_perimeter_width);
lower_layer_offset = external_perimeter_width - float(scale_(config.support_threshold_overlap.get_abs_value(unscale_(external_perimeter_width))));
} else
lower_layer_offset = scaled<float>(lower_layer.height / tan_threshold);
overhangs = lower_layer_offset == 0 ?
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/ConfigManipulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
"support_object_xy_distance"/*, "independent_support_layer_height"*/})
toggle_field(el, have_support_material);
toggle_field("support_threshold_angle", have_support_material && is_auto(support_type));
toggle_field("support_threshold_overlap", config->opt_int("support_threshold_angle") == 0 && have_support_material && is_auto(support_type));
//toggle_field("support_closing_radius", have_support_material && support_style == smsSnug);

bool support_is_tree = config->opt_bool("enable_support") && is_tree(support_type);
Expand Down
6 changes: 3 additions & 3 deletions src/slic3r/GUI/GUI_Factories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static SettingsFactory::Bundle FREQ_SETTINGS_BUNDLE_FFF =
{ L("Shell"), { "wall_loops", "top_shell_layers", "bottom_shell_layers"} },
{ L("Infill") , { "sparse_infill_density", "sparse_infill_pattern" } },
// BBS
{ L("Support") , { "enable_support", "support_type", "support_threshold_angle",
{ L("Support") , { "enable_support", "support_type", "support_threshold_angle", "support_threshold_overlap",
"support_base_pattern", "support_on_build_plate_only","support_critical_regions_only",
"support_remove_small_overhang",
"support_base_pattern_spacing", "support_expansion"}},
Expand All @@ -88,7 +88,7 @@ std::map<std::string, std::vector<SimpleSettingData>> SettingsFactory::OBJECT_C

}},
{ L("Support"), {{"brim_type", "",1},{"brim_width", "",2},{"brim_object_gap", "",3},
{"enable_support", "",4},{"support_type", "",5},{"support_threshold_angle", "",6},{"support_on_build_plate_only", "",7},
{"enable_support", "",4},{"support_type", "",5},{"support_threshold_angle", "",6}, {"support_threshold_overlap", "",6}, {"support_on_build_plate_only", "",7},
{"support_filament", "",8},{"support_interface_filament", "",9},{"support_expansion", "",24},{"support_style", "",25},
{"tree_support_brim_width", "",26}, {"tree_support_branch_angle", "",10},{"tree_support_branch_angle_organic","",10}, {"tree_support_wall_count", "",11},//tree support
{"support_top_z_distance", "",13},{"support_bottom_z_distance", "",12},{"support_base_pattern", "",14},{"support_base_pattern_spacing", "",15},
Expand Down Expand Up @@ -150,7 +150,7 @@ std::vector<SimpleSettingData> SettingsFactory::get_visible_options(const std::s
//Quality
"layer_height", "initial_layer_print_height", "adaptive_layer_height", "seam_position", "xy_hole_compensation", "xy_contour_compensation", "elefant_foot_compensation", "support_line_width",
//Support
"enable_support", "support_type", "support_threshold_angle", "support_on_build_plate_only", "support_critical_regions_only", "enforce_support_layers",
"enable_support", "support_type", "support_threshold_angle", "support_threshold_overlap", "support_on_build_plate_only", "support_critical_regions_only", "enforce_support_layers",
//tree support
"tree_support_wall_count",
//support
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2227,6 +2227,7 @@ void TabPrint::build()
optgroup->append_single_option_line("support_type", "support#support-types");
optgroup->append_single_option_line("support_style", "support#support-styles");
optgroup->append_single_option_line("support_threshold_angle", "support#threshold-angle");
optgroup->append_single_option_line("support_threshold_overlap", "support#threshold-angle");
optgroup->append_single_option_line("raft_first_layer_density");
optgroup->append_single_option_line("raft_first_layer_expansion");
optgroup->append_single_option_line("support_on_build_plate_only");
Expand Down

0 comments on commit 7a5746b

Please sign in to comment.