add elefant_foot_compensation_layers

This commit is contained in:
Wang YB
2024-04-18 11:21:55 +08:00
parent 68553eba55
commit 05d820c13d
6 changed files with 29 additions and 3 deletions

View File

@@ -485,6 +485,8 @@ static std::vector<std::string> s_Preset_print_options {
,"only_one_wall_first_layer" ,"only_one_wall_first_layer"
//w25 //w25
,"slow_down_layers" ,"slow_down_layers"
//w26
,"elefant_foot_compensation_layers"
}; };
static std::vector<std::string> s_Preset_filament_options { static std::vector<std::string> s_Preset_filament_options {

View File

@@ -309,6 +309,18 @@ void PrintConfigDef::init_common_params()
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.)); def->set_default_value(new ConfigOptionFloat(0.));
//w26
def = this->add("elefant_foot_compensation_layers", coInt);
def->label = L("Elephant foot compensation layers");
def->category = L("Advanced");
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("thumbnails", coString); def = this->add("thumbnails", coString);
def->label = L("G-code thumbnails"); def->label = L("G-code thumbnails");
def->tooltip = L("Picture sizes to be stored into a .gcode / .bgcode and .sl1 / .sl1s files, in the following format: \"XxY/EXT, XxY/EXT, ...\"\n" def->tooltip = L("Picture sizes to be stored into a .gcode / .bgcode and .sl1 / .sl1s files, in the following format: \"XxY/EXT, XxY/EXT, ...\"\n"
@@ -4598,6 +4610,8 @@ void PrintConfigDef::init_sla_params()
"support_pillar_diameter", "branchingsupport_pillar_diameter", "support_pillar_diameter", "branchingsupport_pillar_diameter",
"relative_correction_x", "relative_correction_y", "relative_correction_z", "relative_correction_x", "relative_correction_y", "relative_correction_z",
"elefant_foot_compensation", "elefant_foot_compensation",
//w26
"elefant_foot_compensation_layers",
// int // int
"support_points_density_relative" "support_points_density_relative"
}) { }) {

View File

@@ -513,6 +513,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, brim_width)) ((ConfigOptionFloat, brim_width))
((ConfigOptionBool, dont_support_bridges)) ((ConfigOptionBool, dont_support_bridges))
((ConfigOptionFloat, elefant_foot_compensation)) ((ConfigOptionFloat, elefant_foot_compensation))
//w26
((ConfigOptionInt, elefant_foot_compensation_layers))
((ConfigOptionFloatOrPercent, extrusion_width)) ((ConfigOptionFloatOrPercent, extrusion_width))
((ConfigOptionFloat, first_layer_acceleration_over_raft)) ((ConfigOptionFloat, first_layer_acceleration_over_raft))
((ConfigOptionFloatOrPercent, first_layer_speed_over_raft)) ((ConfigOptionFloatOrPercent, first_layer_speed_over_raft))

View File

@@ -739,6 +739,8 @@ bool PrintObject::invalidate_state_by_config_options(
steps.emplace_back(posSlice); steps.emplace_back(posSlice);
} else if ( } else if (
opt_key == "elefant_foot_compensation" opt_key == "elefant_foot_compensation"
//w26
|| opt_key == "elefant_foot_compensation_layers"
|| opt_key == "support_material_contact_distance" || opt_key == "support_material_contact_distance"
//w12 //w12
|| opt_key == "xy_size_compensation" || opt_key == "xy_size_compensation"

View File

@@ -775,7 +775,8 @@ void PrintObject::slice_volumes()
0.f; 0.f;
// Uncompensated slices for the first layer in case the Elephant foot compensation is applied. // Uncompensated slices for the first layer in case the Elephant foot compensation is applied.
std::vector<ExPolygons> lslices_elfoot_uncompensated; std::vector<ExPolygons> lslices_elfoot_uncompensated;
lslices_elfoot_uncompensated.resize(elephant_foot_compensation_scaled > 0 ? std::min(1, (int)m_layers.size()) : 0); //w26
lslices_elfoot_uncompensated.resize(elephant_foot_compensation_scaled > 0 ? std::min(m_config.elefant_foot_compensation_layers.value, (int)m_layers.size()) : 0);
tbb::parallel_for( tbb::parallel_for(
tbb::blocked_range<size_t>(0, m_layers.size()), tbb::blocked_range<size_t>(0, m_layers.size()),
//w12 //w12
@@ -785,8 +786,8 @@ void PrintObject::slice_volumes()
m_print->throw_if_canceled(); m_print->throw_if_canceled();
Layer *layer = m_layers[layer_id]; Layer *layer = m_layers[layer_id];
//w24 //w24
float elfoot = elephant_foot_compensation_scaled > 0 && layer_id < 1 ? float elfoot = elephant_foot_compensation_scaled > 0 && layer_id < m_config.elefant_foot_compensation_layers.value ?
elephant_foot_compensation_scaled - (elephant_foot_compensation_scaled / 1) * layer_id : elephant_foot_compensation_scaled - (elephant_foot_compensation_scaled / m_config.elefant_foot_compensation_layers.value) * layer_id :
0.f; 0.f;
if (layer->m_regions.size() == 1) { if (layer->m_regions.size() == 1) {
LayerRegion *layerm = layer->m_regions.front(); LayerRegion *layerm = layer->m_regions.front();

View File

@@ -1691,6 +1691,8 @@ void TabPrint::build()
optgroup->append_single_option_line("xy_hole_compensation"); optgroup->append_single_option_line("xy_hole_compensation");
optgroup->append_single_option_line("xy_contour_compensation"); optgroup->append_single_option_line("xy_contour_compensation");
optgroup->append_single_option_line("elefant_foot_compensation", "elephant-foot-compensation_114487"); optgroup->append_single_option_line("elefant_foot_compensation", "elephant-foot-compensation_114487");
//w26
optgroup->append_single_option_line("elefant_foot_compensation_layers");
optgroup = page->new_optgroup(L("Arachne perimeter generator")); optgroup = page->new_optgroup(L("Arachne perimeter generator"));
optgroup->append_single_option_line("wall_transition_angle"); optgroup->append_single_option_line("wall_transition_angle");
@@ -3010,6 +3012,8 @@ void TabPrinter::build_sla()
optgroup->append_line(line); optgroup->append_line(line);
optgroup->append_single_option_line("absolute_correction"); optgroup->append_single_option_line("absolute_correction");
optgroup->append_single_option_line("elefant_foot_compensation"); optgroup->append_single_option_line("elefant_foot_compensation");
//w26
optgroup->append_single_option_line("elefant_foot_compensation_layers");
optgroup->append_single_option_line("elefant_foot_min_width"); optgroup->append_single_option_line("elefant_foot_min_width");
optgroup->append_single_option_line("gamma_correction"); optgroup->append_single_option_line("gamma_correction");
@@ -5610,6 +5614,7 @@ std::vector<std::pair<std::string, std::vector<std::string>>> material_overrides
{"Corrections", { {"Corrections", {
"relative_correction", "relative_correction",
"elefant_foot_compensation" "elefant_foot_compensation"
}} }}
}; };