FIX: the heightrange part of the object disappears after slicing

jira: none
Change-Id: I826c6eedda199b0ab81e8dbf9a6c25d2c063bdd6
This commit is contained in:
zhimin.zeng 2024-09-12 17:51:53 +08:00 committed by Lane.Wei
parent 2483257cfb
commit 3a3e5e3844
1 changed files with 9 additions and 3 deletions

View File

@ -273,11 +273,15 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
float z = zs[z_idx];
int idx_first_printable_region = -1;
bool complex = false;
std::vector<int> printable_region_ids;
for (int idx_region = 0; idx_region < int(layer_range.volume_regions.size()); ++ idx_region) {
const PrintObjectRegions::VolumeRegion &region = layer_range.volume_regions[idx_region];
if (region.bbox->min().z() <= z && region.bbox->max().z() >= z) {
if (idx_first_printable_region == -1 && region.model_volume->is_model_part())
if (region.model_volume->is_model_part())
printable_region_ids.push_back(idx_region);
if (idx_first_printable_region == -1 && region.model_volume->is_model_part()) {
idx_first_printable_region = idx_region;
}
else if (idx_first_printable_region != -1) {
// Test for overlap with some other region.
for (int idx_region2 = idx_first_printable_region; idx_region2 < idx_region; ++ idx_region2) {
@ -293,8 +297,10 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
if (complex)
zs_complex.push_back({ z_idx, z });
else if (idx_first_printable_region >= 0) {
const PrintObjectRegions::VolumeRegion &region = layer_range.volume_regions[idx_first_printable_region];
slices_by_region[region.region->print_object_region_id()][z_idx] = std::move(volume_slices_find_by_id(volume_slices, region.model_volume->id()).slices[z_idx]);
for (int printable_region_id : printable_region_ids) {
const PrintObjectRegions::VolumeRegion &region = layer_range.volume_regions[printable_region_id];
append(slices_by_region[region.region->print_object_region_id()][z_idx], std::move(volume_slices_find_by_id(volume_slices, region.model_volume->id()).slices[z_idx]));
}
}
}
}