ENH: add slice_closing_radius back

For github issue #182

Signed-off-by: salt.wei <salt.wei@bambulab.com>
Change-Id: I38c69bed03b6d70cb21d58b5f724b4dc3a8992a4
This commit is contained in:
salt.wei 2022-09-07 09:14:46 +08:00 committed by Lane.Wei
parent 1a3a01a39f
commit 72221d2760
8 changed files with 24 additions and 7 deletions

View File

@ -643,7 +643,7 @@ std::string Preset::get_filament_type(std::string &display_filament_type)
} }
static std::vector<std::string> s_Preset_print_options { static std::vector<std::string> s_Preset_print_options {
"layer_height", "initial_layer_print_height", "wall_loops", "spiral_mode", "layer_height", "initial_layer_print_height", "wall_loops", "slice_closing_radius", "spiral_mode",
"top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness", "top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness",
"reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall",
"seam_position", "wall_infill_order", "sparse_infill_density", "sparse_infill_pattern", "top_surface_pattern", "bottom_surface_pattern", "seam_position", "wall_infill_order", "sparse_infill_density", "sparse_infill_pattern", "top_surface_pattern", "bottom_surface_pattern",
@ -749,6 +749,7 @@ static std::vector<std::string> s_Preset_sla_print_options {
"support_object_elevation", "support_object_elevation",
"support_points_density_relative", "support_points_density_relative",
"support_points_minimal_distance", "support_points_minimal_distance",
"slice_closing_radius",
"pad_enable", "pad_enable",
"pad_wall_thickness", "pad_wall_thickness",
"pad_wall_height", "pad_wall_height",

View File

@ -2059,6 +2059,16 @@ void PrintConfigDef::init_fff_params()
def->mode = comDevelop; def->mode = comDevelop;
def->set_default_value(new ConfigOptionBool(false)); def->set_default_value(new ConfigOptionBool(false));
def = this->add("slice_closing_radius", coFloat);
def->label = L("Slice gap closing radius");
def->category = L("Quality");
def->tooltip = L("Cracks smaller than 2x gap closing radius are being filled during the triangle mesh slicing. "
"The gap closing operation may reduce the final print resolution, therefore it is advisable to keep the value reasonably low.");
def->sidetext = L("mm");
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.049));
def = this->add("enable_support", coBool); def = this->add("enable_support", coBool);
//BBS: remove material behind support //BBS: remove material behind support
def->label = L("Enable support"); def->label = L("Enable support");

View File

@ -580,6 +580,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, raft_first_layer_expansion)) ((ConfigOptionFloat, raft_first_layer_expansion))
((ConfigOptionInt, raft_layers)) ((ConfigOptionInt, raft_layers))
((ConfigOptionEnum<SeamPosition>, seam_position)) ((ConfigOptionEnum<SeamPosition>, seam_position))
((ConfigOptionFloat, slice_closing_radius))
((ConfigOptionBool, enable_support)) ((ConfigOptionBool, enable_support))
// Automatic supports (generated based on support_threshold_angle). // Automatic supports (generated based on support_threshold_angle).
((ConfigOptionEnum<SupportType>, support_type)) ((ConfigOptionEnum<SupportType>, support_type))
@ -887,6 +888,8 @@ PRINT_CONFIG_CLASS_DEFINE(
//Number of the layers needed for the exposure time fade [3;20] //Number of the layers needed for the exposure time fade [3;20]
((ConfigOptionInt, faded_layers))/*= 10*/ ((ConfigOptionInt, faded_layers))/*= 10*/
((ConfigOptionFloat, slice_closing_radius))
// Enabling or disabling support creation // Enabling or disabling support creation
((ConfigOptionBool, supports_enable)) ((ConfigOptionBool, supports_enable))

View File

@ -679,7 +679,8 @@ bool PrintObject::invalidate_state_by_config_options(
//BBS //BBS
|| opt_key == "adaptive_layer_height" || opt_key == "adaptive_layer_height"
|| opt_key == "raft_layers" || opt_key == "raft_layers"
|| opt_key == "raft_contact_distance") { || opt_key == "raft_contact_distance"
|| opt_key == "slice_closing_radius") {
steps.emplace_back(posSlice); steps.emplace_back(posSlice);
} else if ( } else if (
opt_key == "elefant_foot_compensation" opt_key == "elefant_foot_compensation"

View File

@ -136,7 +136,7 @@ static std::vector<VolumeSlices> slice_volumes_inner(
slicing_ranges.reserve(layer_ranges.size()); slicing_ranges.reserve(layer_ranges.size());
MeshSlicingParamsEx params_base; MeshSlicingParamsEx params_base;
params_base.closing_radius = g_config_slice_closing_radius; params_base.closing_radius = print_object_config.slice_closing_radius.value;
params_base.extra_offset = 0; params_base.extra_offset = 0;
params_base.trafo = object_trafo; params_base.trafo = object_trafo;
//BBS: 0.0025mm is safe enough to simplify the data to speed slicing up for high-resolution model. //BBS: 0.0025mm is safe enough to simplify the data to speed slicing up for high-resolution model.
@ -1040,7 +1040,7 @@ void PrintObject::slice_volumes()
if (min_growth < 0.f || elfoot > 0.f) { if (min_growth < 0.f || elfoot > 0.f) {
// Apply the negative XY compensation. (the ones that is <0) // Apply the negative XY compensation. (the ones that is <0)
ExPolygons trimming; ExPolygons trimming;
static const float eps = float(scale_(g_config_slice_closing_radius) * 1.5); static const float eps = float(scale_(m_config.slice_closing_radius.value) * 1.5);
if (elfoot > 0.f) { if (elfoot > 0.f) {
lslices_1st_layer = offset_ex(layer->merged(eps), -eps); lslices_1st_layer = offset_ex(layer->merged(eps), -eps);
trimming = Slic3r::elephant_foot_compensation(lslices_1st_layer, trimming = Slic3r::elephant_foot_compensation(lslices_1st_layer,

View File

@ -930,7 +930,8 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|| opt_key == "supports_enable" || opt_key == "supports_enable"
|| opt_key == "support_object_elevation" || opt_key == "support_object_elevation"
|| opt_key == "pad_around_object" || opt_key == "pad_around_object"
|| opt_key == "pad_around_object_everywhere") { || opt_key == "pad_around_object_everywhere"
|| opt_key == "slice_closing_radius") {
steps.emplace_back(slaposObjectSlice); steps.emplace_back(slaposObjectSlice);
} else if ( } else if (
opt_key == "support_points_density_relative" opt_key == "support_points_density_relative"

View File

@ -518,7 +518,7 @@ void SLAPrint::Steps::slice_model(SLAPrintObject &po)
po.m_model_slices.clear(); po.m_model_slices.clear();
MeshSlicingParamsEx params; MeshSlicingParamsEx params;
params.closing_radius = float(g_config_slice_closing_radius); params.closing_radius = float(po.config().slice_closing_radius.value);
//BBS: always regular mode //BBS: always regular mode
//switch (po.config().slicing_mode.value) { //switch (po.config().slicing_mode.value) {
//case SlicingMode::Regular: params.mode = MeshSlicingParams::SlicingMode::Regular; break; //case SlicingMode::Regular: params.mode = MeshSlicingParams::SlicingMode::Regular; break;
@ -749,7 +749,7 @@ void SLAPrint::Steps::slice_supports(SLAPrintObject &po) {
for(auto& rec : po.m_slice_index) heights.emplace_back(rec.slice_level()); for(auto& rec : po.m_slice_index) heights.emplace_back(rec.slice_level());
sd->support_slices = sd->support_tree_ptr->slice( sd->support_slices = sd->support_tree_ptr->slice(
heights, float(g_config_slice_closing_radius)); heights, float(po.config().slice_closing_radius.value));
} }
for (size_t i = 0; i < sd->support_slices.size() && i < po.m_slice_index.size(); ++i) for (size_t i = 0; i < sd->support_slices.size() && i < po.m_slice_index.size(); ++i)

View File

@ -1764,6 +1764,7 @@ void TabPrint::build()
optgroup->append_single_option_line("seam_position", "Seam"); optgroup->append_single_option_line("seam_position", "Seam");
optgroup = page->new_optgroup(L("Precision")); optgroup = page->new_optgroup(L("Precision"));
optgroup->append_single_option_line("slice_closing_radius");
optgroup->append_single_option_line("resolution"); optgroup->append_single_option_line("resolution");
optgroup->append_single_option_line("enable_arc_fitting"); optgroup->append_single_option_line("enable_arc_fitting");
optgroup->append_single_option_line("xy_hole_compensation"); optgroup->append_single_option_line("xy_hole_compensation");