First layer travel speed

#443
This commit is contained in:
SoftFever 2023-03-14 00:57:18 +08:00
parent 6d8f01f48d
commit 5a986c18a1
9 changed files with 42 additions and 15 deletions

View file

@ -2727,6 +2727,7 @@ GCode::LayerResult GCode::process_layer(
//support is attached above the object, and support layers has independent layer height, then the lowest support //support is attached above the object, and support layers has independent layer height, then the lowest support
//interface layer id is 0. //interface layer id is 0.
bool first_layer = (layer.id() == 0 && abs(layer.bottom_z()) < EPSILON); bool first_layer = (layer.id() == 0 && abs(layer.bottom_z()) < EPSILON);
m_writer.set_is_first_layer(first_layer);
unsigned int first_extruder_id = layer_tools.extruders.front(); unsigned int first_extruder_id = layer_tools.extruders.front();
// Initialize config with the 1st object to be printed at this layer. // Initialize config with the 1st object to be printed at this layer.

View file

@ -334,7 +334,9 @@ std::string GCodeWriter::travel_to_xy(const Vec2d &point, const std::string &com
GCodeG1Formatter w; GCodeG1Formatter w;
w.emit_xy(point_on_plate); w.emit_xy(point_on_plate);
w.emit_f(this->config.travel_speed.value * 60.0); auto speed = m_is_first_layer
? this->config.get_abs_value("initial_layer_travel_speed") : this->config.travel_speed.value;
w.emit_f(speed * 60.0);
//BBS //BBS
w.emit_comment(GCodeWriter::full_gcode_comment, comment); w.emit_comment(GCodeWriter::full_gcode_comment, comment);
return w.string(); return w.string();
@ -353,6 +355,8 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co
used for unlift. */ used for unlift. */
// BBS // BBS
Vec3d dest_point = point; Vec3d dest_point = point;
auto travel_speed =
m_is_first_layer ? this->config.get_abs_value("initial_layer_travel_speed") : this->config.travel_speed.value;
//BBS: a z_hop need to be handle when travel //BBS: a z_hop need to be handle when travel
if (std::abs(m_to_lift) > EPSILON) { if (std::abs(m_to_lift) > EPSILON) {
assert(std::abs(m_lifted) < EPSILON); assert(std::abs(m_lifted) < EPSILON);
@ -372,6 +376,9 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co
Vec3d target = { dest_point(0) - m_x_offset, dest_point(1) - m_y_offset, dest_point(2) }; Vec3d target = { dest_point(0) - m_x_offset, dest_point(1) - m_y_offset, dest_point(2) };
Vec3d delta = target - source; Vec3d delta = target - source;
Vec2d delta_no_z = { delta(0), delta(1) }; Vec2d delta_no_z = { delta(0), delta(1) };
//BBS: don'need slope travel because we don't know where is the source position the first time //BBS: don'need slope travel because we don't know where is the source position the first time
//BBS: Also don't need to do slope move or spiral lift if x-y distance is absolute zero //BBS: Also don't need to do slope move or spiral lift if x-y distance is absolute zero
if (this->is_current_position_clear() && delta(2) > 0 && delta_no_z.norm() != 0.0f) { if (this->is_current_position_clear() && delta(2) > 0 && delta_no_z.norm() != 0.0f) {
@ -392,7 +399,7 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co
Vec3d slope_top_point = Vec3d(temp(0), temp(1), delta(2)) + source; Vec3d slope_top_point = Vec3d(temp(0), temp(1), delta(2)) + source;
GCodeG1Formatter w0; GCodeG1Formatter w0;
w0.emit_xyz(slope_top_point); w0.emit_xyz(slope_top_point);
w0.emit_f(this->config.travel_speed.value * 60.0); w0.emit_f(travel_speed * 60.0);
//BBS //BBS
w0.emit_comment(GCodeWriter::full_gcode_comment, comment); w0.emit_comment(GCodeWriter::full_gcode_comment, comment);
slop_move = w0.string(); slop_move = w0.string();
@ -404,13 +411,13 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co
GCodeG1Formatter w0; GCodeG1Formatter w0;
if (this->is_current_position_clear()) { if (this->is_current_position_clear()) {
w0.emit_xyz(target); w0.emit_xyz(target);
w0.emit_f(this->config.travel_speed.value * 60.0); w0.emit_f(travel_speed * 60.0);
w0.emit_comment(GCodeWriter::full_gcode_comment, comment); w0.emit_comment(GCodeWriter::full_gcode_comment, comment);
xy_z_move = w0.string(); xy_z_move = w0.string();
} }
else { else {
w0.emit_xy(Vec2d(target.x(), target.y())); w0.emit_xy(Vec2d(target.x(), target.y()));
w0.emit_f(this->config.travel_speed.value * 60.0); w0.emit_f(travel_speed * 60.0);
w0.emit_comment(GCodeWriter::full_gcode_comment, comment); w0.emit_comment(GCodeWriter::full_gcode_comment, comment);
xy_z_move = w0.string() + _travel_to_z(target.z(), comment); xy_z_move = w0.string() + _travel_to_z(target.z(), comment);
} }
@ -444,7 +451,7 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co
GCodeG1Formatter w; GCodeG1Formatter w;
w.emit_xyz(point_on_plate); w.emit_xyz(point_on_plate);
w.emit_f(this->config.travel_speed.value * 60.0); w.emit_f(travel_speed * 60.0);
//BBS //BBS
w.emit_comment(GCodeWriter::full_gcode_comment, comment); w.emit_comment(GCodeWriter::full_gcode_comment, comment);
return w.string(); return w.string();
@ -474,8 +481,10 @@ std::string GCodeWriter::_travel_to_z(double z, const std::string &comment)
m_pos(2) = z; m_pos(2) = z;
double speed = this->config.travel_speed_z.value; double speed = this->config.travel_speed_z.value;
if (speed == 0.) if (speed == 0.) {
speed = this->config.travel_speed.value; speed = m_is_first_layer ? this->config.get_abs_value("initial_layer_travel_speed")
: this->config.travel_speed.value;
}
GCodeG1Formatter w; GCodeG1Formatter w;
w.emit_z(z); w.emit_z(z);
@ -490,8 +499,10 @@ std::string GCodeWriter::_spiral_travel_to_z(double z, const Vec2d &ij_offset, c
m_pos(2) = z; m_pos(2) = z;
double speed = this->config.travel_speed_z.value; double speed = this->config.travel_speed_z.value;
if (speed == 0.) if (speed == 0.) {
speed = this->config.travel_speed.value; speed = m_is_first_layer ? this->config.get_abs_value("initial_layer_travel_speed")
: this->config.travel_speed.value;
}
std::string output = "G17\n"; std::string output = "G17\n";
GCodeG2G3Formatter w(true); GCodeG2G3Formatter w(true);

View file

@ -25,7 +25,7 @@ public:
m_lifted(0), m_lifted(0),
m_to_lift(0), m_to_lift(0),
m_to_lift_type(LiftType::NormalLift), m_to_lift_type(LiftType::NormalLift),
m_current_speed(3600) m_current_speed(3600), m_is_first_layer(true)
{} {}
Extruder* extruder() { return m_extruder; } Extruder* extruder() { return m_extruder; }
const Extruder* extruder() const { return m_extruder; } const Extruder* extruder() const { return m_extruder; }
@ -98,6 +98,7 @@ public:
//SoftFever //SoftFever
void set_is_bbl_machine(bool bval) {m_is_bbl_printers = bval;} void set_is_bbl_machine(bool bval) {m_is_bbl_printers = bval;}
const bool is_bbl_printers() const {return m_is_bbl_printers;} const bool is_bbl_printers() const {return m_is_bbl_printers;}
void set_is_first_layer(bool bval) { m_is_first_layer = bval; }
private: private:
// Extruders are sorted by their ID, so that binary search is possible. // Extruders are sorted by their ID, so that binary search is possible.
@ -138,6 +139,7 @@ private:
//SoftFever //SoftFever
bool m_is_bbl_printers = false; bool m_is_bbl_printers = false;
double m_current_speed; double m_current_speed;
bool m_is_first_layer = true;
std::string _travel_to_z(double z, const std::string &comment); std::string _travel_to_z(double z, const std::string &comment);
std::string _spiral_travel_to_z(double z, const Vec2d &ij_offset, const std::string &comment); std::string _spiral_travel_to_z(double z, const Vec2d &ij_offset, const std::string &comment);

View file

@ -755,7 +755,7 @@ static std::vector<std::string> s_Preset_print_options {
"role_based_wipe_speed", "wipe_speed", "accel_to_decel_enable", "accel_to_decel_factor", "wipe_on_loops", "role_based_wipe_speed", "wipe_speed", "accel_to_decel_enable", "accel_to_decel_factor", "wipe_on_loops",
"bridge_density", "precise_outer_wall", "overhang_speed_classic", "bridge_acceleration", "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", "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" "tree_support_brim_width", "gcode_comments", "gcode_label_objects", "initial_layer_travel_speed"
}; };

View file

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

View file

@ -1636,6 +1636,17 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(60.0)); def->set_default_value(new ConfigOptionFloat(60.0));
def = this->add("initial_layer_travel_speed", coFloatOrPercent);
def->label = L("Initial layer travel speed");
def->tooltip = L("Travel speed of initial layer");
def->category = L("Speed");
def->sidetext = L("mm/s or %");
def->ratio_over = "travel_speed";
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloatOrPercent(100, true));
def = this->add("nozzle_temperature_initial_layer", coInts); def = this->add("nozzle_temperature_initial_layer", coInts);
def->label = L("Initial layer"); def->label = L("Initial layer");
def->full_label = L("Initial layer nozzle temperature"); def->full_label = L("Initial layer nozzle temperature");

View file

@ -880,6 +880,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionBool, use_relative_e_distances)) ((ConfigOptionBool, use_relative_e_distances))
((ConfigOptionBool, accel_to_decel_enable)) ((ConfigOptionBool, accel_to_decel_enable))
((ConfigOptionPercent, accel_to_decel_factor)) ((ConfigOptionPercent, accel_to_decel_factor))
((ConfigOptionFloatOrPercent, initial_layer_travel_speed))
) )
// This object is mapped to Perl as Slic3r::Config::Print. // This object is mapped to Perl as Slic3r::Config::Print.
@ -999,7 +1001,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
// BBS: move from PrintObjectConfig // BBS: move from PrintObjectConfig
((ConfigOptionBool, independent_support_layer_height)) ((ConfigOptionBool, independent_support_layer_height))
// SoftFever // SoftFever
((ConfigOptionPercents, filament_shrink)) ((ConfigOptionPercents, filament_shrink))
((ConfigOptionBool, gcode_label_objects)) ((ConfigOptionBool, gcode_label_objects))
((ConfigOptionBool, gcode_comments)) ((ConfigOptionBool, gcode_comments))

View file

@ -175,8 +175,6 @@ set(SLIC3R_GUI_SOURCES
GUI/MainFrame.hpp GUI/MainFrame.hpp
GUI/BBLTopbar.cpp GUI/BBLTopbar.cpp
GUI/BBLTopbar.hpp GUI/BBLTopbar.hpp
GUI/BedShapeDialog.cpp
GUI/BedShapeDialog.hpp
GUI/Plater.cpp GUI/Plater.cpp
GUI/Plater.hpp GUI/Plater.hpp
GUI/PartPlate.cpp GUI/PartPlate.cpp

View file

@ -1918,6 +1918,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Initial layer speed"), L"param_speed_first", 15); optgroup = page->new_optgroup(L("Initial layer speed"), L"param_speed_first", 15);
optgroup->append_single_option_line("initial_layer_speed"); optgroup->append_single_option_line("initial_layer_speed");
optgroup->append_single_option_line("initial_layer_infill_speed"); optgroup->append_single_option_line("initial_layer_infill_speed");
optgroup->append_single_option_line("initial_layer_travel_speed");
optgroup = page->new_optgroup(L("Other layers speed"), L"param_speed", 15); 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("outer_wall_speed");
optgroup->append_single_option_line("inner_wall_speed"); optgroup->append_single_option_line("inner_wall_speed");