FIX: arranging multi-color objects not correct

Arranging multi-color objects with disabled
multi_materials_on_same_plate option was not currect.

Previously we only consider the first extruder id for multi-color
objects. Now we consider all extruders.

Jira: STUDIO-2164
Change-Id: If64ff4f88f0fe4f6c31ebf657b3449b19bf063f0
(cherry picked from commit f4f6bdd00a0c3d3e13406b69be9b5b0468b27d44)
This commit is contained in:
Arthur 2023-02-02 17:26:49 +08:00 committed by Lane.Wei
parent 126ef98690
commit 59f7c4595c
3 changed files with 16 additions and 10 deletions

View file

@ -75,7 +75,7 @@ class _Item {
public:
int itemid_{ 0 };
int extrude_id{ 1 };
std::vector<int> extrude_ids;
double height{ 0 };
double print_temp{ 0 };
double bed_temp{ 0 };

View file

@ -114,13 +114,14 @@ public:
double score = LARGE_COST_TO_REJECT+1, best_score = LARGE_COST_TO_REJECT+1;
double score_all_plates = 0, score_all_plates_best = std::numeric_limits<double>::max();
typename Placer::PackResult result, result_best, result_firstfit;
size_t j = 0;
int j = 0;
while(!was_packed && !cancelled()) {
for(; j < placers.size() && !was_packed && !cancelled(); j++) {
result = placers[j].pack(*it, rem(it, store_));
score = result.score();
score_all_plates = std::accumulate(placers.begin(), placers.begin() + j, score,
[](double sum, const Placer& elem) { return sum + elem.score(); });
if (this->unfitindicator_) this->unfitindicator_(it->get().name + " bed_id="+std::to_string(j) + ",score=" + std::to_string(score));
if(score >= 0 && score < LARGE_COST_TO_REJECT) {
if (bed_id_firstfit == -1) {