mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-19 14:51:11 -06:00
Initial port of organic tree support from PrusaSlicer (#1938)
* Initial port of organic tree support from PrusaSlicer * Port missing Organic support parameters from PrusaSlicer * Update parameter naming * Reorganize the `raft_first_layer_expansion` and `raft_first_layer_density` parameters as they are not only used by rafts * Reset support style only in simple mode * Sync latest update from PrusaSlicer & copyrights * Fix organic tree support crash with invalid parameters --------- Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>
This commit is contained in:
parent
b50dfb69a2
commit
a1464735ce
33 changed files with 13299 additions and 38 deletions
|
@ -404,7 +404,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
|
|||
auto support_type = config->opt_enum<SupportType>("support_type");
|
||||
auto support_style = config->opt_enum<SupportMaterialStyle>("support_style");
|
||||
std::set<int> enum_set_normal = {0, 1, 2};
|
||||
std::set<int> enum_set_tree = {0, 3, 4, 5};
|
||||
std::set<int> enum_set_tree = {0, 3, 4, 5, 6};
|
||||
auto & set = is_tree(support_type) ? enum_set_tree : enum_set_normal;
|
||||
if (set.find(support_style) == set.end()) {
|
||||
DynamicPrintConfig new_conf = *config;
|
||||
|
@ -595,18 +595,22 @@ 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", "tree_support_adaptive_layer_height", "tree_support_auto_brim", "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", "tree_support_adaptive_layer_height", "tree_support_auto_brim", "tree_support_brim_width"})
|
||||
bool support_is_normal_tree = support_is_tree && support_style != smsOrganic;
|
||||
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);
|
||||
// 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"})
|
||||
toggle_line(el, support_is_organic);
|
||||
|
||||
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
|
||||
toggle_line("bridge_no_support", !support_is_tree);
|
||||
// non-organic tree support use max_bridge_length instead of bridge_no_support
|
||||
toggle_line("max_bridge_length", support_is_normal_tree);
|
||||
toggle_line("bridge_no_support", !support_is_normal_tree);
|
||||
|
||||
for (auto el : { "support_interface_spacing", "support_interface_filament",
|
||||
"support_interface_loop_pattern", "support_bottom_interface_spacing" })
|
||||
|
@ -625,8 +629,10 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
|
|||
toggle_field("support_filament", have_support_material || have_skirt);
|
||||
|
||||
toggle_line("raft_contact_distance", have_raft && !have_support_soluble);
|
||||
|
||||
// Orca: Raft, grid, snug and organic supports use these two parameters to control the size & density of the "brim"/flange
|
||||
for (auto el : { "raft_first_layer_expansion", "raft_first_layer_density"})
|
||||
toggle_line(el, have_raft);
|
||||
toggle_field(el, have_support_material && !support_is_normal_tree);
|
||||
|
||||
bool has_ironing = (config->opt_enum<IroningType>("ironing_type") != IroningType::NoIroning);
|
||||
for (auto el : { "ironing_flow", "ironing_spacing", "ironing_speed" })
|
||||
|
|
|
@ -1420,7 +1420,8 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
|||
}
|
||||
|
||||
// BBS set support style to default when support type changes
|
||||
if (opt_key == "support_type") {
|
||||
// Orca: do this only in simple mode
|
||||
if (opt_key == "support_type" && m_mode == comSimple) {
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
new_conf.set_key_value("support_style", new ConfigOptionEnum<SupportMaterialStyle>(smsDefault));
|
||||
m_config_manipulation.apply(m_config, &new_conf);
|
||||
|
@ -2003,6 +2004,8 @@ 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("raft_first_layer_density");
|
||||
optgroup->append_single_option_line("raft_first_layer_expansion");
|
||||
optgroup->append_single_option_line("support_on_build_plate_only");
|
||||
optgroup->append_single_option_line("support_critical_regions_only");
|
||||
optgroup->append_single_option_line("support_remove_small_overhang");
|
||||
|
@ -2011,8 +2014,6 @@ void TabPrint::build()
|
|||
optgroup = page->new_optgroup(L("Raft"), L"param_raft");
|
||||
optgroup->append_single_option_line("raft_layers");
|
||||
optgroup->append_single_option_line("raft_contact_distance");
|
||||
optgroup->append_single_option_line("raft_first_layer_density");
|
||||
optgroup->append_single_option_line("raft_first_layer_expansion");
|
||||
|
||||
optgroup = page->new_optgroup(L("Support filament"), L"param_support_filament");
|
||||
optgroup->append_single_option_line("support_filament", "support#support-filament");
|
||||
|
@ -2022,9 +2023,14 @@ void TabPrint::build()
|
|||
|
||||
//BBS
|
||||
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");
|
||||
|
@ -2165,7 +2171,7 @@ void TabPrint::toggle_options()
|
|||
if (auto choice = dynamic_cast<Choice*>(field)) {
|
||||
auto def = print_config_def.get("support_style");
|
||||
std::vector<int> enum_set_normal = {0, 1, 2};
|
||||
std::vector<int> enum_set_tree = {0, 3, 4, 5};
|
||||
std::vector<int> enum_set_tree = {0, 3, 4, 5, 6};
|
||||
auto & set = is_tree(support_type) ? enum_set_tree : enum_set_normal;
|
||||
auto & opt = const_cast<ConfigOptionDef &>(field->m_opt);
|
||||
auto cb = dynamic_cast<ComboBox *>(choice->window);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue