Skip to content

Commit

Permalink
Add elephant foot compensation over multiple layers
Browse files Browse the repository at this point in the history
#prusa3d/PrusaSlicer#10976

Co-authored-by: Roberto Mozzicato <bitblasters@gmail.com>
  • Loading branch information
2 people authored and hliebscher committed Oct 1, 2023
1 parent 1677de6 commit 494e779
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ static std::vector<std::string> s_Preset_print_options {
"ooze_prevention", "standby_temperature_delta", "interface_shells", "line_width", "initial_layer_line_width",
"inner_wall_line_width", "outer_wall_line_width", "sparse_infill_line_width", "internal_solid_infill_line_width",
"top_surface_line_width", "support_line_width", "infill_wall_overlap", "bridge_flow",
"elefant_foot_compensation", "xy_contour_compensation", "xy_hole_compensation", "resolution", "enable_prime_tower",
"elefant_foot_compensation", "elefant_foot_compensation_layers", "xy_contour_compensation", "xy_hole_compensation", "resolution", "enable_prime_tower",
"prime_tower_width", "prime_tower_brim_width", "prime_volume",
"wipe_tower_no_sparse_layers", "compatible_printers", "compatible_printers_condition", "inherits",
"flush_into_infill", "flush_into_objects", "flush_into_support",
Expand Down
11 changes: 11 additions & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,17 @@ void PrintConfigDef::init_common_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.));

def = this->add("elefant_foot_compensation_layers", coInt);
def->label = L("Elephant foot compensation layers");
def->category = L("Quality");
def->tooltip = L("The number of layers on which the elephant foot compensation will be active. "
"The first layer will be shrunk by the elephant foot compensation value, then "
"the next layers will be linearly shrunk less, up to the layer indicated by this value.");
def->sidetext = L("layers");
def->min = 1;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionInt(1));

def = this->add("layer_height", coFloat);
def->label = L("Layer height");
def->category = L("Quality");
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, brim_ears_max_angle))
((ConfigOptionBool, bridge_no_support))
((ConfigOptionFloat, elefant_foot_compensation))
((ConfigOptionInt, elefant_foot_compensation_layers))
((ConfigOptionFloat, max_bridge_length))
((ConfigOptionFloatOrPercent, line_width))
// Force the generation of solid shells between adjacent materials/volumes.
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ bool PrintObject::invalidate_state_by_config_options(
steps.emplace_back(posSlice);
} else if (
opt_key == "elefant_foot_compensation"
|| opt_key == "elefant_foot_compensation_layers"
|| opt_key == "support_top_z_distance"
|| opt_key == "support_bottom_z_distance"
|| opt_key == "xy_hole_compensation"
Expand Down
4 changes: 3 additions & 1 deletion src/libslic3r/PrintObjectSlice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,9 @@ void PrintObject::slice_volumes()
m_print->throw_if_canceled();
Layer *layer = m_layers[layer_id];
// Apply size compensation and perform clipping of multi-part objects.
float elfoot = (layer_id == 0) ? elephant_foot_compensation_scaled : 0.f;
float elfoot = elephant_foot_compensation_scaled > 0 && layer_id < m_config.elefant_foot_compensation_layers.value ?
elephant_foot_compensation_scaled - (elephant_foot_compensation_scaled / m_config.elefant_foot_compensation_layers.value) * layer_id :
0.f;
if (layer->m_regions.size() == 1) {
// Optimized version for a single region layer.
// Single region, growing or shrinking.
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,7 @@ void TabPrint::build()
optgroup->append_single_option_line("xy_hole_compensation");
optgroup->append_single_option_line("xy_contour_compensation");
optgroup->append_single_option_line("elefant_foot_compensation");
optgroup->append_single_option_line("elefant_foot_compensation_layers");
optgroup->append_single_option_line("precise_outer_wall");

optgroup = page->new_optgroup(L("Ironing"), L"param_ironing");
Expand Down

0 comments on commit 494e779

Please sign in to comment.