mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-22 21:50:51 -05:00
Widen the post-slice extruder masks to 64 bits (#17002)
The post-slice check stored the extruders that can't print each filament as bits in an int. From the 32nd extruder on, the shift overflowed, and on x86 extruder 33's bit landed on extruder 1. limit_filament_maps and the printable area mask are now 64-bit, which covers MAXIMUM_EXTRUDER_NUMBER. Printers with up to 31 extruders get the same values as before. The tests check the area, height and filament type limits on nozzles 2, 32, 33 and 64, and slice a cube on nozzle 64 of a 64-nozzle printer.
This commit is contained in:
1 parent
7dcceeb9ee
commit
5ea64864ef
6 files changed
+110
-26
No files matched your search
@@ -37,6 +37,7 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cmath>
|
||||
#include <exception>
|
||||
#include <deque>
|
||||
@@ -3022,11 +3023,11 @@ bool GCodeProcessor::check_multi_extruder_gcode_valid(const int
|
||||
auto unprintable_extruders = [&unprintable_areas, &unprintable_bboxes, &plate_offset](const BoundingBox &path_bbox) {
|
||||
BoundingBox bbox = path_bbox.inflated(SCALED_EPSILON);
|
||||
bbox.translate(-plate_offset);
|
||||
int mask = 0;
|
||||
uint64_t mask = 0;
|
||||
for (size_t i = 0; i < unprintable_areas.size(); ++i)
|
||||
if (!unprintable_areas[i].empty() && unprintable_bboxes[i].overlap(bbox) &&
|
||||
!intersection(unprintable_areas[i], bbox.polygon()).empty())
|
||||
mask |= 1 << i;
|
||||
mask |= uint64_t(1) << i;
|
||||
return mask;
|
||||
};
|
||||
|
||||
@@ -3084,9 +3085,9 @@ bool GCodeProcessor::check_multi_extruder_gcode_valid(const int
|
||||
//BoundingBox bbox_custom = path_poly_custom.bounding_box();
|
||||
//bbox_custom.offset(-scale_(1.0)); // Narrow the range to provide a tolerance for the custom gcode
|
||||
//bbox.merge(bbox_custom); // merge the custom gcode pos with other pos*/
|
||||
const int unprintable_mask = unprintable_extruders(bbox);
|
||||
const uint64_t unprintable_mask = unprintable_extruders(bbox);
|
||||
// check printable area
|
||||
if ((extruder_id < unprintable_areas.size()) && (unprintable_mask & (1 << extruder_id))) {
|
||||
if ((extruder_id < unprintable_areas.size()) && (unprintable_mask & (uint64_t(1) << extruder_id))) {
|
||||
m_result.gcode_check_result.error_code |= 1;
|
||||
std::pair<int, int> filament_to_object_id;
|
||||
filament_to_object_id.first = iter->first;
|
||||
@@ -3102,7 +3103,7 @@ bool GCodeProcessor::check_multi_extruder_gcode_valid(const int
|
||||
filament_to_object_id.first = iter->first;
|
||||
filament_to_object_id.second = object_label_id;
|
||||
m_result.gcode_check_result.print_height_error_infos[extruder_id].push_back(filament_to_object_id);
|
||||
m_result.limit_filament_maps[iter->first] |= (1 << extruder_id);
|
||||
m_result.limit_filament_maps[iter->first] |= uint64_t(1) << extruder_id;
|
||||
valid = false;
|
||||
}
|
||||
|
||||
@@ -3115,7 +3116,7 @@ bool GCodeProcessor::check_multi_extruder_gcode_valid(const int
|
||||
for (int extruder_id = 0; extruder_id < unprintable_filament_types.size(); ++extruder_id) {
|
||||
const std::set<int> &filament_ids = unprintable_filament_types[extruder_id];
|
||||
for (int filament_id : filament_ids) {
|
||||
m_result.limit_filament_maps[filament_id] |= (1 << extruder_id);
|
||||
m_result.limit_filament_maps[filament_id] |= uint64_t(1) << extruder_id;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user