From f0d8014ef17dc38352b480d7b4ee931ac288097c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CF=80=C2=B2?= Date: Sun, 26 Apr 2026 12:03:35 +0300 Subject: [PATCH] Elefant foot compensation for solid layers (#11526) * Elefant foot compensation for solid layers Elefant foot compensation for solid layers above bottommost by infill density manipulation. * Update Fill.cpp * change the option to expert cat * use is_approx for float --------- Co-authored-by: SoftFever --- src/libslic3r/Fill/Fill.cpp | 9 ++++++++- src/libslic3r/Preset.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 12 ++++++++++++ src/libslic3r/PrintConfig.hpp | 1 + src/libslic3r/PrintObject.cpp | 1 + src/slic3r/GUI/ConfigManipulation.cpp | 2 +- src/slic3r/GUI/Tab.cpp | 1 + 7 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index aecf658a14..f9ead17ed5 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -1320,7 +1320,14 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive: params.density = f->print_object_config->internal_bridge_density.get_abs_value(1.0); params.dont_adjust = true; } - // BBS: make fill + // Orca: Elefant foot compensation for solid layers above bottommost by infill density manipulation. + float elefant_density = f->print_object_config->elefant_foot_layers_density.get_abs_value(1.0); + if (!is_approx(elefant_density, 1.0f) && surface_fill.surface.is_solid_infill()) { + size_t elefant_layers = f->print_object_config->elefant_foot_compensation_layers.value; + if (f->layer_id > 0 && f->layer_id <= elefant_layers) + params.density = elefant_density * (elefant_layers - (f->layer_id - 1)) / elefant_layers; + } + // make fill f->fill_surface_extrusion(&surface_fill.surface, params, m_regions[surface_fill.region_id]->fills.entities); diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 6371a631e2..82fe8679a2 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -919,7 +919,7 @@ static std::vector s_Preset_print_options { "outer_wall_line_width", "sparse_infill_line_width", "internal_solid_infill_line_width", "skin_infill_line_width","skeleton_infill_line_width", "top_surface_line_width", "support_line_width", "infill_wall_overlap","top_bottom_infill_wall_overlap", "bridge_flow", "internal_bridge_flow", - "elefant_foot_compensation", "elefant_foot_compensation_layers", "xy_contour_compensation", "xy_hole_compensation", "resolution", "enable_prime_tower", "prime_tower_enable_framework", + "elefant_foot_compensation", "elefant_foot_compensation_layers", "elefant_foot_layers_density", "xy_contour_compensation", "xy_hole_compensation", "resolution", "enable_prime_tower", "prime_tower_enable_framework", "prime_tower_width", "prime_tower_brim_width", "prime_tower_skip_points", "prime_volume", "prime_tower_infill_gap", "prime_tower_flat_ironing", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index e9d2fe8e74..ab080795b0 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -695,6 +695,18 @@ void PrintConfigDef::init_common_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionInt(1)); + def = this->add("elefant_foot_layers_density", coPercent); + def->label = L("Elefant foot layers density"); + def->category = L("Quality"); + def->tooltip = L("Density of internal solid infill for elefant foot layers compensation. " + "The initial value for the second layer is set. " + "Subsequent layers become linearly denser by the height specified in elefant_foot_compensation_layers. "); + def->sidetext = "%"; + def->min = 50; + def->max = 100; + def->mode = comExpert; + def->set_default_value(new ConfigOptionPercent(100)); + def = this->add("layer_height", coFloat); def->label = L("Layer height"); def->category = L("Quality"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index a314727e6d..6eebb5f5b7 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -898,6 +898,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionBool, bridge_no_support)) ((ConfigOptionFloat, elefant_foot_compensation)) ((ConfigOptionInt, elefant_foot_compensation_layers)) + ((ConfigOptionPercent, elefant_foot_layers_density)) ((ConfigOptionFloat, max_bridge_length)) ((ConfigOptionFloatOrPercent, line_width)) // Force the generation of solid shells between adjacent materials/volumes. diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 6a10d432af..76d9312245 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -1092,6 +1092,7 @@ bool PrintObject::invalidate_state_by_config_options( } else if ( opt_key == "elefant_foot_compensation" || opt_key == "elefant_foot_compensation_layers" + || opt_key == "elefant_foot_layers_density" || opt_key == "support_top_z_distance" || opt_key == "support_bottom_z_distance" || opt_key == "xy_hole_compensation" diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 4936c65aca..ef4c01440f 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -721,7 +721,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co toggle_line("brim_ears_detection_length", have_brim_ear); // Hide Elephant foot compensation layers if elefant_foot_compensation is not enabled - toggle_line("elefant_foot_compensation_layers", config->opt_float("elefant_foot_compensation") > 0); + toggle_line("elefant_foot_compensation_layers", config->opt_float("elefant_foot_compensation") > 0 || config->option("elefant_foot_layers_density")->get_abs_value(1.0f) < 1.0f); bool have_raft = config->opt_int("raft_layers") > 0; bool have_support_material = config->opt_bool("enable_support") || have_raft; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 49c68efb8a..c62bbcdf95 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2288,6 +2288,7 @@ void TabPrint::build() optgroup->append_single_option_line("xy_hole_compensation", "quality_settings_precision#x-y-compensation"); optgroup->append_single_option_line("xy_contour_compensation", "quality_settings_precision#x-y-compensation"); optgroup->append_single_option_line("elefant_foot_compensation", "quality_settings_precision#elephant-foot-compensation"); + optgroup->append_single_option_line("elefant_foot_layers_density", "quality_settings_precision#elephant-foot-compensation"); optgroup->append_single_option_line("elefant_foot_compensation_layers", "quality_settings_precision#elephant-foot-compensation"); optgroup->append_single_option_line("precise_outer_wall", "quality_settings_precision#precise-wall"); optgroup->append_single_option_line("precise_z_height", "quality_settings_precision#precise-z-height");