Fix of #4060 - Add check for the case that all ranges of a volume do not contain any Z.
This commit is contained in:
parent
0ad135ff93
commit
bb2eecb42c
1 changed files with 5 additions and 3 deletions
|
@ -2014,7 +2014,7 @@ std::vector<ExPolygons> PrintObject::slice_region(size_t region_id, const std::v
|
||||||
return this->slice_volumes(z, mode, volumes);
|
return this->slice_volumes(z, mode, volumes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Z ranges are not applicable to modifier meshes, therefore a sinle volume will be found in volume_and_range at most once.
|
// Z ranges are not applicable to modifier meshes, therefore a single volume will be found in volume_and_range at most once.
|
||||||
std::vector<ExPolygons> PrintObject::slice_modifiers(size_t region_id, const std::vector<float> &slice_zs) const
|
std::vector<ExPolygons> PrintObject::slice_modifiers(size_t region_id, const std::vector<float> &slice_zs) const
|
||||||
{
|
{
|
||||||
std::vector<ExPolygons> out;
|
std::vector<ExPolygons> out;
|
||||||
|
@ -2080,10 +2080,12 @@ std::vector<ExPolygons> PrintObject::slice_modifiers(size_t region_id, const std
|
||||||
ranges.emplace_back(volumes_and_ranges[j].first);
|
ranges.emplace_back(volumes_and_ranges[j].first);
|
||||||
// slicing in parallel
|
// slicing in parallel
|
||||||
std::vector<ExPolygons> this_slices = this->slice_volume(slice_zs, ranges, SlicingMode::Regular, *model_volume);
|
std::vector<ExPolygons> this_slices = this->slice_volume(slice_zs, ranges, SlicingMode::Regular, *model_volume);
|
||||||
|
// Variable this_slices could be empty if no value of slice_zs is within any of the ranges of this volume.
|
||||||
if (out.empty()) {
|
if (out.empty()) {
|
||||||
out = std::move(this_slices);
|
out = std::move(this_slices);
|
||||||
merge.assign(out.size(), false);
|
merge.assign(out.size(), false);
|
||||||
} else {
|
} else if (!this_slices.empty()) {
|
||||||
|
assert(out.size() == this_slices.size());
|
||||||
for (size_t i = 0; i < out.size(); ++ i)
|
for (size_t i = 0; i < out.size(); ++ i)
|
||||||
if (! this_slices[i].empty()) {
|
if (! this_slices[i].empty()) {
|
||||||
if (! out[i].empty()) {
|
if (! out[i].empty()) {
|
||||||
|
@ -2188,7 +2190,7 @@ std::vector<ExPolygons> PrintObject::slice_volume(const std::vector<float> &z, S
|
||||||
return layers;
|
return layers;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter the zs not inside the ranges. The ranges are closed at the botton and open at the top, they are sorted lexicographically and non overlapping.
|
// Filter the zs not inside the ranges. The ranges are closed at the bottom and open at the top, they are sorted lexicographically and non overlapping.
|
||||||
std::vector<ExPolygons> PrintObject::slice_volume(const std::vector<float> &z, const std::vector<t_layer_height_range> &ranges, SlicingMode mode, const ModelVolume &volume) const
|
std::vector<ExPolygons> PrintObject::slice_volume(const std::vector<float> &z, const std::vector<t_layer_height_range> &ranges, SlicingMode mode, const ModelVolume &volume) const
|
||||||
{
|
{
|
||||||
std::vector<ExPolygons> out;
|
std::vector<ExPolygons> out;
|
||||||
|
|
Loading…
Reference in a new issue