From 3d1f61c7edde011f396826a8b49891e099f1b54b Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 16 May 2023 14:55:50 +0800 Subject: [PATCH] NEW: add tree_support_brim_width option Jira: STUDIO-2921 Change-Id: Id5fddc0b6f5ffe3beb9afb0be5f81a766fc5b21e (cherry picked from commit 86d7b6016e48143aad03744a58d44042ff0a0b4c) --- src/libslic3r/Preset.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 10 ++++++++++ src/libslic3r/PrintConfig.hpp | 1 + src/libslic3r/PrintObject.cpp | 1 + src/libslic3r/TreeSupport.cpp | 6 ++---- src/slic3r/GUI/ConfigManipulation.cpp | 4 ++-- src/slic3r/GUI/GUI_Factories.cpp | 2 +- src/slic3r/GUI/Tab.cpp | 1 + 8 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index b97a3714c1..c8127f6c1f 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -740,7 +740,7 @@ static std::vector s_Preset_print_options { "flush_into_infill", "flush_into_objects", "flush_into_support", // BBS "tree_support_branch_angle", "tree_support_wall_count", "tree_support_branch_distance", - "tree_support_branch_diameter", + "tree_support_branch_diameter","tree_support_brim_width", "detect_narrow_internal_solid_infill", "gcode_add_line_number", "enable_arc_fitting", "infill_combination", /*"adaptive_layer_height",*/ "support_bottom_interface_spacing", "enable_overhang_speed", "overhang_1_4_speed", "overhang_2_4_speed", "overhang_3_4_speed", "overhang_4_4_speed", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 90202335bb..5febc22e70 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2790,6 +2790,16 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionInt(1)); + def = this->add("tree_support_brim_width", coFloat); + def->label = L("Tree support brim width"); + def->category = L("Support"); + def->tooltip = L("The brim width around tree support. 0 means auto."); + def->sidetext = L("mm"); + def->min = 0; + def->max = 100; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(0)); + def = this->add("nozzle_temperature", coInts); def->label = L("Other layers"); def->tooltip = L("Nozzle temperature for layers after the initial one"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 6c6e9487bc..ba3dd0d9a0 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -685,6 +685,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, tree_support_branch_diameter)) ((ConfigOptionFloat, tree_support_branch_angle)) ((ConfigOptionInt, tree_support_wall_count)) + ((ConfigOptionFloat, tree_support_brim_width)) ((ConfigOptionBool, detect_narrow_internal_solid_infill)) // ((ConfigOptionBool, adaptive_layer_height)) ((ConfigOptionFloat, support_bottom_interface_spacing)) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 149218a1da..de41a291ff 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -770,6 +770,7 @@ bool PrintObject::invalidate_state_by_config_options( || opt_key == "tree_support_branch_distance" || opt_key == "tree_support_branch_diameter" || opt_key == "tree_support_branch_angle" + || opt_key == "tree_support_brim_width" || opt_key == "tree_support_wall_count") { steps.emplace_back(posSupportMaterial); } else if ( diff --git a/src/libslic3r/TreeSupport.cpp b/src/libslic3r/TreeSupport.cpp index 5c680ba721..3783bd676d 100644 --- a/src/libslic3r/TreeSupport.cpp +++ b/src/libslic3r/TreeSupport.cpp @@ -33,8 +33,6 @@ namespace Slic3r { #define unscale_(val) ((val) * SCALING_FACTOR) -#define FIRST_LAYER_EXPANSION 1.2 - inline unsigned int round_divide(unsigned int dividend, unsigned int divisor) //!< Return dividend divided by divisor rounded to the nearest integer { @@ -2020,7 +2018,7 @@ void TreeSupport::draw_circles(const std::vector>& contact_no const bool with_lightning_infill = m_support_params.base_fill_pattern == ipLightning; coordf_t support_extrusion_width = m_support_params.support_extrusion_width; - const size_t wall_count = config.tree_support_wall_count.value; + const float tree_brim_width = config.tree_support_brim_width.value; const PrintObjectConfig& object_config = m_object->config(); BOOST_LOG_TRIVIAL(info) << "draw_circles for object: " << m_object->model_object()->name; @@ -2110,7 +2108,7 @@ void TreeSupport::draw_circles(const std::vector>& contact_no } } if (layer_nr == 0 && m_raft_layers == 0) { - double brim_width = layers_to_top * layer_height / (scale * branch_radius) * 0.5; + double brim_width = tree_brim_width > 0 ? tree_brim_width : layers_to_top * layer_height / (scale * branch_radius) * 0.5; circle = offset(circle, scale_(brim_width))[0]; } area.emplace_back(ExPolygon(circle)); diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index b1fa307fc2..a844262e89 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -600,11 +600,11 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co //toggle_field("support_closing_radius", have_support_material && support_style == smsSnug); bool support_is_tree = config->opt_bool("enable_support") && is_tree(support_type); - for (auto el : {"tree_support_branch_angle", "tree_support_wall_count", "tree_support_branch_distance", "tree_support_branch_diameter"}) + for (auto el : {"tree_support_branch_angle", "tree_support_wall_count", "tree_support_branch_distance", "tree_support_branch_diameter","tree_support_brim_width"}) toggle_field(el, support_is_tree); // hide tree support settings when normal is selected - for (auto el : {"tree_support_branch_angle", "tree_support_wall_count", "tree_support_branch_distance", "tree_support_branch_diameter", "max_bridge_length"}) + for (auto el : {"tree_support_branch_angle", "tree_support_wall_count", "tree_support_branch_distance", "tree_support_branch_diameter", "max_bridge_length","tree_support_brim_width" }) toggle_line(el, support_is_tree); // tree support use max_bridge_length instead of bridge_no_support diff --git a/src/slic3r/GUI/GUI_Factories.cpp b/src/slic3r/GUI/GUI_Factories.cpp index 9617302f5b..5e84611862 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -80,7 +80,7 @@ std::map> 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}, {"support_filament", "",8},{"support_interface_filament", "",9},{"support_expansion", "",24},{"support_style", "",25}, - {"tree_support_branch_angle", "",10}, {"tree_support_wall_count", "",11},//tree support + {"tree_support_brim_width", "",26}, {"tree_support_branch_angle", "",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}, {"support_interface_top_layers", "",16},{"support_interface_bottom_layers", "",17},{"support_interface_spacing", "",18},{"support_bottom_interface_spacing", "",19}, {"support_object_xy_distance", "",20}, {"bridge_no_support", "",21},{"max_bridge_length", "",22},{"support_critical_regions_only", "",23} diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 9609d7e973..9d87885bdf 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1968,6 +1968,7 @@ void TabPrint::build() optgroup->append_single_option_line("tree_support_branch_diameter", "support#tree-support-only-options"); optgroup->append_single_option_line("tree_support_branch_angle", "support#tree-support-only-options"); optgroup->append_single_option_line("tree_support_wall_count"); + optgroup->append_single_option_line("tree_support_brim_width"); optgroup->append_single_option_line("support_top_z_distance", "support#top-z-distance"); optgroup->append_single_option_line("support_bottom_z_distance", "support#bottom-z-distance"); optgroup->append_single_option_line("support_base_pattern", "support#base-pattern");