mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 17:56:07 +08:00
Add lift to first travel move on layer. Add retraction_length 0 to test, to avoid lifting back up and going back down.
This commit is contained in:
parent
088212cc7a
commit
5f9f5be614
@ -3019,25 +3019,20 @@ std::string GCodeGenerator::travel_to_first_position(const Vec3crd& point) {
|
||||
|
||||
const Vec3d gcode_point = to_3d(this->point_to_gcode(point.head<2>()), unscaled(point.z()));
|
||||
|
||||
if (!this->last_position) {
|
||||
double lift{
|
||||
EXTRUDER_CONFIG(travel_ramping_lift) ? EXTRUDER_CONFIG(travel_max_lift) :
|
||||
EXTRUDER_CONFIG(retract_lift)};
|
||||
const double upper_limit = EXTRUDER_CONFIG(retract_lift_below);
|
||||
const double lower_limit = EXTRUDER_CONFIG(retract_lift_above);
|
||||
if ((lower_limit > 0 && gcode_point.z() < lower_limit) ||
|
||||
(upper_limit > 0 && gcode_point.z() > upper_limit)) {
|
||||
lift = 0.0;
|
||||
}
|
||||
gcode += this->writer().get_travel_to_z_gcode(gcode_point.z() + lift, "lift");
|
||||
double lift{
|
||||
EXTRUDER_CONFIG(travel_ramping_lift) ? EXTRUDER_CONFIG(travel_max_lift) :
|
||||
EXTRUDER_CONFIG(retract_lift)};
|
||||
const double upper_limit = EXTRUDER_CONFIG(retract_lift_below);
|
||||
const double lower_limit = EXTRUDER_CONFIG(retract_lift_above);
|
||||
if ((lower_limit > 0 && gcode_point.z() < lower_limit) ||
|
||||
(upper_limit > 0 && gcode_point.z() > upper_limit)) {
|
||||
lift = 0.0;
|
||||
}
|
||||
|
||||
if (!EXTRUDER_CONFIG(travel_ramping_lift)) {
|
||||
if (!this->last_position ||
|
||||
EXTRUDER_CONFIG(retract_before_travel) <
|
||||
(this->point_to_gcode(*this->last_position) - gcode_point.head<2>()).norm()) {
|
||||
if (EXTRUDER_CONFIG(retract_length) > 0 && (!this->last_position || (!EXTRUDER_CONFIG(travel_ramping_lift)))) {
|
||||
if (!this->last_position || EXTRUDER_CONFIG(retract_before_travel) < (this->point_to_gcode(*this->last_position) - gcode_point.head<2>()).norm()) {
|
||||
gcode += this->writer().retract();
|
||||
gcode += this->writer().get_travel_to_z_gcode(gcode_point.z() + EXTRUDER_CONFIG(retract_lift), "lift");
|
||||
gcode += this->writer().get_travel_to_z_gcode(gcode_point.z() + lift, "lift");
|
||||
}
|
||||
}
|
||||
this->last_position = point.head<2>();
|
||||
|
@ -130,7 +130,8 @@ TEST_CASE("Extrusion, travels, temeperatures", "[GCode]") {
|
||||
{ "layer_height", 0.4 },
|
||||
{ "first_layer_height", 0.4 },
|
||||
{ "temperature", "200" },
|
||||
{ "first_layer_temperature", "210" }
|
||||
{ "first_layer_temperature", "210" },
|
||||
{ "retract_length", "0" }
|
||||
});
|
||||
|
||||
std::vector<double> z_moves;
|
||||
|
@ -42,6 +42,7 @@ TEST_CASE("Layer heights are correct", "[Layers]") {
|
||||
{ "start_gcode", "" },
|
||||
{ "layer_height", 0.3 },
|
||||
{ "first_layer_height", 0.2 },
|
||||
{ "retract_length", "0" }
|
||||
});
|
||||
|
||||
SECTION("Absolute first layer height") {
|
||||
|
@ -14,7 +14,7 @@
|
||||
using namespace Slic3r;
|
||||
using namespace Test;
|
||||
|
||||
constexpr bool debug_files {false};
|
||||
constexpr bool debug_files {true};
|
||||
|
||||
void check_gcode(std::initializer_list<TestMesh> meshes, const DynamicPrintConfig& config, const unsigned duplicate) {
|
||||
constexpr std::size_t tools_count = 4;
|
||||
@ -177,7 +177,7 @@ TEST_CASE("Z moves", "[retraction]") {
|
||||
{ "start_gcode", "" }, // To avoid dealing with the nozzle lift in start G-code
|
||||
{ "retract_length", "0" },
|
||||
{ "retract_layer_change", "0" },
|
||||
{ "retract_lift", "0.2" },
|
||||
{ "retract_lift", "0.2" }
|
||||
});
|
||||
|
||||
bool retracted = false;
|
||||
@ -214,8 +214,8 @@ TEST_CASE("Z moves", "[retraction]") {
|
||||
CHECK(layer_changes_with_retraction == 0);
|
||||
INFO("no retractions");
|
||||
CHECK(retractions == 0);
|
||||
INFO("no lift other than for the first move");
|
||||
CHECK(z_restores == 1);
|
||||
INFO("no lift");
|
||||
CHECK(z_restores == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Firmware retraction handling", "[retraction]") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user