mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-24 06:20:30 -05:00
Merge branch 'main' into RJAudas/fix-kobra2-layer-markers
This commit is contained in:
commit
3d3771f420
509 files changed
+48476
-13911
No files matched your search
@@ -2,6 +2,7 @@
|
||||
#include <catch2/generators/catch_generators.hpp>
|
||||
|
||||
#include <catch2/catch_message.hpp>
|
||||
#include <catch2/catch_tostring.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include "libslic3r/BoundingBox.hpp"
|
||||
#include "libslic3r/Config.hpp"
|
||||
@@ -18,11 +19,14 @@
|
||||
|
||||
#include "libslic3r/TriangleMesh.hpp"
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <map>
|
||||
#include <cstddef>
|
||||
#include <fstream>
|
||||
#include <ios>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
@@ -223,6 +227,54 @@ TEST_CASE("The G-code header names the first object's filament when printing by
|
||||
CHECK(header_value("first_layer_temperature") == 250);
|
||||
}
|
||||
|
||||
// A filament that starts above the first layer, such as a support interface, never touches the bed. Heating the
|
||||
// bed to its temperature would soften the filament the part stands on, so only first layer filaments count.
|
||||
TEST_CASE("The highest temperature bed formula ignores filaments that start above the first layer", "[GCode]")
|
||||
{
|
||||
// Filament 1: bed 65 on the first layer, 60 after it. Filament 2: bed 100. A 30 mm cap on a 10 mm tall stem prints
|
||||
// with filament 1 and is supported from the bed, the support with filament 1 and its interface under the cap
|
||||
// with filament 2.
|
||||
TriangleMesh mesh = make_cube(10, 10, 10);
|
||||
mesh.translate(10, 10, 0);
|
||||
TriangleMesh cap = make_cube(30, 30, 2);
|
||||
cap.translate(0, 0, 10);
|
||||
mesh.merge(cap);
|
||||
DynamicPrintConfig config = Test::multifilament_config(2, {
|
||||
{"bed_temperature_formula", "by_highest_temp"},
|
||||
{"enable_prime_tower", 0},
|
||||
{"enable_support", 1},
|
||||
{"support_filament", 1},
|
||||
{"support_interface_filament", 2},
|
||||
{"supertack_plate_temp_initial_layer", "65,100"},
|
||||
{"cool_plate_temp_initial_layer", "65,100"},
|
||||
{"textured_cool_plate_temp_initial_layer", "65,100"},
|
||||
{"eng_plate_temp_initial_layer", "65,100"},
|
||||
{"hot_plate_temp_initial_layer", "65,100"},
|
||||
{"textured_plate_temp_initial_layer", "65,100"},
|
||||
{"supertack_plate_temp", "60,100"},
|
||||
{"cool_plate_temp", "60,100"},
|
||||
{"textured_cool_plate_temp", "60,100"},
|
||||
{"eng_plate_temp", "60,100"},
|
||||
{"hot_plate_temp", "60,100"},
|
||||
{"textured_plate_temp", "60,100"},
|
||||
{"skirt_loops", 0},
|
||||
{"brim_type", "no_brim"},
|
||||
});
|
||||
const std::string gcode = Test::slice({mesh}, config);
|
||||
REQUIRE(gcode.find("\nT1") != std::string::npos);
|
||||
|
||||
std::vector<int> bed_temps;
|
||||
std::istringstream lines(gcode);
|
||||
for (std::string line; std::getline(lines, line);)
|
||||
if (line.rfind("M140 S", 0) == 0 || line.rfind("M190 S", 0) == 0)
|
||||
bed_temps.push_back(std::stoi(line.substr(6)));
|
||||
INFO("bed temperatures: " << Catch::Detail::stringify(bed_temps));
|
||||
REQUIRE_FALSE(bed_temps.empty());
|
||||
CHECK(bed_temps.front() == 65);
|
||||
CHECK(std::find(bed_temps.begin(), bed_temps.end(), 60) != bed_temps.end());
|
||||
CHECK(std::find(bed_temps.begin(), bed_temps.end(), 100) == bed_temps.end());
|
||||
}
|
||||
|
||||
TEST_CASE("Object label comments number each object and copy with or without exclude object", "[GCode]")
|
||||
{
|
||||
// repetier has no exclude-object commands, so set_object_info() writes nothing for it.
|
||||
@@ -260,6 +312,40 @@ TEST_CASE("Object label comments number each object and copy with or without exc
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Sparse infill only arc fitting emits arcs in the sparse infill alone", "[GCode]")
|
||||
{
|
||||
const auto arcs_per_type = [](const char *arc_fitting) {
|
||||
// 360 facets keep the walls and the concentric infill within the resolution of a circle, so both fit arcs.
|
||||
const std::string gcode = Test::slice({ make_cylinder(25.0, 10.0, 2.0 * PI / 360.0) }, {
|
||||
{ "enable_arc_fitting", arc_fitting },
|
||||
{ "sparse_infill_pattern", "concentric" },
|
||||
{ "sparse_infill_density", "20%" },
|
||||
{ "z_hop", "0" },
|
||||
});
|
||||
std::map<std::string, size_t> arcs;
|
||||
std::istringstream input(gcode);
|
||||
std::string line, type;
|
||||
while (std::getline(input, line)) {
|
||||
if (line.rfind(";TYPE:", 0) == 0)
|
||||
type = line.substr(6);
|
||||
else if (line.rfind("G2 ", 0) == 0 || line.rfind("G3 ", 0) == 0)
|
||||
++arcs[type];
|
||||
}
|
||||
return arcs;
|
||||
};
|
||||
|
||||
CHECK(arcs_per_type("enabled").count("Outer wall") == 1);
|
||||
|
||||
const std::map<std::string, size_t> sparse_only = arcs_per_type("sparse_infill");
|
||||
CHECK(sparse_only.count("Sparse infill") == 1);
|
||||
for (const auto &[type, count] : sparse_only) {
|
||||
INFO(type << ": " << count << " arcs");
|
||||
CHECK(type == "Sparse infill");
|
||||
}
|
||||
|
||||
CHECK(arcs_per_type("disabled").empty());
|
||||
}
|
||||
|
||||
TEST_CASE("An exported G-code's settings load back as the settings it was sliced with", "[GCode]")
|
||||
{
|
||||
// Two filaments, so the config block carries the flush matrix already multiplied by flush_multiplier.
|
||||
|
||||
Reference in new issue
Block a user