FIX: switching bed ignored locked plates etc.
1. switching bed ignored locked plates jira: STUDIO-10800 2. create too many empty plates for large objects jira: STUDIO-10793 Change-Id: Iaf1fc338aef44fdb00443c1981fdd4ff77cf71fb
This commit is contained in:
parent
dd0893c5f8
commit
dc0eef5afb
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <libnest2d/geometry_traits.hpp>
|
||||
#define LARGE_COST_TO_REJECT 1e7
|
||||
#define COST_OF_NEW_PLATE 0.1
|
||||
|
||||
namespace libnest2d {
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ public:
|
|||
}
|
||||
result = placers[j].pack(*it, rem(it, store_));
|
||||
score = result.score();
|
||||
score_all_plates = score;
|
||||
score_all_plates = score + COST_OF_NEW_PLATE * j; // add a larger cost to larger plate id to encourace to use less plates
|
||||
for (int i = 0; i < placers.size(); i++) { score_all_plates += placers[i].score();}
|
||||
if (this->unfitindicator_)
|
||||
this->unfitindicator_((boost::format("item %1% bed_id=%2%, score=%3%, score_all_plates=%4%, pos=(%5%, %6%)") % it->get().name % j % score %
|
||||
|
|
|
@ -481,15 +481,19 @@ void ArrangeJob::prepare_outside_plate() {
|
|||
auto iter1 = all_inside_objects.find(std::pair(obj_idx, inst_idx));
|
||||
auto iter2 = all_outside_objects.find(std::pair(obj_idx, inst_idx));
|
||||
bool outside_plate = false;
|
||||
PartPlate *plate_locked = nullptr;
|
||||
if (iter1 == all_inside_objects.end()) {
|
||||
continue;
|
||||
} else {
|
||||
int plate_idx = iter1->second;
|
||||
if (plate_list.get_plate(plate_idx)->is_locked()) { plate_locked = plate_list.get_plate(plate_idx); }
|
||||
}
|
||||
if (iter2 != all_outside_objects.end()) {
|
||||
outside_plate = true;
|
||||
ARRANGE_LOG(debug) << object->name << " is outside!";
|
||||
}
|
||||
ArrangePolygon&& ap = prepare_arrange_polygon(instance);
|
||||
ArrangePolygons &cont = instance->printable ? (outside_plate ? m_selected : m_unselected) : m_unprintable;
|
||||
ArrangePolygons &cont = !instance->printable ? m_unprintable : plate_locked ? m_locked : outside_plate ? m_selected : m_unselected;
|
||||
ap.itemid = cont.size();
|
||||
if (!outside_plate) {
|
||||
plate_list.preprocess_arrange_polygon(obj_idx, inst_idx, ap, false);
|
||||
|
|
Loading…
Reference in New Issue