diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 276eea4f2f..c48782f93e 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -767,7 +767,7 @@ static std::vector s_Preset_print_options { "initial_layer_travel_speed", "exclude_object", "slow_down_layers", "infill_anchor", "infill_anchor_max","initial_layer_min_bead_width", "make_overhang_printable", "make_overhang_printable_angle", "make_overhang_printable_hole_size" ,"notes", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_extruder", "wiping_volumes_extruders","wipe_tower_bridging", "single_extruder_multi_material_priming", - "wipe_tower_rotation_angle" + "wipe_tower_rotation_angle", "tree_support_branch_distance_organic", "tree_support_branch_diameter_organic", "tree_support_branch_angle_organic" }; diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index f59c9cd617..4634f19264 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1203,10 +1203,10 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons* support_material_interface_flow(object).width()); if (object->config().tree_support_tip_diameter < extrusion_width - EPSILON) return { L("Organic support tree tip diameter must not be smaller than support material extrusion width."), object, "tree_support_tip_diameter" }; - if (object->config().tree_support_branch_diameter < 2. * extrusion_width - EPSILON) - return { L("Organic support branch diameter must not be smaller than 2x support material extrusion width."), object, "tree_support_branch_diameter" }; - if (object->config().tree_support_branch_diameter < object->config().tree_support_tip_diameter) - return { L("Organic support branch diameter must not be smaller than support tree tip diameter."), object, "tree_support_branch_diameter" }; + if (object->config().tree_support_branch_diameter_organic < 2. * extrusion_width - EPSILON) + return { L("Organic support branch diameter must not be smaller than 2x support material extrusion width."), object, "tree_support_branch_diameter_organic" }; + if (object->config().tree_support_branch_diameter_organic < object->config().tree_support_tip_diameter) + return { L("Organic support branch diameter must not be smaller than support tree tip diameter."), object, "tree_support_branch_diameter_organic" }; } } diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index a4b9603fc5..039cecaa77 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3522,8 +3522,8 @@ def = this->add("filament_loading_speed", coFloats); def->tooltip = L("Style and shape of the support. For normal support, projecting the supports into a regular grid " "will create more stable supports (default), while snug support towers will save material and reduce " "object scarring.\n" - "For tree support, slim style will merge branches more aggressively and save " - "a lot of material (default), while hybrid style will create similar structure to normal support " + "For tree support, slim and organic style will merge branches more aggressively and save " + "a lot of material (default organic), while hybrid style will create similar structure to normal support " "under large flat overhangs."); def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); def->enum_values.push_back("default"); @@ -3572,6 +3572,17 @@ def = this->add("filament_loading_speed", coFloats); def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(40.)); + def = this->add("tree_support_branch_angle_organic", coFloat); + def->label = L("Tree support branch angle"); + def->category = L("Support"); + def->tooltip = L("This setting determines the maximum overhang angle that t he branches of tree support allowed to make." + "If the angle is increased, the branches can be printed more horizontally, allowing them to reach farther."); + def->sidetext = L("°"); + def->min = 0; + def->max = 60; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(40.)); + def = this->add("tree_support_angle_slow", coFloat); def->label = L("Preferred Branch Angle"); def->category = L("Support"); @@ -3594,6 +3605,16 @@ def = this->add("filament_loading_speed", coFloats); def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(5.)); + def = this->add("tree_support_branch_distance_organic", coFloat); + def->label = L("Tree support branch distance"); + def->category = L("Support"); + def->tooltip = L("This setting determines the distance between neighboring tree support nodes."); + def->sidetext = L("mm"); + def->min = 1.0; + def->max = 10; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(1.)); + def = this->add("tree_support_top_rate", coPercent); def->label = L("Branch Density"); def->category = L("Support"); @@ -3606,7 +3627,7 @@ def = this->add("filament_loading_speed", coFloats); def->min = 5; def->max_literal = 35; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionPercent(15)); + def->set_default_value(new ConfigOptionPercent(30)); def = this->add("tree_support_adaptive_layer_height", coBool); def->label = L("Adaptive layer height"); @@ -3648,6 +3669,16 @@ def = this->add("filament_loading_speed", coFloats); def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(5.)); + def = this->add("tree_support_branch_diameter_organic", coFloat); + def->label = L("Tree support branch diameter"); + def->category = L("Support"); + def->tooltip = L("This setting determines the initial diameter of support nodes."); + def->sidetext = L("mm"); + def->min = 1.0; + def->max = 10; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(2.)); + def = this->add("tree_support_branch_diameter_angle", coFloat); // TRN PrintSettings: #lmFIXME def->label = L("Branch Diameter Angle"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 03c1f75c30..7480eeff41 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -699,7 +699,6 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionBool, flush_into_infill)) ((ConfigOptionBool, flush_into_support)) // BBS - ((ConfigOptionPercent, tree_support_top_rate)) ((ConfigOptionFloat, tree_support_branch_distance)) ((ConfigOptionFloat, tree_support_tip_diameter)) ((ConfigOptionFloat, tree_support_branch_diameter)) @@ -727,6 +726,11 @@ PRINT_CONFIG_CLASS_DEFINE( // Orca ((ConfigOptionFloat, make_overhang_printable_angle)) ((ConfigOptionFloat, make_overhang_printable_hole_size)) + ((ConfigOptionFloat, tree_support_branch_distance_organic)) + ((ConfigOptionPercent, tree_support_top_rate)) + ((ConfigOptionFloat, tree_support_branch_diameter_organic)) + ((ConfigOptionFloat, tree_support_branch_angle_organic)) + ) // This object is mapped to Perl as Slic3r::Config::PrintRegion. diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index eb83c36209..9cea53e4e8 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -7,6 +7,7 @@ #include "I18N.hpp" #include "Layer.hpp" #include "MutablePolygon.hpp" +#include "PrintConfig.hpp" #include "SupportMaterial.hpp" #include "Support/TreeSupport.hpp" #include "Surface.hpp" @@ -816,11 +817,14 @@ bool PrintObject::invalidate_state_by_config_options( || opt_key == "tree_support_brim_width" || opt_key == "tree_support_top_rate" || opt_key == "tree_support_branch_distance" + || opt_key == "tree_support_branch_distance_organic" || opt_key == "tree_support_tip_diameter" || opt_key == "tree_support_branch_diameter" + || opt_key == "tree_support_branch_diameter_organic" || opt_key == "tree_support_branch_diameter_angle" || opt_key == "tree_support_branch_diameter_double_wall" || opt_key == "tree_support_branch_angle" + || opt_key == "tree_support_branch_angle_organic" || opt_key == "tree_support_angle_slow" || opt_key == "tree_support_wall_count") { steps.emplace_back(posSupportMaterial); @@ -2501,7 +2505,7 @@ void PrintObject::_generate_support_material() support_material.generate(*this); if (this->config().enable_support.value && is_tree(this->config().support_type.value)) { - if (this->config().support_style.value == smsOrganic) { + if (this->config().support_style.value == smsOrganic || this->config().support_style.value == smsDefault) { fff_tree_support_generate(*this, std::function([this]() { this->throw_if_canceled(); })); } else { TreeSupport tree_support(*this, m_slicing_params); diff --git a/src/libslic3r/Support/TreeSupportCommon.cpp b/src/libslic3r/Support/TreeSupportCommon.cpp index b7789dfce7..132ece2504 100644 --- a/src/libslic3r/Support/TreeSupportCommon.cpp +++ b/src/libslic3r/Support/TreeSupportCommon.cpp @@ -71,14 +71,34 @@ TreeSupportMeshGroupSettings::TreeSupportMeshGroupSettings(const PrintObject &pr // this->minimum_support_area = // this->minimum_bottom_area = // this->support_offset = - this->support_tree_branch_distance = scaled(config.tree_support_branch_distance.value); - this->support_tree_angle = std::clamp(config.tree_support_branch_angle * M_PI / 180., 0., 0.5 * M_PI - EPSILON); + this->support_tree_branch_distance = scaled(config.tree_support_branch_distance_organic.value); + this->support_tree_angle = std::clamp(config.tree_support_branch_angle_organic * M_PI / 180., 0., 0.5 * M_PI - EPSILON); this->support_tree_angle_slow = std::clamp(config.tree_support_angle_slow * M_PI / 180., 0., this->support_tree_angle - EPSILON); - this->support_tree_branch_diameter = scaled(config.tree_support_branch_diameter.value); + this->support_tree_branch_diameter = scaled(config.tree_support_branch_diameter_organic.value); this->support_tree_branch_diameter_angle = std::clamp(config.tree_support_branch_diameter_angle * M_PI / 180., 0., 0.5 * M_PI - EPSILON); this->support_tree_top_rate = config.tree_support_top_rate.value; // percent // this->support_tree_tip_diameter = this->support_line_width; this->support_tree_tip_diameter = std::clamp(scaled(config.tree_support_tip_diameter.value), 0, this->support_tree_branch_diameter); + + std::cout << "\n---------------\n" + << "layer_height: " << layer_height << "\nresolution: " << resolution << "\nmin_feature_size: " << min_feature_size + << "\nsupport_angle: " << support_angle << "\nconfig.support_threshold_angle: " << config.support_threshold_angle << "\nsupport_line_width: " << support_line_width + << "\nsupport_roof_line_width: " << support_roof_line_width << "\nsupport_bottom_enable: " << support_bottom_enable + << "\nsupport_bottom_height: " << support_bottom_height + << "\nsupport_material_buildplate_only: " << support_material_buildplate_only + << "\nsupport_xy_distance: " << support_xy_distance << "\nsupport_xy_distance_overhang: " << support_xy_distance_overhang + << "\nsupport_top_distance: " << support_top_distance << "\nsupport_bottom_distance: " << support_bottom_distance + << "\nsupport_roof_enable: " << support_roof_enable << "\nsupport_roof_layers: " << support_roof_layers + << "\nsupport_floor_enable: " << support_floor_enable << "\nsupport_floor_layers: " << support_floor_layers + << "\nsupport_roof_pattern: " << support_roof_pattern << "\nsupport_pattern: " << support_pattern + << "\nsupport_line_spacing: " << support_line_spacing << "\nsupport_wall_count: " << support_wall_count + << "\nsupport_roof_line_distance: " << support_roof_line_distance + << "\nsupport_tree_branch_distance: " << support_tree_branch_distance + << "\nsupport_tree_angle_slow: " << support_tree_angle_slow + << "\nsupport_tree_branch_diameter: " << support_tree_branch_diameter + << "\nsupport_tree_branch_diameter_angle: " << support_tree_branch_diameter_angle + << "\nsupport_tree_top_rate: " << support_tree_top_rate << "\nsupport_tree_tip_diameter: " << support_tree_tip_diameter + << "\n---------------\n"; } TreeSupportSettings::TreeSupportSettings(const TreeSupportMeshGroupSettings &mesh_group_settings, const SlicingParameters &slicing_params) diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 28f5189a72..f190e67a53 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -6,6 +6,7 @@ #include "libslic3r/Model.hpp" #include "libslic3r/PresetBundle.hpp" #include "MsgDialog.hpp" +#include "libslic3r/PrintConfig.hpp" #include @@ -595,16 +596,16 @@ 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); - bool support_is_normal_tree = support_is_tree && support_style != smsOrganic; + bool support_is_normal_tree = support_is_tree && support_style != smsOrganic && support_style != smsDefault; bool support_is_organic = support_is_tree && !support_is_normal_tree; // settings shared by normal and organic trees for (auto el : {"tree_support_branch_angle", "tree_support_branch_distance", "tree_support_branch_diameter" }) - toggle_line(el, support_is_tree); + toggle_line(el, support_is_normal_tree); // settings specific to normal trees for (auto el : {"tree_support_wall_count", "tree_support_auto_brim", "tree_support_brim_width", "tree_support_adaptive_layer_height"}) toggle_line(el, support_is_normal_tree); // settings specific to organic trees - for (auto el : {"tree_support_angle_slow","tree_support_tip_diameter", "tree_support_top_rate", "tree_support_branch_diameter_angle", "tree_support_branch_diameter_double_wall"}) + for (auto el : {"tree_support_branch_angle_organic", "tree_support_branch_distance_organic", "tree_support_branch_diameter_organic","tree_support_angle_slow","tree_support_tip_diameter", "tree_support_top_rate", "tree_support_branch_diameter_angle", "tree_support_branch_diameter_double_wall"}) toggle_line(el, support_is_organic); toggle_field("tree_support_brim_width", support_is_tree && !config->opt_bool("tree_support_auto_brim")); diff --git a/src/slic3r/GUI/GUI_Factories.cpp b/src/slic3r/GUI/GUI_Factories.cpp index 21f0124014..f3a68b2608 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -82,7 +82,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_brim_width", "",26}, {"tree_support_branch_angle", "",10}, {"tree_support_wall_count", "",11},//tree support + {"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}, {"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},{"support_remove_small_overhang","",27} diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index d183e4528d..cb0c761bed 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2023,20 +2023,8 @@ void TabPrint::build() //optgroup = page->new_optgroup(L("Options for support material and raft")); - //BBS + // Support optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); - optgroup->append_single_option_line("tree_support_tip_diameter"); - optgroup->append_single_option_line("tree_support_branch_distance", "support#tree-support-only-options"); - optgroup->append_single_option_line("tree_support_top_rate"); - optgroup->append_single_option_line("tree_support_branch_diameter", "support#tree-support-only-options"); - optgroup->append_single_option_line("tree_support_branch_diameter_angle"); - optgroup->append_single_option_line("tree_support_branch_angle", "support#tree-support-only-options"); - optgroup->append_single_option_line("tree_support_angle_slow"); - optgroup->append_single_option_line("tree_support_branch_diameter_double_wall"); - 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_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_bottom_z_distance", "support#bottom-z-distance"); optgroup->append_single_option_line("support_base_pattern", "support#base-pattern"); @@ -2055,6 +2043,23 @@ void TabPrint::build() optgroup->append_single_option_line("max_bridge_length", "support#base-pattern"); optgroup->append_single_option_line("independent_support_layer_height", "support"); + optgroup = page->new_optgroup(L("Tree supports"), L"param_advanced"); + optgroup->append_single_option_line("tree_support_tip_diameter"); + optgroup->append_single_option_line("tree_support_branch_distance", "support#tree-support-only-options"); + optgroup->append_single_option_line("tree_support_branch_distance_organic", "support#tree-support-only-options"); + optgroup->append_single_option_line("tree_support_top_rate"); + optgroup->append_single_option_line("tree_support_branch_diameter", "support#tree-support-only-options"); + optgroup->append_single_option_line("tree_support_branch_diameter_organic", "support#tree-support-only-options"); + optgroup->append_single_option_line("tree_support_branch_diameter_angle"); + optgroup->append_single_option_line("tree_support_branch_angle", "support#tree-support-only-options"); + optgroup->append_single_option_line("tree_support_branch_angle_organic", "support#tree-support-only-options"); + optgroup->append_single_option_line("tree_support_angle_slow"); + optgroup->append_single_option_line("tree_support_branch_diameter_double_wall"); + 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_auto_brim"); + optgroup->append_single_option_line("tree_support_brim_width"); + page = add_options_page(L("Others"), "advanced"); optgroup = page->new_optgroup(L("Bed adhension"), L"param_adhension"); optgroup->append_single_option_line("skirt_loops");