FIX: [STUDIO-3561] Import Gcode and send all plate

Change-Id: Ic1db0d90e08dba24cde12cdfaa6f1227d5d602cf
This commit is contained in:
maosheng.wei 2023-07-06 19:12:27 +08:00 committed by Lane.Wei
parent 3a9b49abeb
commit 53f9d89a5a
2 changed files with 37 additions and 9 deletions

View file

@ -2114,6 +2114,28 @@ bool PartPlate::has_printable_instances()
return result; return result;
} }
bool PartPlate::is_all_instances_unprintable()
{
bool result = true;
for (std::set<std::pair<int, int>>::iterator it = obj_to_instance_set.begin(); it != obj_to_instance_set.end(); ++it) {
int obj_id = it->first;
int instance_id = it->second;
if (obj_id >= m_model->objects.size()) continue;
ModelObject * object = m_model->objects[obj_id];
ModelInstance *instance = object->instances[instance_id];
if ((instance->printable)) {
result = false;
break;
}
}
return result;
}
//move instances to left or right PartPlate //move instances to left or right PartPlate
void PartPlate::move_instances_to(PartPlate& left_plate, PartPlate& right_plate, BoundingBoxf3* bounding_box) void PartPlate::move_instances_to(PartPlate& left_plate, PartPlate& right_plate, BoundingBoxf3* bounding_box)
{ {
@ -4465,18 +4487,23 @@ bool PartPlateList::is_all_slice_results_valid() const
//check whether all plates's slice result valid for print //check whether all plates's slice result valid for print
bool PartPlateList::is_all_slice_results_ready_for_print() const bool PartPlateList::is_all_slice_results_ready_for_print() const
{ {
bool res = false; bool res = false;
for (unsigned int i = 0; i < (unsigned int) m_plate_list.size(); ++i) { for (unsigned int i = 0; i < (unsigned int) m_plate_list.size(); ++i) {
if (!m_plate_list[i]->empty() && !m_plate_list[i]->is_slice_result_valid()) { if (!m_plate_list[i]->empty()) {
return false; if (m_plate_list[i]->is_all_instances_unprintable()) {
continue;
}
if (!m_plate_list[i]->is_slice_result_ready_for_print()) {
return false;
}
}
if (m_plate_list[i]->is_slice_result_ready_for_print()) {
res = true;
} }
if (m_plate_list[i]->is_slice_result_ready_for_print() && m_plate_list[i]->has_printable_instances()) { }
res = true;
}
}
return res; return res;
} }

View file

@ -330,6 +330,7 @@ public:
//whether it is has printable instances //whether it is has printable instances
bool has_printable_instances(); bool has_printable_instances();
bool is_all_instances_unprintable();
//move instances to left or right PartPlate //move instances to left or right PartPlate
void move_instances_to(PartPlate& left_plate, PartPlate& right_plate, BoundingBoxf3* bounding_box = nullptr); void move_instances_to(PartPlate& left_plate, PartPlate& right_plate, BoundingBoxf3* bounding_box = nullptr);