Added brim width setting for tree support

This commit is contained in:
SoftFever 2023-03-12 21:05:59 +08:00
parent a47c756112
commit 11c1c17245
7 changed files with 29 additions and 5 deletions

View file

@ -754,8 +754,8 @@ static std::vector<std::string> s_Preset_print_options {
"top_solid_infill_flow_ratio","bottom_solid_infill_flow_ratio","only_one_wall_first_layer", "print_flow_ratio", "seam_gap", "top_solid_infill_flow_ratio","bottom_solid_infill_flow_ratio","only_one_wall_first_layer", "print_flow_ratio", "seam_gap",
"role_based_wipe_speed", "wipe_speed", "accel_to_decel_enable", "accel_to_decel_factor", "wipe_on_loops", "role_based_wipe_speed", "wipe_speed", "accel_to_decel_enable", "accel_to_decel_factor", "wipe_on_loops",
"bridge_density", "precise_outer_wall", "overhang_speed_classic", "bridge_acceleration", "bridge_density", "precise_outer_wall", "overhang_speed_classic", "bridge_acceleration",
"sparse_infill_acceleration", "internal_solid_infill_acceleration", "tree_support_adaptive_layer_height", "sparse_infill_acceleration", "internal_solid_infill_acceleration", "tree_support_adaptive_layer_height", "tree_support_auto_brim",
"gcode_comments", "gcode_label_objects" "tree_support_brim_width", "gcode_comments", "gcode_label_objects"
}; };

View file

@ -3050,6 +3050,19 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Enabling this option means the height of tree support layer except the first will be automatically calculated "); def->tooltip = L("Enabling this option means the height of tree support layer except the first will be automatically calculated ");
def->set_default_value(new ConfigOptionBool(1)); def->set_default_value(new ConfigOptionBool(1));
def = this->add("tree_support_auto_brim", coBool);
def->label = L("Auto brim width");
def->category = L("Quality");
def->tooltip = L("Enabling this option means the width of the brim for tree support will be automatically calculated");
def->set_default_value(new ConfigOptionBool(1));
def = this->add("tree_support_brim_width", coFloat);
def->label = L("Tree support brim width");
def->category = L("Quality");
def->min = 0.0;
def->tooltip = L("Distance from tree branch to the outermost brim line");
def->set_default_value(new ConfigOptionFloat(3));
def = this->add("tree_support_branch_diameter", coFloat); def = this->add("tree_support_branch_diameter", coFloat);
def->label = L("Tree support branch diameter"); def->label = L("Tree support branch diameter");
def->category = L("Support"); def->category = L("Support");

View file

@ -691,6 +691,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, tree_support_branch_angle)) ((ConfigOptionFloat, tree_support_branch_angle))
((ConfigOptionInt, tree_support_wall_count)) ((ConfigOptionInt, tree_support_wall_count))
((ConfigOptionBool, tree_support_adaptive_layer_height)) ((ConfigOptionBool, tree_support_adaptive_layer_height))
((ConfigOptionBool, tree_support_auto_brim))
((ConfigOptionFloat, tree_support_brim_width))
((ConfigOptionBool, detect_narrow_internal_solid_infill)) ((ConfigOptionBool, detect_narrow_internal_solid_infill))
// ((ConfigOptionBool, adaptive_layer_height)) // ((ConfigOptionBool, adaptive_layer_height))
((ConfigOptionFloat, support_bottom_interface_spacing)) ((ConfigOptionFloat, support_bottom_interface_spacing))

View file

@ -775,6 +775,8 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "max_bridge_length" || opt_key == "max_bridge_length"
|| opt_key == "initial_layer_line_width" || opt_key == "initial_layer_line_width"
|| opt_key == "tree_support_adaptive_layer_height" || opt_key == "tree_support_adaptive_layer_height"
|| opt_key == "tree_support_auto_brim"
|| opt_key == "tree_support_brim_width"
|| opt_key == "tree_support_branch_distance" || opt_key == "tree_support_branch_distance"
|| opt_key == "tree_support_branch_diameter" || opt_key == "tree_support_branch_diameter"
|| opt_key == "tree_support_branch_angle" || opt_key == "tree_support_branch_angle"

View file

@ -2161,7 +2161,11 @@ void TreeSupport::draw_circles(const std::vector<std::vector<Node*>>& contact_no
} }
} }
if (layer_nr == 0 && m_raft_layers == 0) { if (layer_nr == 0 && m_raft_layers == 0) {
double brim_width = layers_to_top * layer_height / (scale * branch_radius) * 0.5; double brim_width =
config.tree_support_auto_brim
? layers_to_top * layer_height /
(scale * branch_radius) * 0.5
: config.tree_support_brim_width;
circle = offset(circle, scale_(brim_width))[0]; circle = offset(circle, scale_(brim_width))[0];
} }
area.emplace_back(ExPolygon(circle)); area.emplace_back(ExPolygon(circle));

View file

@ -613,14 +613,15 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
bool support_is_tree = config->opt_bool("enable_support") && is_tree(support_type); 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", for (auto el : {"tree_support_branch_angle", "tree_support_wall_count", "tree_support_branch_distance",
"tree_support_branch_diameter", "tree_support_adaptive_layer_height"}) "tree_support_branch_diameter", "tree_support_adaptive_layer_height", "tree_support_auto_brim", "tree_support_brim_width"})
toggle_field(el, support_is_tree); toggle_field(el, support_is_tree);
// hide tree support settings when normal is selected // hide tree support settings when normal is selected
for (auto el : {"tree_support_branch_angle", "tree_support_wall_count", "tree_support_branch_distance", for (auto el : {"tree_support_branch_angle", "tree_support_wall_count", "tree_support_branch_distance",
"tree_support_branch_diameter", "max_bridge_length", "tree_support_adaptive_layer_height"}) "tree_support_branch_diameter", "max_bridge_length", "tree_support_adaptive_layer_height", "tree_support_auto_brim", "tree_support_brim_width"})
toggle_line(el, support_is_tree); toggle_line(el, support_is_tree);
toggle_field("tree_support_brim_width", support_is_tree && !config->opt_bool("tree_support_auto_brim"));
// tree support use max_bridge_length instead of bridge_no_support // tree support use max_bridge_length instead of bridge_no_support
toggle_line("bridge_no_support", !support_is_tree); toggle_line("bridge_no_support", !support_is_tree);

View file

@ -2000,6 +2000,8 @@ void TabPrint::build()
optgroup->append_single_option_line("tree_support_branch_angle", "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_wall_count");
optgroup->append_single_option_line("tree_support_adaptive_layer_height"); optgroup->append_single_option_line("tree_support_adaptive_layer_height");
optgroup->append_single_option_line("tree_support_auto_brim");
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_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_bottom_z_distance", "support#bottom-z-distance");
optgroup->append_single_option_line("support_base_pattern", "support#base-pattern"); optgroup->append_single_option_line("support_base_pattern", "support#base-pattern");