diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index eb72e8a3f2..6d01badf2e 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -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 //interface layer id is 0. 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(); // Initialize config with the 1st object to be printed at this layer. diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index 04214f91b5..656b197dd6 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -334,7 +334,9 @@ std::string GCodeWriter::travel_to_xy(const Vec2d &point, const std::string &com GCodeG1Formatter w; 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 w.emit_comment(GCodeWriter::full_gcode_comment, comment); return w.string(); @@ -353,6 +355,8 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co used for unlift. */ // BBS 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 if (std::abs(m_to_lift) > 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 delta = target - source; 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: 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) { @@ -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; GCodeG1Formatter w0; w0.emit_xyz(slope_top_point); - w0.emit_f(this->config.travel_speed.value * 60.0); + w0.emit_f(travel_speed * 60.0); //BBS w0.emit_comment(GCodeWriter::full_gcode_comment, comment); slop_move = w0.string(); @@ -404,13 +411,13 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co GCodeG1Formatter w0; if (this->is_current_position_clear()) { 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); xy_z_move = w0.string(); } else { 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); 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; w.emit_xyz(point_on_plate); - w.emit_f(this->config.travel_speed.value * 60.0); + w.emit_f(travel_speed * 60.0); //BBS w.emit_comment(GCodeWriter::full_gcode_comment, comment); return w.string(); @@ -474,8 +481,10 @@ std::string GCodeWriter::_travel_to_z(double z, const std::string &comment) m_pos(2) = z; double speed = this->config.travel_speed_z.value; - if (speed == 0.) - speed = this->config.travel_speed.value; + if (speed == 0.) { + speed = m_is_first_layer ? this->config.get_abs_value("initial_layer_travel_speed") + : this->config.travel_speed.value; + } GCodeG1Formatter w; 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; double speed = this->config.travel_speed_z.value; - if (speed == 0.) - speed = this->config.travel_speed.value; + if (speed == 0.) { + speed = m_is_first_layer ? this->config.get_abs_value("initial_layer_travel_speed") + : this->config.travel_speed.value; + } std::string output = "G17\n"; GCodeG2G3Formatter w(true); diff --git a/src/libslic3r/GCodeWriter.hpp b/src/libslic3r/GCodeWriter.hpp index b2b6e6d9a7..3d42791413 100644 --- a/src/libslic3r/GCodeWriter.hpp +++ b/src/libslic3r/GCodeWriter.hpp @@ -25,7 +25,7 @@ public: m_lifted(0), m_to_lift(0), m_to_lift_type(LiftType::NormalLift), - m_current_speed(3600) + m_current_speed(3600), m_is_first_layer(true) {} Extruder* extruder() { return m_extruder; } const Extruder* extruder() const { return m_extruder; } @@ -98,6 +98,7 @@ public: //SoftFever void set_is_bbl_machine(bool bval) {m_is_bbl_printers = bval;} const bool is_bbl_printers() const {return m_is_bbl_printers;} + void set_is_first_layer(bool bval) { m_is_first_layer = bval; } private: // Extruders are sorted by their ID, so that binary search is possible. @@ -138,6 +139,7 @@ private: //SoftFever bool m_is_bbl_printers = false; double m_current_speed; + bool m_is_first_layer = true; 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); diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 9af8077670..bb25f15f27 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -755,7 +755,7 @@ static std::vector s_Preset_print_options { "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", "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" }; diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 77d5176388..492ad178d4 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -222,7 +222,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "initial_layer_infill_speed" || opt_key == "travel_speed" || 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") { steps.emplace_back(psWipeTower); steps.emplace_back(psSkirtBrim); diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index c77db57239..b1788618bc 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -1636,6 +1636,17 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; 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->label = L("Initial layer"); def->full_label = L("Initial layer nozzle temperature"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 47f95483e2..79a2dc4009 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -880,6 +880,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionBool, use_relative_e_distances)) ((ConfigOptionBool, accel_to_decel_enable)) ((ConfigOptionPercent, accel_to_decel_factor)) + ((ConfigOptionFloatOrPercent, initial_layer_travel_speed)) + ) // This object is mapped to Perl as Slic3r::Config::Print. @@ -999,7 +1001,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( // BBS: move from PrintObjectConfig ((ConfigOptionBool, independent_support_layer_height)) // SoftFever - ((ConfigOptionPercents, filament_shrink)) + ((ConfigOptionPercents, filament_shrink)) ((ConfigOptionBool, gcode_label_objects)) ((ConfigOptionBool, gcode_comments)) diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt index c466e02d78..2e8cd53043 100644 --- a/src/slic3r/CMakeLists.txt +++ b/src/slic3r/CMakeLists.txt @@ -175,8 +175,6 @@ set(SLIC3R_GUI_SOURCES GUI/MainFrame.hpp GUI/BBLTopbar.cpp GUI/BBLTopbar.hpp - GUI/BedShapeDialog.cpp - GUI/BedShapeDialog.hpp GUI/Plater.cpp GUI/Plater.hpp GUI/PartPlate.cpp diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index fa19972f97..0f70ba21a3 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1918,6 +1918,7 @@ void TabPrint::build() 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_infill_speed"); + optgroup->append_single_option_line("initial_layer_travel_speed"); 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");