tweak default organic tree settings.

This commit is contained in:
SoftFever 2023-09-13 19:16:21 +08:00
parent d0abc48765
commit e6269dd852
9 changed files with 95 additions and 30 deletions

View file

@ -767,7 +767,7 @@ static std::vector<std::string> 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"
};

View file

@ -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" };
}
}

View file

@ -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<SupportMaterialStyle>::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");

View file

@ -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.

View file

@ -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<void()>([this]() { this->throw_if_canceled(); }));
} else {
TreeSupport tree_support(*this, m_slicing_params);

View file

@ -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<coord_t>(config.tree_support_branch_distance.value);
this->support_tree_angle = std::clamp<double>(config.tree_support_branch_angle * M_PI / 180., 0., 0.5 * M_PI - EPSILON);
this->support_tree_branch_distance = scaled<coord_t>(config.tree_support_branch_distance_organic.value);
this->support_tree_angle = std::clamp<double>(config.tree_support_branch_angle_organic * M_PI / 180., 0., 0.5 * M_PI - EPSILON);
this->support_tree_angle_slow = std::clamp<double>(config.tree_support_angle_slow * M_PI / 180., 0., this->support_tree_angle - EPSILON);
this->support_tree_branch_diameter = scaled<coord_t>(config.tree_support_branch_diameter.value);
this->support_tree_branch_diameter = scaled<coord_t>(config.tree_support_branch_diameter_organic.value);
this->support_tree_branch_diameter_angle = std::clamp<double>(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<coord_t>(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)