mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-12 21:29:00 +08:00
Prime layer_z and layer_num for end gcode in C++ PrintGcode.
This commit is contained in:
parent
6303d0a59a
commit
880e9a52c3
@ -208,6 +208,23 @@ SCENARIO( "PrintGCode basic functionality") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WHEN("end_gcode exists with layer_num and layer_z") {
|
||||
config->set("end_gcode", "; Layer_num [layer_num]\n; Layer_z [layer_z]");
|
||||
config->set("layer_height", 0.1);
|
||||
config->set("first_layer_height", 0.1);
|
||||
|
||||
Slic3r::Model model;
|
||||
auto print {Slic3r::Test::init_print({TestMesh::cube_20x20x20}, model, config)};
|
||||
Slic3r::Test::gcode(gcode, print);
|
||||
|
||||
auto exported {gcode.str()};
|
||||
THEN("layer_num and layer_z are processed in the end gcode") {\
|
||||
REQUIRE(exported.find("; Layer_num 199") != std::string::npos);
|
||||
REQUIRE(exported.find("; Layer_z 20") != std::string::npos);
|
||||
}
|
||||
}
|
||||
|
||||
gcode.clear();
|
||||
}
|
||||
}
|
||||
|
@ -269,6 +269,8 @@ PrintGCode::output()
|
||||
this->process_layer(idx, layer, layer->object()->_shifted_copies);
|
||||
}
|
||||
}
|
||||
gcodegen.placeholder_parser->set("layer_z", unscale(print_z));
|
||||
gcodegen.placeholder_parser->set("layer_num", gcodegen.layer_index);
|
||||
}
|
||||
|
||||
this->flush_filters();
|
||||
|
Loading…
x
Reference in New Issue
Block a user