Skip to content

Commit 2763956

Browse files
committed
Slicing.cpp: PrintObjectSlice.cpp: Allow changing printer to one with incompatible min/max layer height.
1 parent 896dae4 commit 2763956

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/libslic3r/PrintObjectSlice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ void PrintObject::slice()
573573
}
574574
});
575575
if (m_layers.empty())
576-
throw Slic3r::SlicingError("No layers were detected. You might want to repair your STL file(s) or check their size or thickness and retry.\n");
576+
throw Slic3r::SlicingError("No layers were detected. Either variable layer height exceeded this printer's min/max layer height capabilities or STL file(s) need repair. Change sizes or thickness and retry slicing.\n");
577577
this->set_done(posSlice);
578578
}
579579

src/libslic3r/Slicing.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,15 @@ std::vector<coordf_t> generate_object_layers(
642642
const coordf_t z2 = layer_height_profile[next] * shrinkage_compensation_z;
643643
const coordf_t h2 = layer_height_profile[next + 1];
644644
height = lerp(h1, h2, (slice_z - z1) / (z2 - z1));
645-
assert(height >= slicing_params.min_layer_height - EPSILON && height <= slicing_params.max_layer_height + EPSILON);
645+
// FIXME: This function needs error return.
646+
// Going to try aborting with empty {} instead of assert.
647+
if (height < slicing_params.min_layer_height - EPSILON) {
648+
std::cerr << "Error: Layer height (" << height << ") below printer's minimum (" << slicing_params.min_layer_height << ").\n";
649+
return {};
650+
} else if (height > slicing_params.max_layer_height + EPSILON) {
651+
std::cerr << "Error: Layer height (" << height << ") above printer's maximum (" << slicing_params.max_layer_height << ").\n";
652+
return {};
653+
}
646654
}
647655
}
648656
slice_z = print_z + 0.5 * height;

0 commit comments

Comments
 (0)