mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-04 10:48:00 -05:00
fix: slicing crash on an object too thin for any layer with a raft (#17013)
With a raft, an object too thin for any layer gets an empty layer
list. Two functions read it as if it had an entry.
- groupingVolumesForBrim() reads the first layer, and slice() calls it
before its own check for an empty list.
- With Precise Z height on, adjust_layer_series_to_align_object_height()
read the last entry. This also runs in Print::validate(), so it
crashed before slicing started.
Both functions now return early on an empty list, so slicing reaches
the existing "No layers were detected" error.
Fixes #17009
(cherry picked from commit 59f0cc3806)
This commit is contained in:
1 parent
61eb4622ea
commit
a45cd836d9
3 files changed
+25
No files matched your search
@@ -864,6 +864,9 @@ std::string fix_slicing_errors(PrintObject* object, LayerPtrs &layers, const std
|
||||
|
||||
void groupingVolumesForBrim(PrintObject* object, LayerPtrs& layers, int firstLayerReplacedBy)
|
||||
{
|
||||
if (layers.empty())
|
||||
return;
|
||||
|
||||
const auto scaled_resolution = scaled<double>(object->print()->config().resolution.value);
|
||||
auto partsObjSliceByVolume = findPartVolumes(object->firstLayerObjSliceMod(), object->model_object()->volumes);
|
||||
groupingVolumes(partsObjSliceByVolume, object->firstLayerObjGroupsMod(), scaled_resolution, firstLayerReplacedBy);
|
||||
|
||||
@@ -721,6 +721,9 @@ void adjust_layer_height_profile(
|
||||
|
||||
bool adjust_layer_series_to_align_object_height(const SlicingParameters &slicing_params, std::vector<coordf_t>& layer_series)
|
||||
{
|
||||
if (layer_series.empty())
|
||||
return false;
|
||||
|
||||
coordf_t object_height = slicing_params.object_print_z_height();
|
||||
if (is_approx(layer_series.back(), object_height))
|
||||
return true;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
#include <catch2/matchers/catch_matchers_floating_point.hpp>
|
||||
#include <catch2/matchers/catch_matchers_string.hpp>
|
||||
#include <catch2/generators/catch_generators.hpp>
|
||||
#include <catch2/catch_message.hpp>
|
||||
#include "libslic3r/libslic3r.h"
|
||||
@@ -161,6 +162,24 @@ TEST_CASE("Initial layer height is honored", "[PrintObject]")
|
||||
REQUIRE_THAT(*std::next(layer_zs.begin()), Catch::Matchers::WithinAbs(0.5, 1e-4));
|
||||
}
|
||||
|
||||
TEST_CASE("An object too thin for any layer fails with a slicing error", "[PrintObject][Regression]")
|
||||
{
|
||||
const int raft_layers = GENERATE(0, 2);
|
||||
const bool precise_z_height = GENERATE(false, true);
|
||||
DYNAMIC_SECTION("raft_layers " << raft_layers << ", precise_z_height " << precise_z_height) {
|
||||
Slic3r::Print print;
|
||||
Slic3r::Model model;
|
||||
Slic3r::Test::init_print({make_cube(20, 20, 0.002)}, print, model, {
|
||||
{ "layer_height", 0.2 },
|
||||
{ "initial_layer_print_height", 0.2 },
|
||||
{ "min_layer_height", 0.07 },
|
||||
{ "raft_layers", raft_layers },
|
||||
{ "precise_z_height", precise_z_height }
|
||||
});
|
||||
REQUIRE_THROWS_WITH(print.process(), Catch::Matchers::ContainsSubstring("No layers were detected"));
|
||||
}
|
||||
}
|
||||
|
||||
static TriangleMesh internal_bridge_step()
|
||||
{
|
||||
// Orca: The smaller tower leaves a shoulder whose solid skin needs internal bridges
|
||||
|
||||
Reference in new issue
Block a user