mirror of
https://github.com/QIDITECH/QIDIStudio.git
synced 2026-02-02 09:58:41 +03:00
update slic3r
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "libslic3r/SVG.hpp"
|
||||
#include "libslic3r/ModelArrange.hpp"
|
||||
#include "libslic3r/VectorFormatter.hpp"
|
||||
|
||||
#include "slic3r/GUI/PartPlate.hpp"
|
||||
#include "slic3r/GUI/GLCanvas3D.hpp"
|
||||
@@ -29,9 +30,10 @@ public:
|
||||
: GLCanvas3D::WipeTowerInfo(std::move(wti))
|
||||
{}
|
||||
|
||||
void apply_arrange_result(const Vec2d& tr, double rotation, int item_id)
|
||||
void apply_arrange_result(const Vec2d& tr, double rotation, int item_id, int bed_id)
|
||||
{
|
||||
m_pos = unscaled(tr); m_rotation = rotation;
|
||||
m_plate_idx = bed_id;
|
||||
apply_wipe_tower();
|
||||
}
|
||||
|
||||
@@ -70,7 +72,13 @@ arrangement::ArrangePolygon get_wipetower_arrange_poly(WipeTower* tower)
|
||||
{
|
||||
ArrangePolygon ap = tower->get_arrange_polygon();
|
||||
ap.bed_idx = 0;
|
||||
ap.setter = NULL; // do not move wipe tower
|
||||
//ap.setter = NULL; // do not move wipe tower
|
||||
ap.setter = [tower](const ArrangePolygon &p) {
|
||||
if (p.is_arranged()) {
|
||||
Vec2d t = p.translation.cast<double>();
|
||||
tower->apply_arrange_result(t, p.rotation, p.itemid, p.bed_idx);
|
||||
}
|
||||
};
|
||||
return ap;
|
||||
}
|
||||
|
||||
@@ -88,7 +96,6 @@ void ArrangeJob::clear_input()
|
||||
m_unselected.clear();
|
||||
m_unprintable.clear();
|
||||
m_locked.clear();
|
||||
m_unarranged.clear();
|
||||
m_uncompatible_plates.clear();
|
||||
m_selected.reserve(count + 1 /* for optional wti */);
|
||||
m_unselected.reserve(count + 1 /* for optional wti */);
|
||||
@@ -97,11 +104,13 @@ void ArrangeJob::clear_input()
|
||||
current_plate_index = 0;
|
||||
}
|
||||
|
||||
ArrangePolygon ArrangeJob::prepare_arrange_polygon(void* model_instance)
|
||||
ArrangePolygon ArrangeJob::prepare_arrange_polygon(void *model_instance)
|
||||
{
|
||||
ModelInstance* instance = (ModelInstance*)model_instance;
|
||||
const Slic3r::DynamicPrintConfig& config = wxGetApp().preset_bundle->full_config();
|
||||
return get_instance_arrange_poly(instance, config);
|
||||
auto preset_bundle = wxGetApp().preset_bundle;
|
||||
const Slic3r::DynamicPrintConfig& config = preset_bundle->full_config();
|
||||
ArrangePolygon ap = get_instance_arrange_poly(instance, config);
|
||||
return ap;
|
||||
}
|
||||
|
||||
void ArrangeJob::prepare_selected() {
|
||||
@@ -263,7 +272,9 @@ arrangement::ArrangePolygon estimate_wipe_tower_info(int plate_index, std::set<i
|
||||
// we have to estimate the depth using the extruder number of all plates
|
||||
int extruder_size = extruder_ids.size();
|
||||
|
||||
auto arrange_poly = ppl.get_plate(plate_index_valid)->estimate_wipe_tower_polygon(full_config, plate_index, extruder_size);
|
||||
Vec3d wipe_tower_size, wipe_tower_pos;
|
||||
int nozzle_nums = wxGetApp().preset_bundle->get_printer_extruder_count();
|
||||
auto arrange_poly = ppl.get_plate(plate_index_valid)->estimate_wipe_tower_polygon(full_config, plate_index, wipe_tower_pos, wipe_tower_size, nozzle_nums, extruder_size);
|
||||
arrange_poly.bed_idx = plate_index;
|
||||
return arrange_poly;
|
||||
}
|
||||
@@ -278,7 +289,7 @@ arrangement::ArrangePolygon estimate_wipe_tower_info(int plate_index, std::set<i
|
||||
// 2)打开了支撑,且支撑体与接触面使用的是不同材料
|
||||
// 3)允许不同材料落在相同盘,且所有选定对象中使用了多种热床温度相同的材料
|
||||
// (所有对象都是单色的,但不同对象的材料不同,例如:对象A使用红色PLA,对象B使用白色PLA)
|
||||
void ArrangeJob::prepare_wipe_tower()
|
||||
void ArrangeJob::prepare_wipe_tower(bool select)
|
||||
{
|
||||
bool need_wipe_tower = false;
|
||||
|
||||
@@ -296,9 +307,7 @@ void ArrangeJob::prepare_wipe_tower()
|
||||
// estimate if we need wipe tower for all plates:
|
||||
// need wipe tower if some object has multiple extruders (has paint-on colors or support material)
|
||||
for (const auto& item : m_selected) {
|
||||
std::set<int> obj_extruders;
|
||||
obj_extruders.insert(item.extrude_ids.begin(), item.extrude_ids.end());
|
||||
if (obj_extruders.size() > 1) {
|
||||
if (item.extrude_id_filament_types.size() > 1) {
|
||||
need_wipe_tower = true;
|
||||
ARRANGE_LOG(info) << "need wipe tower because object " << item.name << " has multiple extruders (has paint-on colors)";
|
||||
break;
|
||||
@@ -310,7 +319,7 @@ void ArrangeJob::prepare_wipe_tower()
|
||||
if (params.allow_multi_materials_on_same_plate) {
|
||||
std::map<int, std::set<int>> bedTemp2extruderIds;
|
||||
for (const auto& item : m_selected)
|
||||
for (auto id : item.extrude_ids) { bedTemp2extruderIds[item.bed_temp].insert(id); }
|
||||
for (auto id : item.extrude_id_filament_types) { bedTemp2extruderIds[item.bed_temp].insert(id.first); }
|
||||
for (const auto& be : bedTemp2extruderIds) {
|
||||
if (be.second.size() > 1) {
|
||||
need_wipe_tower = true;
|
||||
@@ -345,7 +354,11 @@ void ArrangeJob::prepare_wipe_tower()
|
||||
// wipe tower is already there
|
||||
wipe_tower_ap = get_wipetower_arrange_poly(&wti);
|
||||
wipe_tower_ap.bed_idx = bedid_unlocked;
|
||||
m_unselected.emplace_back(wipe_tower_ap);
|
||||
wipe_tower_ap.name = "WipeTower" + std::to_string(bedid_unlocked);
|
||||
if (select)
|
||||
m_selected.emplace_back(wipe_tower_ap);
|
||||
else
|
||||
m_unselected.emplace_back(wipe_tower_ap);
|
||||
}
|
||||
else if (need_wipe_tower) {
|
||||
if (only_on_partplate) {
|
||||
@@ -396,11 +409,9 @@ void ArrangeJob::prepare_partplate() {
|
||||
bool in_plate = plate->contain_instance(oidx, inst_idx) || plate->intersect_instance(oidx, inst_idx);
|
||||
ArrangePolygon&& ap = prepare_arrange_polygon(mo->instances[inst_idx]);
|
||||
|
||||
ArrangePolygons& cont = mo->instances[inst_idx]->printable ?
|
||||
(in_plate ? m_selected : m_unselected) :
|
||||
m_unprintable;
|
||||
ArrangePolygons &cont = mo->instances[inst_idx]->printable ? m_selected : m_unprintable;
|
||||
bool locked = plate_list.preprocess_arrange_polygon_other_locked(oidx, inst_idx, ap, in_plate);
|
||||
if (!locked)
|
||||
if (!locked && in_plate)
|
||||
{
|
||||
ap.itemid = cont.size();
|
||||
cont.emplace_back(std::move(ap));
|
||||
@@ -410,7 +421,7 @@ void ArrangeJob::prepare_partplate() {
|
||||
//skip this object due to be not in current plate, treated as locked
|
||||
ap.itemid = m_locked.size();
|
||||
m_locked.emplace_back(std::move(ap));
|
||||
//BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": skip locked instance, obj_id %1%, name %2%") % oidx % mo->name;
|
||||
//ARRANGE_LOG(debug) << __FUNCTION__ << boost::format(": skip locked instance, obj_id %1%, name %2%") % oidx % mo->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -427,9 +438,9 @@ void ArrangeJob::prepare_partplate() {
|
||||
|
||||
void ArrangeJob::prepare_outside_plate() {
|
||||
clear_input();
|
||||
|
||||
std::set<std::pair<int, int>> all_inside_objects;
|
||||
std::set<std::pair<int, int>> all_outside_objects;
|
||||
typedef std::tuple<int, int, int> obj_inst_plate_t;
|
||||
std::map<std::pair<int,int>,int> all_inside_objects;
|
||||
std::map<std::pair<int, int>, int> all_outside_objects;
|
||||
|
||||
Model &model = m_plater->model();
|
||||
PartPlateList &plate_list = m_plater->get_partplate_list();
|
||||
@@ -445,9 +456,8 @@ void ArrangeJob::prepare_outside_plate() {
|
||||
continue;
|
||||
}
|
||||
|
||||
all_inside_objects.insert(plate_objects.begin(), plate_objects.end());
|
||||
if (!plate_outside_objects.empty())
|
||||
all_outside_objects.insert(plate_outside_objects.begin(), plate_outside_objects.end());
|
||||
for (auto &obj_inst : plate_objects) { all_inside_objects[obj_inst] = plate_idx; }
|
||||
for (auto &obj_inst : plate_outside_objects) { all_outside_objects[obj_inst] = plate_idx; }
|
||||
|
||||
if (plate->is_locked()) {
|
||||
ARRANGE_LOG(info) << __FUNCTION__ << format(": skip locked plate %d!", plate_idx);
|
||||
@@ -455,40 +465,63 @@ void ArrangeJob::prepare_outside_plate() {
|
||||
}
|
||||
|
||||
// if there are objects inside the plate, lock the plate and don't put new objects in it
|
||||
if (plate_objects.size() > plate_outside_objects.size()) {
|
||||
plate->lock(true);
|
||||
m_uncompatible_plates.push_back(plate_idx);
|
||||
ARRANGE_LOG(info) << __FUNCTION__ << format(": lock plate %d because there are objects inside!", plate_idx);
|
||||
}
|
||||
//if (plate_objects.size() > plate_outside_objects.size()) {
|
||||
// plate->lock(true);
|
||||
// m_uncompatible_plates.push_back(plate_idx);
|
||||
// ARRANGE_LOG(info) << __FUNCTION__ << format(": lock plate %d because there are objects inside!", plate_idx);
|
||||
//}
|
||||
}
|
||||
|
||||
std::set<int> locked_plates;
|
||||
for (int obj_idx = 0; obj_idx < model.objects.size(); obj_idx++) {
|
||||
ModelObject *object = model.objects[obj_idx];
|
||||
for (size_t inst_idx = 0; inst_idx < object->instances.size(); ++inst_idx) {
|
||||
ModelInstance * instance = object->instances[inst_idx];
|
||||
std::set<std::pair<int, int>>::iterator iter1, iter2;
|
||||
|
||||
iter1 = all_inside_objects.find(std::pair(obj_idx, inst_idx));
|
||||
iter2 = all_outside_objects.find(std::pair(obj_idx, inst_idx));
|
||||
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()) {
|
||||
//skip
|
||||
continue;
|
||||
} else {
|
||||
int plate_idx = iter1->second;
|
||||
if (plate_list.get_plate(plate_idx)->is_locked()) {
|
||||
plate_locked = plate_list.get_plate(plate_idx);
|
||||
locked_plates.insert(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_locked) : 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, true);
|
||||
plate_list.preprocess_arrange_polygon(obj_idx, inst_idx, ap, false);
|
||||
ap.bed_idx = iter1->second;
|
||||
ap.locked_plate = iter1->second;
|
||||
}
|
||||
cont.emplace_back(std::move(ap));
|
||||
}
|
||||
}
|
||||
|
||||
prepare_wipe_tower();
|
||||
if (!locked_plates.empty()) {
|
||||
std::sort(m_unselected.begin(), m_unselected.end(), [](auto &ap1, auto &ap2) { return ap1.bed_idx < ap2.bed_idx; });
|
||||
for (auto &ap : m_unselected) {
|
||||
int locked_plate_count = 0;
|
||||
for (auto &plate_idx : locked_plates) {
|
||||
if (plate_idx < ap.bed_idx)
|
||||
locked_plate_count++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
ap.bed_idx -= locked_plate_count;
|
||||
}
|
||||
}
|
||||
|
||||
prepare_wipe_tower(true);
|
||||
|
||||
// add the virtual object into unselect list if has
|
||||
plate_list.preprocess_exclude_areas(m_unselected, current_plate_index + 1);
|
||||
@@ -497,19 +530,15 @@ void ArrangeJob::prepare_outside_plate() {
|
||||
//QDS: add partplate logic
|
||||
void ArrangeJob::prepare()
|
||||
{
|
||||
m_plater->get_notification_manager()->push_notification(NotificationType::ArrangeOngoing,
|
||||
NotificationManager::NotificationLevel::RegularNotificationLevel, _u8L("Arranging..."));
|
||||
m_plater->get_notification_manager()->qdt_close_plateinfo_notification();
|
||||
|
||||
params = init_arrange_params(m_plater);
|
||||
|
||||
//QDS update extruder params and speed table before arranging
|
||||
const Slic3r::DynamicPrintConfig& config = wxGetApp().preset_bundle->full_config();
|
||||
auto& print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
|
||||
auto print_config = print.config();
|
||||
int numExtruders = wxGetApp().preset_bundle->filament_presets.size();
|
||||
int filament_count = wxGetApp().preset_bundle->filament_presets.size();
|
||||
|
||||
Model::setExtruderParams(config, numExtruders);
|
||||
Model::setExtruderParams(config, filament_count);
|
||||
Model::setPrintSpeedTable(config, print_config);
|
||||
|
||||
int state = m_plater->get_prepare_state();
|
||||
@@ -525,6 +554,7 @@ void ArrangeJob::prepare()
|
||||
prepare_outside_plate();
|
||||
}
|
||||
|
||||
ARRANGE_LOG(info) << "prepare state: " << state << ", items selected : " << m_selected.size();
|
||||
|
||||
#if SAVE_ARRANGE_POLY
|
||||
if (1)
|
||||
@@ -567,6 +597,12 @@ void ArrangeJob::prepare()
|
||||
#endif
|
||||
|
||||
check_unprintable();
|
||||
|
||||
if (!m_selected.empty()) {
|
||||
m_plater->get_notification_manager()->push_notification(NotificationType::ArrangeOngoing, NotificationManager::NotificationLevel::RegularNotificationLevel,
|
||||
_u8L("Arranging") + "...");
|
||||
m_plater->get_notification_manager()->qdt_close_plateinfo_notification();
|
||||
}
|
||||
}
|
||||
|
||||
void ArrangeJob::check_unprintable()
|
||||
@@ -598,8 +634,8 @@ void ArrangeJob::on_exception(const std::exception_ptr &eptr)
|
||||
if (eptr)
|
||||
std::rethrow_exception(eptr);
|
||||
} catch (libnest2d::GeometryException &) {
|
||||
show_error(m_plater, _(L("Arrange failed. "
|
||||
"Found some exceptions when processing object geometries.")));
|
||||
show_error(m_plater, _L("Arrange failed. "
|
||||
"Found some exceptions when processing object geometries."));
|
||||
} catch (std::exception &) {
|
||||
PlaterJob::on_exception(eptr);
|
||||
}
|
||||
@@ -621,7 +657,7 @@ void ArrangeJob::process()
|
||||
|
||||
partplate_list.preprocess_exclude_areas(params.excluded_regions, 1, scale_(1));
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << bedpts[0].transpose() << ", " << bedpts[1].transpose() << ", " << bedpts[2].transpose() << ", " << bedpts[3].transpose();
|
||||
ARRANGE_LOG(debug) << "bedpts:" << bedpts[0].transpose() << ", " << bedpts[1].transpose() << ", " << bedpts[2].transpose() << ", " << bedpts[3].transpose();
|
||||
|
||||
params.stopcondition = [this]() { return was_canceled(); };
|
||||
|
||||
@@ -630,16 +666,17 @@ void ArrangeJob::process()
|
||||
};
|
||||
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)<< "Arrange full params: "<< params.to_json();
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("arrange: items selected before arranging: %1%") % m_selected.size();
|
||||
ARRANGE_LOG(warning)<< "full params: "<< params.to_json();
|
||||
ARRANGE_LOG(info) << boost::format("items selected before arranging: %1%") % m_selected.size();
|
||||
for (auto selected : m_selected) {
|
||||
BOOST_LOG_TRIVIAL(debug) << selected.name << ", extruder: " << selected.extrude_ids.back() << ", bed: " << selected.bed_idx << ", filemant_type:" << selected.filament_temp_type
|
||||
<< ", trans: " << selected.translation.transpose();
|
||||
ARRANGE_LOG(debug) << selected.name << ", extruder: " << MapFormatter(selected.extrude_id_filament_types) << ", bed: " << selected.bed_idx
|
||||
<< ", filemant_type:" << selected.filament_temp_type << ", trans: " << unscale<double>(selected.translation(X)) << ","
|
||||
<< unscale<double>(selected.translation(Y)) << ", rotation: " << selected.rotation;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(debug) << "arrange: items unselected before arrange: " << m_unselected.size();
|
||||
ARRANGE_LOG(debug) << "items unselected before arrange: " << m_unselected.size();
|
||||
for (auto item : m_unselected)
|
||||
BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose()
|
||||
<<", bbox:"<<get_extents(item.poly).min.transpose()<<","<<get_extents(item.poly).max.transpose();
|
||||
BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << unscale<double>(item.translation(X)) << ","
|
||||
<< unscale<double>(item.translation(Y));
|
||||
}
|
||||
|
||||
arrangement::arrange(m_selected, m_unselected, bedpts, params);
|
||||
@@ -647,14 +684,15 @@ void ArrangeJob::process()
|
||||
// sort by item id
|
||||
std::sort(m_selected.begin(), m_selected.end(), [](auto a, auto b) {return a.itemid < b.itemid; });
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("arrange: items selected after arranging: %1%") % m_selected.size();
|
||||
ARRANGE_LOG(info) << boost::format("items selected after arranging: %1%") % m_selected.size();
|
||||
for (auto selected : m_selected)
|
||||
BOOST_LOG_TRIVIAL(debug) << selected.name << ", extruder: " << selected.extrude_ids.back() << ", bed: " << selected.bed_idx
|
||||
ARRANGE_LOG(debug) << selected.name << ", extruder: " << MapFormatter(selected.extrude_id_filament_types) << ", bed: " << selected.bed_idx
|
||||
<< ", bed_temp: " << selected.first_bed_temp << ", print_temp: " << selected.print_temp
|
||||
<< ", trans: " << unscale<double>(selected.translation(X)) << ","<< unscale<double>(selected.translation(Y));
|
||||
BOOST_LOG_TRIVIAL(debug) << "arrange: items unselected after arrange: "<< m_unselected.size();
|
||||
<< ", trans: " << unscale<double>(selected.translation(X)) << "," << unscale<double>(selected.translation(Y))
|
||||
<< ", rotation: " << selected.rotation;
|
||||
ARRANGE_LOG(debug) << "items unselected after arrange: " << m_unselected.size();
|
||||
for (auto item : m_unselected)
|
||||
BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose();
|
||||
BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << unscale<double>(item.translation(X)) << "," << unscale<double>(item.translation(Y));
|
||||
}
|
||||
|
||||
// put unpackable items to m_unprintable so they goes outside
|
||||
@@ -710,7 +748,7 @@ void ArrangeJob::finalize()
|
||||
|
||||
beds = std::max(ap.bed_idx, beds);
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": arrange selected %4%: bed_id %1%, trans {%2%,%3%}") % ap.bed_idx % unscale<double>(ap.translation(X)) % unscale<double>(ap.translation(Y)) % ap.name;
|
||||
ARRANGE_LOG(debug) << __FUNCTION__ << boost::format(": selected %4%: bed_id %1%, trans {%2%, %3%}") % ap.bed_idx % unscale<double>(ap.translation(X)) % unscale<double>(ap.translation(Y)) % ap.name;
|
||||
}
|
||||
|
||||
//QDS: adjust the bed_index, create new plates, get the max bed_index
|
||||
@@ -723,7 +761,7 @@ void ArrangeJob::finalize()
|
||||
plate_list.postprocess_bed_index_for_unselected(ap);
|
||||
|
||||
beds = std::max(ap.bed_idx, beds);
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(":arrange unselected %4%: bed_id %1%, trans {%2%,%3%}") % ap.bed_idx % unscale<double>(ap.translation(X)) % unscale<double>(ap.translation(Y)) % ap.name;
|
||||
ARRANGE_LOG(debug) << __FUNCTION__ << boost::format(": unselected %4%: bed_id %1%, trans {%2%, %3%}") % ap.bed_idx % unscale<double>(ap.translation(X)) % unscale<double>(ap.translation(Y)) % ap.name;
|
||||
}
|
||||
|
||||
for (ArrangePolygon& ap : m_locked) {
|
||||
@@ -732,6 +770,8 @@ void ArrangeJob::finalize()
|
||||
plate_list.postprocess_arrange_polygon(ap, false);
|
||||
|
||||
ap.apply();
|
||||
ARRANGE_LOG(debug) << boost::format(": locked %4%: bed_id %1%, trans {%2%, %3%}") % ap.bed_idx % unscale<double>(ap.translation(X)) %
|
||||
unscale<double>(ap.translation(Y)) % ap.name;
|
||||
}
|
||||
|
||||
// Apply the arrange result to all selected objects
|
||||
@@ -751,6 +791,8 @@ void ArrangeJob::finalize()
|
||||
plate_list.postprocess_arrange_polygon(ap, false);
|
||||
|
||||
ap.apply();
|
||||
ARRANGE_LOG(debug) << boost::format(": unselected %4%: bed_id %1%, trans {%2%, %3%}") % ap.bed_idx % unscale<double>(ap.translation(X)) %
|
||||
unscale<double>(ap.translation(Y)) % ap.name;
|
||||
}
|
||||
|
||||
// Move the unprintable items to the last virtual bed.
|
||||
@@ -760,22 +802,10 @@ void ArrangeJob::finalize()
|
||||
plate_list.postprocess_arrange_polygon(ap, true);
|
||||
|
||||
ap.apply();
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(":arrange m_unprintable: name: %4%, bed_id %1%, trans {%2%,%3%}") % ap.bed_idx % unscale<double>(ap.translation(X)) % unscale<double>(ap.translation(Y)) % ap.name;
|
||||
ARRANGE_LOG(debug) << __FUNCTION__ << boost::format(": m_unprintable: name: %4%, bed_id %1%, trans {%2%,%3%}") % ap.bed_idx % unscale<double>(ap.translation(X)) % unscale<double>(ap.translation(Y)) % ap.name;
|
||||
}
|
||||
|
||||
m_plater->update();
|
||||
// QDS
|
||||
//wxGetApp().obj_manipul()->set_dirty();
|
||||
|
||||
if (!m_unarranged.empty()) {
|
||||
std::set<std::string> names;
|
||||
for (ModelInstance* mi : m_unarranged)
|
||||
names.insert(mi->get_object()->name);
|
||||
|
||||
m_plater->get_notification_manager()->push_notification(GUI::format(
|
||||
_L("Arrangement ignored the following objects which can't fit into a single bed:\n%s"),
|
||||
concat_strings(names, "\n")));
|
||||
}
|
||||
|
||||
// unlock the plates we just locked
|
||||
for (int i : m_uncompatible_plates) {
|
||||
@@ -797,8 +827,9 @@ void ArrangeJob::finalize()
|
||||
wxGetApp().obj_list()->reload_all_plates();
|
||||
|
||||
m_plater->update();
|
||||
m_plater->get_notification_manager()->push_notification(NotificationType::ArrangeOngoing,
|
||||
NotificationManager::NotificationLevel::RegularNotificationLevel, _u8L("Arranging done."));
|
||||
if (!m_selected.empty())
|
||||
m_plater->get_notification_manager()->push_notification(NotificationType::ArrangeOngoing, NotificationManager::NotificationLevel::RegularNotificationLevel,
|
||||
_u8L("Arranging done."));
|
||||
}
|
||||
else {
|
||||
m_plater->get_notification_manager()->push_notification(NotificationType::ArrangeOngoing,
|
||||
@@ -849,6 +880,9 @@ arrangement::ArrangeParams init_arrange_params(Plater *p)
|
||||
params.is_seq_print = settings.is_seq_print;
|
||||
params.min_obj_distance = scaled(settings.distance);
|
||||
params.align_to_y_axis = settings.align_to_y_axis;
|
||||
#if !QDT_RELEASE_TO_PUBLIC
|
||||
params.save_svg = settings.save_svg;
|
||||
#endif
|
||||
|
||||
int state = p->get_prepare_state();
|
||||
if (state == Job::JobPrepareState::PREPARE_STATE_MENU) {
|
||||
|
||||
@@ -19,7 +19,6 @@ class ArrangeJob : public PlaterJob
|
||||
|
||||
//QDS: add locked logic
|
||||
ArrangePolygons m_selected, m_unselected, m_unprintable, m_locked;
|
||||
std::vector<ModelInstance*> m_unarranged;
|
||||
std::map<int, ArrangePolygons> m_selected_groups; // groups of selected items for sequential printing
|
||||
std::vector<int> m_uncompatible_plates; // plate indices with different printing sequence than global
|
||||
|
||||
@@ -41,9 +40,7 @@ class ArrangeJob : public PlaterJob
|
||||
|
||||
void prepare_outside_plate();
|
||||
|
||||
void prepare_wipe_tower();
|
||||
|
||||
ArrangePolygon prepare_arrange_polygon(void* instance);
|
||||
void prepare_wipe_tower(bool select = false);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -67,6 +64,8 @@ public:
|
||||
}
|
||||
|
||||
void finalize() override;
|
||||
|
||||
static ArrangePolygon prepare_arrange_polygon(void *instance);
|
||||
};
|
||||
|
||||
std::optional<arrangement::ArrangePolygon> get_wipe_tower_arrangepoly(const Plater &);
|
||||
|
||||
@@ -32,7 +32,7 @@ void BindJob::on_exception(const std::exception_ptr &eptr)
|
||||
try {
|
||||
if (eptr)
|
||||
std::rethrow_exception(eptr);
|
||||
} catch (std::exception &e) {
|
||||
} catch (std::exception &/*e*/) {
|
||||
PlaterJob::on_exception(eptr);
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ void BindJob::process()
|
||||
);
|
||||
|
||||
if (result < 0) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "login: result = " << result;
|
||||
BOOST_LOG_TRIVIAL(info) << "login: result = " << result;
|
||||
|
||||
if (result_code == QIDI_NETWORK_ERR_BIND_ECODE_LOGIN_REPORT_FAILED || result_code == QIDI_NETWORK_ERR_BIND_GET_PRINTER_TICKET_TIMEOUT) {
|
||||
int error_code;
|
||||
@@ -116,8 +116,7 @@ void BindJob::process()
|
||||
try
|
||||
{
|
||||
error_code = stoi(result_info);
|
||||
wxString error_msg;
|
||||
wxGetApp().get_hms_query()->query_print_error_msg(error_code, error_msg);
|
||||
wxString error_msg = wxGetApp().get_hms_query()->query_print_error_msg(m_dev_id, error_code);
|
||||
result_info = error_msg.ToStdString();
|
||||
}
|
||||
catch (...) {
|
||||
@@ -131,7 +130,7 @@ void BindJob::process()
|
||||
|
||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) {
|
||||
BOOST_LOG_TRIVIAL(trace) << "login: dev is null";
|
||||
BOOST_LOG_TRIVIAL(error) << "login: dev is null";
|
||||
post_fail_event(result_code, result_info);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -428,11 +428,11 @@ void CreateObjectJob::finalize(bool canceled, std::exception_ptr &eptr)
|
||||
ModelObject *new_object = model.add_object();
|
||||
new_object->name = m_input.base->volume_name;
|
||||
new_object->add_instance(); // each object should have at list one instance
|
||||
|
||||
new_object->config.set_key_value("extruder", new ConfigOptionInt(1));
|
||||
if (!m_result.empty()) {
|
||||
ModelVolume *new_volume = new_object->add_volume(std::move(m_result));
|
||||
// set a default extruder value, since user can't add it manually
|
||||
new_volume->config.set_key_value("extruder", new ConfigOptionInt(0));
|
||||
new_volume->config.set_key_value("extruder", new ConfigOptionInt(1));
|
||||
// write emboss data into volume
|
||||
m_input.base->write(*new_volume);
|
||||
} else if (!m_results.empty()) {
|
||||
@@ -442,7 +442,7 @@ void CreateObjectJob::finalize(bool canceled, std::exception_ptr &eptr)
|
||||
continue;
|
||||
ModelVolume *new_volume = new_object->add_volume(std::move(m_results[index]));
|
||||
// set a default extruder value, since user can't add it manually
|
||||
new_volume->config.set_key_value("extruder", new ConfigOptionInt(0));
|
||||
new_volume->config.set_key_value("extruder", new ConfigOptionInt(1));
|
||||
//donot write emboss data into volume
|
||||
new_volume->name = new_object->name + "_" + std::to_string(index);
|
||||
index++;
|
||||
@@ -666,7 +666,8 @@ std::vector<TriangleMesh> create_meshs(DataBase &input)
|
||||
|
||||
for (auto shape : input.shape.shapes_with_ids) {
|
||||
if (shape.expoly.empty()) continue;
|
||||
meshs.emplace_back(TriangleMesh(polygons2model(shape.expoly, project)));
|
||||
HealedExPolygons result = Slic3r::Emboss::union_with_delta(shape.expoly, UNION_DELTA, UNION_MAX_ITERATIN);
|
||||
meshs.emplace_back(TriangleMesh(polygons2model(result.expolygons, project)));
|
||||
}
|
||||
return meshs;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ GUI::Job::Job(std::shared_ptr<ProgressIndicator> pri)
|
||||
|
||||
Bind(wxEVT_THREAD, [this](const wxThreadEvent &evt) {
|
||||
if (m_finalizing) return;
|
||||
if (this->is_print_job() && evt.GetInt() >= 100) { update_percent_finish(); }
|
||||
|
||||
|
||||
auto msg = evt.GetString();
|
||||
if (!msg.empty() && !m_worker_error)
|
||||
|
||||
@@ -94,6 +94,10 @@ public:
|
||||
|
||||
bool is_running() const { return m_running.load(); }
|
||||
void cancel() { m_canceled.store(true); }
|
||||
|
||||
public:
|
||||
/*type check*/
|
||||
virtual bool is_print_job() const { return false; }
|
||||
};
|
||||
|
||||
// Jobs defined inside the group class will be managed so that only one can
|
||||
|
||||
@@ -12,26 +12,26 @@
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again.");
|
||||
static wxString printjob_cancel_str = _L("Task canceled.");
|
||||
static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network status and try again.");
|
||||
static wxString failed_in_cloud_service_str = _L("Cloud service connection failed. Please try again.");
|
||||
static wxString file_is_not_exists_str = _L("Print file not found. please slice again.");
|
||||
static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again.");
|
||||
static wxString print_canceled_str = _L("Task canceled.");
|
||||
static wxString send_print_failed_str = _L("Failed to send the print job. Please try again.");
|
||||
static wxString upload_ftp_failed_str = _L("Failed to upload file to ftp. Please try again.");
|
||||
static wxString print_signed_str = _L("Your software is not signed, and some printing functions have been restricted. Please use the officially signed software version.");
|
||||
#define CHECK_GCODE_FAILED_STR _L("Abnormal print file data. Please slice again.")
|
||||
#define PRINTJOB_CANCEL_STR _L("Task canceled.")
|
||||
#define TIMEOUT_TO_UPLOAD_STR _L("Upload task timed out. Please check the network status and try again.")
|
||||
#define FAILED_IN_CLOUD_SERVICE_STR _L("Cloud service connection failed. Please try again.")
|
||||
#define FILE_IS_NOT_EXISTS_STR _L("Print file not found. please slice again.")
|
||||
#define FILE_OVER_SIZE_STR _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again.")
|
||||
#define PRINT_CANCELED_STR _L("Task canceled.")
|
||||
#define SEND_PRINT_FAILED_STR _L("Failed to send the print job. Please try again.")
|
||||
#define UPLOAD_FTP_FAILED_STR _L("Failed to upload file to ftp. Please try again.")
|
||||
#define PRINT_SIGNED_STR _L("Your software is not signed, and some printing functions have been restricted. Please use the officially signed software version.")
|
||||
|
||||
static wxString desc_network_error = _L("Check the current status of the qidi server by clicking on the link above.");
|
||||
static wxString desc_file_too_large = _L("The size of the print file is too large. Please adjust the file size and try again.");
|
||||
static wxString desc_fail_not_exist = _L("Print file not found, Please slice it again and send it for printing.");
|
||||
static wxString desc_upload_ftp_failed = _L("Failed to upload print file to FTP. Please check the network status and try again.");
|
||||
#define DESC_NETWORK_ERROR _L("Check the current status of the qidi server by clicking on the link above.")
|
||||
#define DESC_FILE_TOO_LARGE _L("The size of the print file is too large. Please adjust the file size and try again.")
|
||||
#define DESC_FAIL_NOT_EXIST _L("Print file not found, Please slice it again and send it for printing.")
|
||||
#define DESC_UPLOAD_FTP_FAILED _L("Failed to upload print file to FTP. Please check the network status and try again.")
|
||||
|
||||
static wxString sending_over_lan_str = _L("Sending print job over LAN");
|
||||
static wxString sending_over_cloud_str = _L("Sending print job through cloud service");
|
||||
#define SENDING_OVER_LAN_STR _L("Sending print job over LAN")
|
||||
#define SENDING_OVER_CLOUD_STR _L("Sending print job through cloud service")
|
||||
|
||||
static wxString wait_sending_finish = _L("Print task sending times out.");
|
||||
#define wait_sending_finish _L("Print task sending times out.")
|
||||
//static wxString desc_wait_sending_finish = _L("The printer timed out while receiving a print job. Please check if the network is functioning properly and send the print again.");
|
||||
//static wxString desc_wait_sending_finish = _L("The printer timed out while receiving a print job. Please check if the network is functioning properly.");
|
||||
|
||||
@@ -53,6 +53,8 @@ void PrintJob::prepare()
|
||||
BOOST_LOG_TRIVIAL(trace) << "sned_job: check_access_code_path = " << check_access_code_path;
|
||||
job_data._temp_path = fs::path(check_access_code_path);
|
||||
}
|
||||
|
||||
m_print_stage = QDT::SendingPrintJobStage::PrintingStageLimit;
|
||||
}
|
||||
|
||||
void PrintJob::on_exception(const std::exception_ptr &eptr)
|
||||
@@ -60,7 +62,7 @@ void PrintJob::on_exception(const std::exception_ptr &eptr)
|
||||
try {
|
||||
if (eptr)
|
||||
std::rethrow_exception(eptr);
|
||||
} catch (std::exception &e) {
|
||||
} catch (std::exception &/*e*/) {
|
||||
PlaterJob::on_exception(eptr);
|
||||
}
|
||||
}
|
||||
@@ -113,9 +115,9 @@ wxString PrintJob::get_http_error_msg(unsigned int status, std::string body)
|
||||
if (!j["message"].is_null())
|
||||
message = j["message"].get<std::string>();
|
||||
}
|
||||
switch (status) {
|
||||
;
|
||||
}
|
||||
//switch (status) {
|
||||
// ;
|
||||
//}
|
||||
}
|
||||
catch (...) {
|
||||
;
|
||||
@@ -157,7 +159,7 @@ void PrintJob::process()
|
||||
}
|
||||
|
||||
int result = -1;
|
||||
unsigned int http_code;
|
||||
//unsigned int http_code;
|
||||
std::string http_body;
|
||||
|
||||
int total_plate_num = plate_data.plate_count;
|
||||
@@ -171,12 +173,12 @@ void PrintJob::process()
|
||||
|
||||
/* check gcode is valid */
|
||||
if (!plate->is_valid_gcode_file() && m_print_type == "from_normal") {
|
||||
update_status(curr_percent, check_gcode_failed_str);
|
||||
update_status(curr_percent, CHECK_GCODE_FAILED_STR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (was_canceled()) {
|
||||
update_status(curr_percent, printjob_cancel_str);
|
||||
update_status(curr_percent, PRINTJOB_CANCEL_STR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -244,11 +246,16 @@ void PrintJob::process()
|
||||
params.task_layer_inspect = this->task_layer_inspect;
|
||||
params.task_record_timelapse= this->task_record_timelapse;
|
||||
params.ams_mapping = this->task_ams_mapping;
|
||||
params.ams_mapping2 = this->task_ams_mapping2;
|
||||
params.ams_mapping_info = this->task_ams_mapping_info;
|
||||
params.nozzles_info = this->task_nozzles_info;
|
||||
params.connection_type = this->connection_type;
|
||||
params.task_use_ams = this->task_use_ams;
|
||||
params.task_bed_type = this->task_bed_type;
|
||||
params.print_type = this->m_print_type;
|
||||
params.auto_bed_leveling = this->auto_bed_leveling;
|
||||
params.auto_flow_cali = this->auto_flow_cali;
|
||||
params.auto_offset_cali = this->auto_offset_cali;
|
||||
|
||||
if (m_print_type == "from_sdcard_view") {
|
||||
params.dst_file = m_dst_path;
|
||||
@@ -336,14 +343,16 @@ void PrintJob::process()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (params.stl_design_id == 0 || !wxGetApp().model().design_id.empty()) {
|
||||
try {
|
||||
params.stl_design_id = std::stoi(wxGetApp().model().design_id);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
const auto& model_design_id = wxGetApp().model().design_id;
|
||||
if (params.stl_design_id == 0 || !model_design_id.empty()) {
|
||||
if (model_design_id.empty()) {
|
||||
params.stl_design_id = 0;
|
||||
} else {
|
||||
try {
|
||||
params.stl_design_id = std::stoi(model_design_id);
|
||||
} catch (...) {
|
||||
params.stl_design_id = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +392,7 @@ void PrintJob::process()
|
||||
&error_text,
|
||||
StagePercentPoint
|
||||
](int stage, int code, std::string info) {
|
||||
|
||||
m_print_stage = stage;
|
||||
if (stage == QDT::SendingPrintJobStage::PrintingStageCreate && !is_try_lan_mode_failed) {
|
||||
if (this->connection_type == "lan") {
|
||||
msg = _L("Sending print job over LAN");
|
||||
@@ -423,7 +432,6 @@ void PrintJob::process()
|
||||
if (m_print_job_completed_id == wxGetApp().plater()->get_send_calibration_finished_event()) {
|
||||
msg = wxString::Format(_L("Successfully sent. Will automatically jump to the next page in %ss"), info);
|
||||
}
|
||||
this->update_percent_finish();
|
||||
} else {
|
||||
if (this->connection_type == "lan") {
|
||||
msg = _L("Sending print job over LAN");
|
||||
@@ -445,13 +453,13 @@ void PrintJob::process()
|
||||
//get errors
|
||||
if (code > 100 || code < 0 || stage == QDT::SendingPrintJobStage::PrintingStageERROR) {
|
||||
if (code == QIDI_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE || code == QIDI_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE) {
|
||||
m_plater->update_print_error_info(code, desc_file_too_large.ToStdString(), info);
|
||||
m_plater->update_print_error_info(code, DESC_FILE_TOO_LARGE.ToStdString(), info);
|
||||
}else if (code == QIDI_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || code == QIDI_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST){
|
||||
m_plater->update_print_error_info(code, desc_fail_not_exist.ToStdString(), info);
|
||||
m_plater->update_print_error_info(code, DESC_FAIL_NOT_EXIST.ToStdString(), info);
|
||||
}else if (code == QIDI_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || code == QIDI_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) {
|
||||
m_plater->update_print_error_info(code, desc_upload_ftp_failed.ToStdString(), info);
|
||||
m_plater->update_print_error_info(code, DESC_UPLOAD_FTP_FAILED.ToStdString(), info);
|
||||
}else {
|
||||
m_plater->update_print_error_info(code, desc_network_error.ToStdString(), info);
|
||||
m_plater->update_print_error_info(code, DESC_NETWORK_ERROR.ToStdString(), info);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -479,7 +487,7 @@ void PrintJob::process()
|
||||
try {
|
||||
job_info_j.parse(job_info);
|
||||
if (job_info_j.contains("job_id")) {
|
||||
curr_job_id = job_info_j["job_id"].get<std::string>();
|
||||
curr_job_id = JsonValParser::get_longlong_val(job_info_j["job_id"]);
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(trace) << "print_job: curr_obj_id=" << curr_job_id;
|
||||
|
||||
@@ -499,6 +507,12 @@ void PrintJob::process()
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: printer has enter printing status, s = " << obj->print_status;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this->was_canceled()) {
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: user cancel the job" << obj->job_id_;
|
||||
return true;
|
||||
}
|
||||
|
||||
time_out++;
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(1000));
|
||||
}
|
||||
@@ -587,7 +601,7 @@ void PrintJob::process()
|
||||
this->update_status(curr_percent, _L("Sending print job over LAN"));
|
||||
result = m_agent->start_local_print(params, update_fn, cancel_fn);
|
||||
} else {
|
||||
this->update_status(curr_percent, _L("An SD card needs to be inserted before printing via LAN."));
|
||||
this->update_status(curr_percent, _L("Storage needs to be inserted before printing via LAN."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -598,22 +612,22 @@ void PrintJob::process()
|
||||
msg_text = _L("Retrieving printer information, please try again later.");
|
||||
}
|
||||
else if (result == QIDI_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || result == QIDI_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) {
|
||||
msg_text = file_is_not_exists_str;
|
||||
msg_text = FILE_IS_NOT_EXISTS_STR;
|
||||
} else if (result == QIDI_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE || result == QIDI_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE) {
|
||||
msg_text = file_over_size_str;
|
||||
msg_text = FILE_OVER_SIZE_STR;
|
||||
} else if (result == QIDI_NETWORK_ERR_PRINT_WR_CHECK_MD5_FAILED || result == QIDI_NETWORK_ERR_PRINT_SP_CHECK_MD5_FAILED) {
|
||||
msg_text = failed_in_cloud_service_str;
|
||||
msg_text = FAILED_IN_CLOUD_SERVICE_STR;
|
||||
} else if (result == QIDI_NETWORK_ERR_PRINT_WR_GET_NOTIFICATION_TIMEOUT || result == QIDI_NETWORK_ERR_PRINT_SP_GET_NOTIFICATION_TIMEOUT) {
|
||||
msg_text = timeout_to_upload_str;
|
||||
msg_text = TIMEOUT_TO_UPLOAD_STR;
|
||||
} else if (result == QIDI_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || result == QIDI_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) {
|
||||
msg_text = upload_ftp_failed_str;
|
||||
msg_text = UPLOAD_FTP_FAILED_STR;
|
||||
} else if (result == QIDI_NETWORK_ERR_CANCELED) {
|
||||
msg_text = print_canceled_str;
|
||||
msg_text = PRINT_CANCELED_STR;
|
||||
this->update_status(0, msg_text);
|
||||
} else if (result == QIDI_NETWORK_SIGNED_ERROR) {
|
||||
msg_text = print_signed_str;
|
||||
msg_text = PRINT_SIGNED_STR;
|
||||
} else {
|
||||
msg_text = send_print_failed_str;
|
||||
msg_text = SEND_PRINT_FAILED_STR;
|
||||
}
|
||||
|
||||
if (result != QIDI_NETWORK_ERR_CANCELED) {
|
||||
|
||||
@@ -41,6 +41,7 @@ class PrintJob : public PlaterJob
|
||||
std::string m_dev_id;
|
||||
bool m_job_finished{ false };
|
||||
int m_print_job_completed_id = 0;
|
||||
int m_print_stage = 0;
|
||||
wxString m_completed_evt_data;
|
||||
std::function<void()> m_enter_ip_address_fun_fail{ nullptr };
|
||||
std::function<void()> m_enter_ip_address_fun_success{ nullptr };
|
||||
@@ -54,6 +55,7 @@ protected:
|
||||
void on_exception(const std::exception_ptr &) override;
|
||||
public:
|
||||
PrintJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id = "");
|
||||
virtual bool is_print_job() const override { return true; }
|
||||
|
||||
std::string m_project_name;
|
||||
std::string m_dev_ip;
|
||||
@@ -61,7 +63,9 @@ public:
|
||||
std::string m_access_code;
|
||||
std::string task_bed_type;
|
||||
std::string task_ams_mapping;
|
||||
std::string task_ams_mapping2;
|
||||
std::string task_ams_mapping_info;
|
||||
std::string task_nozzles_info;
|
||||
std::string connection_type;
|
||||
std::string m_print_type;
|
||||
std::string m_dst_path;
|
||||
@@ -81,7 +85,14 @@ public:
|
||||
bool has_sdcard { false };
|
||||
bool task_use_ams { true };
|
||||
|
||||
void set_print_config(std::string bed_type, bool bed_leveling, bool flow_cali, bool vabration_cali, bool record_timelapse, bool layer_inspect)
|
||||
int auto_bed_leveling{0};
|
||||
int auto_flow_cali{0};
|
||||
int auto_offset_cali{0};
|
||||
|
||||
void set_print_config(std::string bed_type, bool bed_leveling, bool flow_cali, bool vabration_cali, bool record_timelapse, bool layer_inspect,
|
||||
int auto_bed_levelingt,
|
||||
int auto_flow_calit,
|
||||
int auto_offset_calit)
|
||||
{
|
||||
task_bed_type = bed_type;
|
||||
task_bed_leveling = bed_leveling;
|
||||
@@ -89,6 +100,10 @@ public:
|
||||
task_vibration_cali = vabration_cali;
|
||||
task_record_timelapse = record_timelapse;
|
||||
task_layer_inspect = layer_inspect;
|
||||
|
||||
auto_bed_leveling = auto_bed_levelingt;
|
||||
auto_flow_cali = auto_flow_calit;
|
||||
auto_offset_cali = auto_offset_calit;
|
||||
}
|
||||
|
||||
int status_range() const override
|
||||
@@ -97,6 +112,9 @@ public:
|
||||
}
|
||||
|
||||
bool is_finished() { return m_job_finished; }
|
||||
int get_print_stage() const { return m_print_stage;}
|
||||
void reset_print_stage() { m_print_stage = 0; }
|
||||
|
||||
void set_print_job_finished_event(int event_id, wxString evt_data = wxEmptyString) {
|
||||
m_print_job_completed_id = event_id;
|
||||
m_completed_evt_data = evt_data;
|
||||
|
||||
@@ -9,23 +9,23 @@
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again.");
|
||||
static wxString printjob_cancel_str = _L("Task canceled.");
|
||||
static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network status and try again.");
|
||||
static wxString failed_in_cloud_service_str = _L("Cloud service connection failed. Please try again.");
|
||||
static wxString file_is_not_exists_str = _L("Print file not found. please slice again.");
|
||||
static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again.");
|
||||
static wxString print_canceled_str = _L("Task canceled.");
|
||||
static wxString send_print_failed_str = _L("Failed to send the print job. Please try again.");
|
||||
static wxString upload_ftp_failed_str = _L("Failed to upload file to ftp. Please try again.");
|
||||
#define CHECK_GCODE_FAILED_STR _L("Abnormal print file data. Please slice again.")
|
||||
#define PRINTJOB_CANCEL_STR _L("Task canceled.")
|
||||
#define TIMEOUT_TO_UPLOAD_STR _L("Upload task timed out. Please check the network status and try again.")
|
||||
#define FAILED_IN_CLOUD_SERVICE_STR _L("Cloud service connection failed. Please try again.")
|
||||
#define FILE_IS_NOT_EXISTS_STR _L("Print file not found. please slice again.")
|
||||
#define FILE_OVER_SIZE_STR _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again.")
|
||||
#define PRINT_CANCELED_STR _L("Task canceled.")
|
||||
#define SEND_PRINT_FAILED_STR _L("Failed to send the print job. Please try again.")
|
||||
#define UPLOAD_FTP_FAILED_STR _L("Failed to upload file to ftp. Please try again.")
|
||||
|
||||
static wxString desc_network_error = _L("Check the current status of the qidi server by clicking on the link above.");
|
||||
static wxString desc_file_too_large = _L("The size of the print file is too large. Please adjust the file size and try again.");
|
||||
static wxString desc_fail_not_exist = _L("Print file not found, Please slice it again and send it for printing.");
|
||||
static wxString desc_upload_ftp_failed = _L("Failed to upload print file to FTP. Please check the network status and try again.");
|
||||
#define DESC_NETWORK_ERROR _L("Check the current status of the qidi server by clicking on the link above.")
|
||||
#define DESC_FILE_TOO_LARGE _L("The size of the print file is too large. Please adjust the file size and try again.")
|
||||
#define DESC_FAIL_NOT_EXIST _L("Print file not found, Please slice it again and send it for printing.")
|
||||
#define DESC_UPLOAD_FTP_FAILED _L("Failed to upload print file to FTP. Please check the network status and try again.")
|
||||
|
||||
static wxString sending_over_lan_str = _L("Sending print job over LAN");
|
||||
static wxString sending_over_cloud_str = _L("Sending print job through cloud service");
|
||||
#define SENDING_OVER_LAN_STR _L("Sending print job over LAN")
|
||||
#define SENDING_OVER_CLOUD_STR _L("Sending print job through cloud service")
|
||||
|
||||
SendJob::SendJob(std::shared_ptr<ProgressIndicator> pri, Plater* plater, std::string dev_id)
|
||||
: PlaterJob{ std::move(pri), plater },
|
||||
@@ -50,7 +50,7 @@ void SendJob::on_exception(const std::exception_ptr &eptr)
|
||||
try {
|
||||
if (eptr)
|
||||
std::rethrow_exception(eptr);
|
||||
} catch (std::exception &e) {
|
||||
} catch (std::exception &/*e*/) {
|
||||
PlaterJob::on_exception(eptr);
|
||||
}
|
||||
}
|
||||
@@ -76,9 +76,6 @@ wxString SendJob::get_http_error_msg(unsigned int status, std::string body)
|
||||
if (!j["message"].is_null())
|
||||
message = j["message"].get<std::string>();
|
||||
}
|
||||
switch (status) {
|
||||
;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
;
|
||||
@@ -120,7 +117,7 @@ void SendJob::process()
|
||||
NetworkAgent* m_agent = wxGetApp().getAgent();
|
||||
AppConfig* config = wxGetApp().app_config;
|
||||
int result = -1;
|
||||
unsigned int http_code;
|
||||
//unsigned int http_code;
|
||||
std::string http_body;
|
||||
|
||||
|
||||
@@ -183,19 +180,19 @@ void SendJob::process()
|
||||
}
|
||||
if (plate == nullptr) {
|
||||
BOOST_LOG_TRIVIAL(error) << "can not find plate with valid gcode file when sending to print, plate_index="<< job_data.plate_idx;
|
||||
update_status(curr_percent, check_gcode_failed_str);
|
||||
update_status(curr_percent, CHECK_GCODE_FAILED_STR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* check gcode is valid */
|
||||
if (!plate->is_valid_gcode_file()) {
|
||||
update_status(curr_percent, check_gcode_failed_str);
|
||||
update_status(curr_percent, CHECK_GCODE_FAILED_STR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (was_canceled()) {
|
||||
update_status(curr_percent, printjob_cancel_str);
|
||||
update_status(curr_percent, PRINTJOB_CANCEL_STR);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -277,19 +274,19 @@ void SendJob::process()
|
||||
}
|
||||
}
|
||||
|
||||
//get errors
|
||||
//get errors
|
||||
if (code > 100 || code < 0 || stage == QDT::SendingPrintJobStage::PrintingStageERROR) {
|
||||
if (code == QIDI_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE || code == QIDI_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE) {
|
||||
m_plater->update_print_error_info(code, desc_file_too_large.ToStdString(), info);
|
||||
m_plater->update_print_error_info(code, DESC_FILE_TOO_LARGE.ToStdString(), info);
|
||||
}
|
||||
else if (code == QIDI_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || code == QIDI_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) {
|
||||
m_plater->update_print_error_info(code, desc_fail_not_exist.ToStdString(), info);
|
||||
m_plater->update_print_error_info(code, DESC_FAIL_NOT_EXIST.ToStdString(), info);
|
||||
}
|
||||
else if (code == QIDI_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || code == QIDI_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) {
|
||||
m_plater->update_print_error_info(code, desc_upload_ftp_failed.ToStdString(), info);
|
||||
m_plater->update_print_error_info(code, DESC_UPLOAD_FTP_FAILED.ToStdString(), info);
|
||||
}
|
||||
else {
|
||||
m_plater->update_print_error_info(code, desc_network_error.ToStdString(), info);
|
||||
m_plater->update_print_error_info(code, DESC_NETWORK_ERROR.ToStdString(), info);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -338,13 +335,13 @@ void SendJob::process()
|
||||
this->update_status(curr_percent, _L("Sending gcode file over LAN"));
|
||||
result = m_agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn, nullptr);
|
||||
} else {
|
||||
this->update_status(curr_percent, _L("An SD card needs to be inserted before sending to printer."));
|
||||
this->update_status(curr_percent, _L("Storage needs to be inserted before sending to printer."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (was_canceled()) {
|
||||
update_status(curr_percent, printjob_cancel_str);
|
||||
update_status(curr_percent, PRINTJOB_CANCEL_STR);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -352,25 +349,25 @@ void SendJob::process()
|
||||
curr_percent = -1;
|
||||
|
||||
if (result == QIDI_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || result == QIDI_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) {
|
||||
msg_text = file_is_not_exists_str;
|
||||
msg_text = FILE_IS_NOT_EXISTS_STR;
|
||||
}
|
||||
else if (result == QIDI_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE || result == QIDI_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE) {
|
||||
msg_text = file_over_size_str;
|
||||
msg_text = FILE_OVER_SIZE_STR;
|
||||
}
|
||||
else if (result == QIDI_NETWORK_ERR_PRINT_WR_CHECK_MD5_FAILED || result == QIDI_NETWORK_ERR_PRINT_SP_CHECK_MD5_FAILED) {
|
||||
msg_text = failed_in_cloud_service_str;
|
||||
msg_text = FAILED_IN_CLOUD_SERVICE_STR;
|
||||
}
|
||||
else if (result == QIDI_NETWORK_ERR_PRINT_WR_GET_NOTIFICATION_TIMEOUT || result == QIDI_NETWORK_ERR_PRINT_SP_GET_NOTIFICATION_TIMEOUT) {
|
||||
msg_text = timeout_to_upload_str;
|
||||
msg_text = TIMEOUT_TO_UPLOAD_STR;
|
||||
}
|
||||
else if (result == QIDI_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || result == QIDI_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) {
|
||||
msg_text = upload_ftp_failed_str;
|
||||
msg_text = UPLOAD_FTP_FAILED_STR;
|
||||
}
|
||||
else if (result == QIDI_NETWORK_ERR_CANCELED) {
|
||||
msg_text = print_canceled_str;
|
||||
msg_text = PRINT_CANCELED_STR;
|
||||
}
|
||||
else {
|
||||
msg_text = send_print_failed_str;
|
||||
msg_text = SEND_PRINT_FAILED_STR;
|
||||
}
|
||||
|
||||
if (result != QIDI_NETWORK_ERR_CANCELED) {
|
||||
|
||||
@@ -25,7 +25,7 @@ void UpgradeNetworkJob::on_exception(const std::exception_ptr &eptr)
|
||||
try {
|
||||
if (eptr)
|
||||
std::rethrow_exception(eptr);
|
||||
} catch (std::exception &e) {
|
||||
} catch (std::exception &/*e*/) {
|
||||
UpgradeNetworkJob::on_exception(eptr);
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ void UpgradeNetworkJob::process()
|
||||
return was_canceled();
|
||||
};
|
||||
int curr_percent = 0;
|
||||
result = wxGetApp().download_plugin(name, package_name,
|
||||
result = wxGetApp().download_plugin(name, package_name,
|
||||
[this, &curr_percent](int state, int percent, bool &cancel) {
|
||||
if (state == InstallStatusNormal) {
|
||||
update_status(percent, _L("Downloading"));
|
||||
|
||||
Reference in New Issue
Block a user