FIX: modify unprintable_filament_ids should regroup

jira: none
Change-Id: Ifb8105f6e301aaed9ca4e62a37b9d3a1616e755b
(cherry picked from commit fec7129437fc781b918ae1819c280440ea3fb54b)
This commit is contained in:
zhimin.zeng
2024-09-12 12:25:04 +08:00
committed by Noisyfox
parent 42f8070fc9
commit 72d758c3b0
10 changed files with 199 additions and 22 deletions

View File

@@ -1078,7 +1078,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
BuildVolume plate_build_volume(pp_bed_shape, build_volume.printable_height(), build_volume.extruder_areas());
const std::vector<BoundingBoxf3>& exclude_areas = curr_plate->get_exclude_areas();
curr_plate->clear_unprintable_filament_ids();
std::vector<std::set<int>> unprintable_filament_ids;
for (GLVolume* volume : this->volumes)
{
if (! volume->is_modifier && (volume->shader_outside_printer_detection_enabled || (! volume->is_wipe_tower && volume->composite_id.volume_id >= 0))) {
@@ -1096,13 +1096,14 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
std::vector<bool> inside_extruders;
state = plate_build_volume.check_volume_bbox_state_with_extruder_areas(bb, inside_extruders);
if (state == BuildVolume::ObjectState::Limited) {
unprintable_filament_ids.resize(inside_extruders.size());
const ModelObjectPtrs &model_objects = model.objects;
ModelObject *model_object = model_objects[volume->object_idx()];
ModelVolume *model_volume = model_object->volumes[volume->volume_idx()];
for (size_t i = 0; i < inside_extruders.size(); ++i) {
if (!inside_extruders[i]) {
std::vector<int> extruders = model_volume->get_extruders();
curr_plate->append_unprintable_filament_ids(i, extruders);
unprintable_filament_ids[i].insert(extruders.begin(), extruders.end());
}
}
}
@@ -1181,6 +1182,13 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
}
}
std::vector<std::vector<int>> unprintable_filament_vec;
for (const std::set<int>& filamnt_ids : unprintable_filament_ids) {
unprintable_filament_vec.emplace_back(std::vector<int>(filamnt_ids.begin(), filamnt_ids.end()));
}
curr_plate->set_unprintable_filament_ids(unprintable_filament_vec);
/*for (GLVolume* volume : this->volumes)
{
if (! volume->is_modifier && (volume->shader_outside_printer_detection_enabled || (! volume->is_wipe_tower && volume->composite_id.volume_id >= 0)))