Number of slow layers #796

This commit is contained in:
SoftFever 2023-05-07 18:13:29 +08:00 committed by SoftFever
parent 117cda00bc
commit be4373583f
7 changed files with 35 additions and 3 deletions

View file

@ -4000,6 +4000,21 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
if (path.role() != erBottomSurface)
speed = m_config.get_abs_value("initial_layer_speed");
}
else if(m_config.slow_down_layers > 1){
const auto _layer = layer_id() + 1;
if (_layer > 0 && _layer < m_config.slow_down_layers) {
const auto first_layer_speed =
is_perimeter(path.role())
? m_config.get_abs_value("initial_layer_speed")
: m_config.get_abs_value("initial_layer_infill_speed");
if (first_layer_speed < speed) {
speed = std::min(
speed,
Slic3r::lerp(first_layer_speed, speed,
(double)_layer / m_config.slow_down_layers));
}
}
}
//BBS: remove this config
//else if (this->object_layer_over_raft())
// speed = m_config.get_abs_value("first_layer_speed_over_raft", speed);

View file

@ -511,7 +511,12 @@ private:
void _print_first_layer_extruder_temperatures(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
// On the first printing layer. This flag triggers first layer speeds.
//BBS
bool on_first_layer() const { return m_layer != nullptr && m_layer->id() == 0 && abs(m_layer->bottom_z()) < EPSILON; }
bool on_first_layer() const { return m_layer != nullptr && m_layer->id() == 0 && abs(m_layer->bottom_z()) < EPSILON; }
int layer_id() const {
if (m_layer == nullptr)
return -1;
return m_layer->id();
}
// To control print speed of 1st object layer over raft interface.
bool object_layer_over_raft() const { return m_object_layer_over_raft; }

View file

@ -756,7 +756,7 @@ static std::vector<std::string> s_Preset_print_options {
"bridge_density", "precise_outer_wall", "overhang_speed_classic", "bridge_acceleration",
"sparse_infill_acceleration", "internal_solid_infill_acceleration", "tree_support_adaptive_layer_height", "tree_support_auto_brim",
"tree_support_brim_width", "gcode_comments", "gcode_label_objects",
"initial_layer_travel_speed", "exclude_object"
"initial_layer_travel_speed", "exclude_object", "slow_down_layers"
};

View file

@ -229,7 +229,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|| opt_key == "travel_speed"
|| opt_key == "travel_speed_z"
|| opt_key == "initial_layer_speed"
|| opt_key == "initial_layer_travel_speed") {
|| opt_key == "initial_layer_travel_speed"
|| opt_key == "slow_down_layers") {
//|| opt_key == "z_offset") {
steps.emplace_back(psWipeTower);
steps.emplace_back(psSkirtBrim);

View file

@ -1631,6 +1631,14 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloatOrPercent(100, true));
def = this->add("slow_down_layers", coInt);
def->label = L("Number of slow layers");
def->tooltip = L("The first few layers are printed slower than normal. "
"The speed is gradually increased in a linear fashion over the specified number of layers.");
def->category = L("Speed");
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionInt(0));
def = this->add("nozzle_temperature_initial_layer", coInts);
def->label = L("Initial layer");

View file

@ -1010,6 +1010,8 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionBool, gcode_label_objects))
((ConfigOptionBool, exclude_object))
((ConfigOptionBool, gcode_comments))
((ConfigOptionInt, slow_down_layers))
)

View file

@ -1922,6 +1922,7 @@ void TabPrint::build()
optgroup->append_single_option_line("initial_layer_speed");
optgroup->append_single_option_line("initial_layer_infill_speed");
optgroup->append_single_option_line("initial_layer_travel_speed");
optgroup->append_single_option_line("slow_down_layers");
optgroup = page->new_optgroup(L("Other layers speed"), L"param_speed", 15);
optgroup->append_single_option_line("outer_wall_speed");
optgroup->append_single_option_line("inner_wall_speed");