mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-15 05:46:30 +08:00
wrong line endings.
This commit is contained in:
parent
f2206be78b
commit
7f7eb70dc9
@ -1,102 +1,119 @@
|
|||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
#include "test_data.hpp" // get access to init_print, etc
|
#include "test_data.hpp" // get access to init_print, etc
|
||||||
|
#include "GCodeReader.hpp"
|
||||||
using namespace Slic3r::Test;
|
|
||||||
using namespace Slic3r;
|
using namespace Slic3r::Test;
|
||||||
|
using namespace Slic3r;
|
||||||
SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") {
|
|
||||||
GIVEN("Configuration with a skirt height of 2") {
|
SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") {
|
||||||
auto config {Config::new_from_defaults()};
|
GIVEN("Configuration with a skirt height of 2") {
|
||||||
config->set("skirts", 1);
|
auto config {Config::new_from_defaults()};
|
||||||
config->set("skirt_height", 2);
|
config->set("skirts", 1);
|
||||||
config->set("perimeters", 0);
|
config->set("skirt_height", 2);
|
||||||
config->set("support_material_speed", 99);
|
config->set("perimeters", 0);
|
||||||
|
config->set("support_material_speed", 99);
|
||||||
// avoid altering speeds unexpectedly
|
|
||||||
config->set("cooling", 0);
|
// avoid altering speeds unexpectedly
|
||||||
config->set("first_layer_speed", "100%");
|
config->set("cooling", 0);
|
||||||
|
config->set("first_layer_speed", "100%");
|
||||||
WHEN("multiple objects are printed") {
|
|
||||||
THEN("skirt_height is honored") {
|
WHEN("multiple objects are printed") {
|
||||||
REQUIRE(false);
|
auto gcode {std::stringstream("")};
|
||||||
}
|
auto print {Slic3r::Test::init_print({TestMesh::cube_20x20x20, TestMesh::cube_20x20x20}, config)};
|
||||||
}
|
std::map<double, bool> layers_with_skirt;
|
||||||
}
|
Slic3r::Test::gcode(gcode, print);
|
||||||
GIVEN("A default configuration") {
|
auto parser {Slic3r::GCodeReader()};
|
||||||
auto config {Config::new_from_defaults()};
|
parser.parse_stream(gcode, [&layers_with_skirt, &config] (Slic3r::GCodeReader& self, const Slic3r::GCodeReader::GCodeLine& line)
|
||||||
config->set("support_material_speed", 99);
|
{
|
||||||
|
if (self.Z > 0) {
|
||||||
// avoid altering speeds unexpectedly
|
if (line.extruding() && line.new_F() == config->getFloat("support_material_speed") * 60.0) {
|
||||||
config->set("cooling", 0);
|
layers_with_skirt[self.Z] = 1;
|
||||||
config->set("first_layer_speed", "100%");
|
}
|
||||||
// remove noise from top/solid layers
|
}
|
||||||
config->set("top_solid_layers", 0);
|
});
|
||||||
config->set("bottom_solid_layers", 0);
|
|
||||||
|
THEN("skirt_height is honored") {
|
||||||
WHEN("Brim width is set to 5") {
|
REQUIRE(layers_with_skirt.size() == (size_t)config->getInt("skirt_height"));
|
||||||
config->set("perimeters", 0);
|
}
|
||||||
config->set("skirts", 0);
|
}
|
||||||
config->set("brim_width", 5);
|
}
|
||||||
THEN("Brim is generated") {
|
GIVEN("A default configuration") {
|
||||||
REQUIRE(false);
|
auto config {Config::new_from_defaults()};
|
||||||
}
|
config->set("support_material_speed", 99);
|
||||||
}
|
|
||||||
|
// avoid altering speeds unexpectedly
|
||||||
WHEN("Skirt area is smaller than the brim") {
|
config->set("cooling", 0);
|
||||||
config->set("skirts", 1);
|
config->set("first_layer_speed", "100%");
|
||||||
config->set("brim_width", 10);
|
// remove noise from top/solid layers
|
||||||
THEN("GCode generates successfully.") {
|
config->set("top_solid_layers", 0);
|
||||||
REQUIRE(false);
|
config->set("bottom_solid_layers", 0);
|
||||||
}
|
|
||||||
}
|
WHEN("Brim width is set to 5") {
|
||||||
|
config->set("perimeters", 0);
|
||||||
WHEN("Skirt height is 0 and skirts > 0") {
|
config->set("skirts", 0);
|
||||||
config->set("skirts", 2);
|
config->set("brim_width", 5);
|
||||||
config->set("skirt_height", 0);
|
THEN("Brim is generated") {
|
||||||
|
REQUIRE(false);
|
||||||
THEN("GCode generates successfully.") {
|
}
|
||||||
REQUIRE(false);
|
}
|
||||||
}
|
|
||||||
}
|
WHEN("Skirt area is smaller than the brim") {
|
||||||
|
config->set("skirts", 1);
|
||||||
WHEN("Perimeter extruder = 2 and support extruders = 3") {
|
config->set("brim_width", 10);
|
||||||
THEN("Brim is printed with the extruder used for the perimeters of first object") {
|
THEN("GCode generates successfully.") {
|
||||||
REQUIRE(false);
|
REQUIRE(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WHEN("Perimeter extruder = 2, support extruders = 3, raft is enabled") {
|
|
||||||
THEN("brim is printed with same extruder as skirt") {
|
WHEN("Skirt height is 0 and skirts > 0") {
|
||||||
REQUIRE(false);
|
config->set("skirts", 2);
|
||||||
}
|
config->set("skirt_height", 0);
|
||||||
}
|
|
||||||
|
THEN("GCode generates successfully.") {
|
||||||
WHEN("Object is plated with overhang support and a brim") {
|
REQUIRE(false);
|
||||||
config->set("layer_height", 0.4);
|
}
|
||||||
config->set("first_layer_height", 0.4);
|
}
|
||||||
config->set("skirts", 1);
|
|
||||||
config->set("skirt_distance", 0);
|
WHEN("Perimeter extruder = 2 and support extruders = 3") {
|
||||||
config->set("support_material_speed", 99);
|
THEN("Brim is printed with the extruder used for the perimeters of first object") {
|
||||||
config->set("perimeter_extruder", 1);
|
REQUIRE(false);
|
||||||
config->set("support_material_extruder", 2);
|
}
|
||||||
config->set("cooling", 0); // to prevent speeds to be altered
|
}
|
||||||
config->set("first_layer_speed", "100%"); // to prevent speeds to be altered
|
WHEN("Perimeter extruder = 2, support extruders = 3, raft is enabled") {
|
||||||
|
THEN("brim is printed with same extruder as skirt") {
|
||||||
auto print {Slic3r::Test::init_print(TestMesh::overhang, config)};
|
REQUIRE(false);
|
||||||
print.process();
|
}
|
||||||
|
}
|
||||||
config->set("support_material", true); // to prevent speeds to be altered
|
|
||||||
|
WHEN("Object is plated with overhang support and a brim") {
|
||||||
THEN("skirt length is large enough to contain object with support") {
|
config->set("layer_height", 0.4);
|
||||||
REQUIRE(false);
|
config->set("first_layer_height", 0.4);
|
||||||
}
|
config->set("skirts", 1);
|
||||||
}
|
config->set("skirt_distance", 0);
|
||||||
WHEN("Large minimum skirt length is used.") {
|
config->set("support_material_speed", 99);
|
||||||
config->set("min_skirt_length", 20);
|
config->set("perimeter_extruder", 1);
|
||||||
auto print {Slic3r::Test::init_print(std::make_tuple<int,int,int>(20,20,20), config)};
|
config->set("support_material_extruder", 2);
|
||||||
THEN("Gcode generation doesn't crash") {
|
config->set("cooling", 0); // to prevent speeds to be altered
|
||||||
Slic3r::Test::gcode(gcode, print);
|
config->set("first_layer_speed", "100%"); // to prevent speeds to be altered
|
||||||
auto exported {gcode.str()};
|
|
||||||
REQUIRE(exported.size() > 0);
|
auto print {Slic3r::Test::init_print({TestMesh::overhang}, config)};
|
||||||
}
|
print.process();
|
||||||
}
|
|
||||||
}
|
config->set("support_material", true); // to prevent speeds to be altered
|
||||||
|
|
||||||
|
THEN("skirt length is large enough to contain object with support") {
|
||||||
|
REQUIRE(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WHEN("Large minimum skirt length is used.") {
|
||||||
|
config->set("min_skirt_length", 20);
|
||||||
|
auto gcode {std::stringstream("")};
|
||||||
|
auto print {Slic3r::Test::init_print(std::make_tuple<int,int,int>(20,20,20), config)};
|
||||||
|
THEN("Gcode generation doesn't crash") {
|
||||||
|
Slic3r::Test::gcode(gcode, print);
|
||||||
|
auto exported {gcode.str()};
|
||||||
|
REQUIRE(exported.size() > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user