Merge remote-tracking branch 'remote/master' into feature/merge_upstream

# Conflicts:
#	bbl/i18n/OrcaSlicer.pot
#	bbl/i18n/de/OrcaSlicer_de.po
#	bbl/i18n/en/OrcaSlicer_en.po
#	bbl/i18n/es/OrcaSlicer_es.po
#	bbl/i18n/fr/OrcaSlicer_fr.po
#	bbl/i18n/hu/OrcaSlicer_hu.po
#	bbl/i18n/it/OrcaSlicer_it.po
#	bbl/i18n/ja/OrcaSlicer_ja.po
#	bbl/i18n/nl/OrcaSlicer_nl.po
#	bbl/i18n/sv/OrcaSlicer_sv.po
#	bbl/i18n/zh_cn/OrcaSlicer_zh_CN.po
#	resources/config.json
#	resources/i18n/de/BambuStudio.mo
#	resources/i18n/en/BambuStudio.mo
#	resources/i18n/es/BambuStudio.mo
#	resources/i18n/fr/BambuStudio.mo
#	resources/i18n/hu/BambuStudio.mo
#	resources/i18n/it/BambuStudio.mo
#	resources/i18n/ja/OrcaSlicer.mo
#	resources/i18n/nl/BambuStudio.mo
#	resources/i18n/sv/BambuStudio.mo
#	resources/i18n/zh_cn/BambuStudio.mo
#	resources/images/ams_humidity_2.svg
#	resources/images/ams_humidity_3.svg
#	resources/images/ams_humidity_4.svg
#	resources/images/ams_humidity_tips.svg
#	resources/images/monitor_state_on.svg
#	resources/images/sdcard_state_normal.svg
#	resources/profiles/BBL.json
#	resources/profiles/BBL/filament/Bambu PETG-CF @base.json
#	resources/profiles/BBL/filament/Generic PETG-CF @base.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json
#	resources/web/data/text.js
#	resources/web/guide/3/index.html
#	resources/web/guide/31/index.html
#	src/BambuStudio.cpp
#	src/libslic3r/AABBTreeLines.hpp
#	src/libslic3r/Brim.cpp
#	src/libslic3r/CMakeLists.txt
#	src/libslic3r/ExPolygon.hpp
#	src/libslic3r/Fill/FillBase.hpp
#	src/libslic3r/Format/bbs_3mf.cpp
#	src/libslic3r/GCodeWriter.cpp
#	src/libslic3r/Line.hpp
#	src/libslic3r/PerimeterGenerator.cpp
#	src/libslic3r/Preset.cpp
#	src/libslic3r/Print.cpp
#	src/libslic3r/Print.hpp
#	src/libslic3r/PrintConfig.cpp
#	src/libslic3r/PrintConfig.hpp
#	src/libslic3r/TreeSupport.cpp
#	src/slic3r/GUI/AmsMappingPopup.cpp
#	src/slic3r/GUI/BackgroundSlicingProcess.cpp
#	src/slic3r/GUI/ConfigManipulation.cpp
#	src/slic3r/GUI/GCodeViewer.cpp
#	src/slic3r/GUI/GCodeViewer.hpp
#	src/slic3r/GUI/GLCanvas3D.cpp
#	src/slic3r/GUI/GUI_App.cpp
#	src/slic3r/GUI/MainFrame.cpp
#	src/slic3r/GUI/PartPlate.cpp
#	src/slic3r/GUI/Plater.cpp
#	src/slic3r/GUI/Preferences.cpp
#	src/slic3r/GUI/SelectMachine.cpp
#	src/slic3r/GUI/Widgets/AMSControl.cpp
#	src/slic3r/GUI/wxMediaCtrl2.cpp
#	src/slic3r/Utils/Process.cpp
#	version.inc
This commit is contained in:
SoftFever 2023-04-19 08:48:07 +08:00
commit 9f598046d1
658 changed files with 70312 additions and 4877 deletions

View file

@ -241,9 +241,15 @@ void ArrangeJob::prepare_all() {
}
// 准备料塔。逻辑如下:
// 1. 如果料塔被禁用,或是逐件打印,则不需要料塔
// 2. 以下两种情况需要料塔1某对象是多色对象2打开了支撑且支撑体与接触面使用的是不同材料
// 3. 如果允许不同材料落在相同盘则以下情况也需要料塔1所有选定对象中使用了多种热床温度相同的材料比如颜色不同的PLA
// 1. 以下几种情况不需要料塔:
// 1料塔被禁用
// 2逐件打印
// 3不允许不同材料落在相同盘且没有多色对象
// 2. 以下情况需要料塔:
// 1某对象是多色对象
// 2打开了支撑且支撑体与接触面使用的是不同材料
// 3允许不同材料落在相同盘且所有选定对象中使用了多种热床温度相同的材料
// 所有对象都是单色的但不同对象的材料不同例如对象A使用红色PLA对象B使用白色PLA
void ArrangeJob::prepare_wipe_tower()
{
bool need_wipe_tower = false;
@ -257,7 +263,7 @@ void ArrangeJob::prepare_wipe_tower()
// 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;
for (int id : item.extrude_ids) obj_extruders.insert(id);
obj_extruders.insert(item.extrude_ids.begin(), item.extrude_ids.end());
if (obj_extruders.size() > 1) {
need_wipe_tower = true;
BOOST_LOG_TRIVIAL(info) << "arrange: need wipe tower because object " << item.name << " has multiple extruders (has paint-on colors)";
@ -266,6 +272,7 @@ void ArrangeJob::prepare_wipe_tower()
}
// if multile extruders have same bed temp, we need wipe tower
// 允许不同材料落在相同盘,且所有选定对象中使用了多种热床温度相同的材料
if (params.allow_multi_materials_on_same_plate) {
std::map<int, std::set<int>> bedTemp2extruderIds;
for (const auto &item : m_selected)
@ -294,17 +301,19 @@ void ArrangeJob::prepare_wipe_tower()
}
// if wipe tower is not init yet (no wipe tower in any plate before arrangement)
if (wipe_tower_ap.poly.empty()) {
auto &print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
wipe_tower_ap.poly.contour.points = print.first_layer_wipe_tower_corners(false);
//if (wipe_tower_ap.poly.empty()) {
// auto &print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
// wipe_tower_ap.poly.contour.points = print.first_layer_wipe_tower_corners(false);
wipe_tower_ap.name = "WipeTower";
wipe_tower_ap.is_virt_object = true;
wipe_tower_ap.is_wipe_tower = true;
}
//}
const GLCanvas3D* canvas3D=static_cast<const GLCanvas3D *>(m_plater->canvas3D());
for (int bedid = 0; bedid < MAX_NUM_PLATES; bedid++) {
if (!plates_have_wipe_tower[bedid]) {
wipe_tower_ap.bed_idx = bedid;
wipe_tower_ap.translation = {0, 0};
wipe_tower_ap.poly.contour.points = canvas3D->estimate_wipe_tower_points(bedid, !only_on_partplate);
wipe_tower_ap.bed_idx = bedid;
m_unselected.emplace_back(wipe_tower_ap);
}
}
@ -502,7 +511,7 @@ void ArrangeJob::process()
auto& print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
if (params.is_seq_print)
params.min_obj_distance = std::max(params.min_obj_distance, scaled(params.cleareance_radius));
params.min_obj_distance = std::max(params.min_obj_distance, scaled(params.cleareance_radius + 0.001)); // +0.001mm to avoid clearance check fail due to rounding error
if (params.avoid_extrusion_cali_region && print.full_print_config().opt_bool("scan_first_layer"))
partplate_list.preprocess_nonprefered_areas(m_unselected, MAX_NUM_PLATES);
@ -750,6 +759,7 @@ void ArrangeJob::finalize() {
m_plater->update();
Job::finalize();
m_plater->m_arrange_running.store(false);
}
std::optional<arrangement::ArrangePolygon>

View file

@ -32,10 +32,11 @@ wxString get_login_fail_reason(std::string fail_reason)
return _L("Unknown Failure");
}
BindJob::BindJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id, std::string dev_ip)
BindJob::BindJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id, std::string dev_ip, std::string sec_link)
: PlaterJob{std::move(pri), plater},
m_dev_id(dev_id),
m_dev_ip(dev_ip)
m_dev_ip(dev_ip),
m_sec_link(sec_link)
{
;
}
@ -79,7 +80,7 @@ void BindJob::process()
long offset = tz.GetOffset();
std::string timezone = get_timezone_utc_hm(offset);
int result = m_agent->bind(m_dev_ip, timezone,
int result = m_agent->bind(m_dev_ip, m_dev_id, m_sec_link, timezone,
[this, &curr_percent, &msg](int stage, int code, std::string info) {
if (stage == BBL::BindJobStage::LoginStageConnect) {
curr_percent = 15;

View file

@ -16,13 +16,14 @@ class BindJob : public PlaterJob
std::function<void()> m_success_fun{nullptr};
std::string m_dev_id;
std::string m_dev_ip;
std::string m_sec_link;
bool m_job_finished{ false };
int m_print_job_completed_id = 0;
protected:
void on_exception(const std::exception_ptr &) override;
public:
BindJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id, std::string dev_ip);
BindJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id, std::string dev_ip, std::string sec_link);
int status_range() const override
{

View file

@ -35,6 +35,11 @@ void GUI::Job::update_percent_finish()
m_progress->clear_percent();
}
void GUI::Job::show_networking_test(wxString msg)
{
m_progress->show_networking_test(msg);
}
GUI::Job::Job(std::shared_ptr<ProgressIndicator> pri)
: m_progress(std::move(pri))
{

View file

@ -47,6 +47,8 @@ protected:
void update_percent_finish();
void show_networking_test(wxString msg);
bool was_canceled() const { return m_canceled.load(); }
// Launched just before start(), a job can use it to prepare internals

View file

@ -10,6 +10,11 @@ void NotificationProgressIndicator::clear_percent()
}
void NotificationProgressIndicator::show_networking_test(wxString msg)
{
}
void NotificationProgressIndicator::set_range(int range)
{
m_nm->progress_indicator_set_range(range);

View file

@ -15,6 +15,7 @@ public:
explicit NotificationProgressIndicator(NotificationManager *nm);
void clear_percent() override;
void show_networking_test(wxString msg) override;
void set_range(int range) override;
void set_cancel_callback(CancelFn = CancelFn()) override;
void set_progress(int pr) override;

View file

@ -110,6 +110,7 @@ void PrintJob::process()
{
/* display info */
wxString msg;
wxString error_str;
int curr_percent = 10;
NetworkAgent* m_agent = wxGetApp().getAgent();
AppConfig* config = wxGetApp().app_config;
@ -157,6 +158,10 @@ void PrintJob::process()
else
curr_plate_idx = m_plater->get_partplate_list().get_curr_plate_index() + 1;
PartPlate* curr_plate = m_plater->get_partplate_list().get_curr_plate();
if (curr_plate) {
this->task_bed_type = bed_type_to_gcode_string(curr_plate->get_bed_type(true));
}
BBL::PrintParams params;
@ -200,6 +205,7 @@ void PrintJob::process()
params.ams_mapping_info = this->task_ams_mapping_info;
params.connection_type = this->connection_type;
params.task_use_ams = this->task_use_ams;
params.task_bed_type = this->task_bed_type;
if (wxGetApp().model().model_info && wxGetApp().model().model_info.get()) {
ModelInfo* model_info = wxGetApp().model().model_info.get();
auto origin_profile_id = model_info->metadata_items.find(BBL_DESIGNER_PROFILE_ID_TAG);
@ -227,19 +233,22 @@ void PrintJob::process()
30, // PrintingStageUpload
70, // PrintingStageWaiting
75, // PrintingStageRecord
99, // PrintingStageSending
97, // PrintingStageSending
100 // PrintingStageFinished
};
auto update_fn = [this, &msg, &curr_percent, &error_text, StagePercentPoint](int stage, int code, std::string info) {
if (stage == BBL::SendingPrintJobStage::PrintingStageCreate) {
bool is_try_lan_mode = false;
bool is_try_lan_mode_failed = false;
auto update_fn = [this, &is_try_lan_mode, &is_try_lan_mode_failed, &msg, &error_str, &curr_percent, &error_text, StagePercentPoint](int stage, int code, std::string info) {
if (stage == BBL::SendingPrintJobStage::PrintingStageCreate && !is_try_lan_mode_failed) {
if (this->connection_type == "lan") {
msg = _L("Sending print job over LAN");
} else {
msg = _L("Sending print job through cloud service");
}
}
else if (stage == BBL::SendingPrintJobStage::PrintingStageUpload) {
else if (stage == BBL::SendingPrintJobStage::PrintingStageUpload && !is_try_lan_mode_failed) {
if (code >= 0 && code <= 100 && !info.empty()) {
if (this->connection_type == "lan") {
msg = _L("Sending print job over LAN");
@ -256,10 +265,10 @@ void PrintJob::process()
msg = _L("Sending print job through cloud service");
}
}
else if (stage == BBL::SendingPrintJobStage::PrintingStageRecord) {
else if (stage == BBL::SendingPrintJobStage::PrintingStageRecord && !is_try_lan_mode) {
msg = _L("Sending print configuration");
}
else if (stage == BBL::SendingPrintJobStage::PrintingStageSending) {
else if (stage == BBL::SendingPrintJobStage::PrintingStageSending && !is_try_lan_mode) {
if (this->connection_type == "lan") {
msg = _L("Sending print job over LAN");
} else {
@ -289,9 +298,11 @@ void PrintJob::process()
if (code > 100 || code < 0) {
error_text = this->get_http_error_msg(code, info);
msg += wxString::Format("[%s]", error_text);
error_str = wxString::Format("[%s]", error_text);
} else {
error_str = wxEmptyString;
}
this->update_status(curr_percent, msg);
this->update_status(curr_percent, msg + error_str);
};
auto cancel_fn = [this]() {
@ -319,6 +330,7 @@ void PrintJob::process()
else {
BOOST_LOG_TRIVIAL(info) << "print_job: use ftp send print only";
this->update_status(curr_percent, _L("Sending print job over LAN"));
is_try_lan_mode = true;
result = m_agent->start_local_print_with_record(params, update_fn, cancel_fn);
if (result < 0) {
error_text = wxString::Format("Access code:%s Ip address:%s", params.password, params.dev_ip);
@ -336,7 +348,10 @@ void PrintJob::process()
BOOST_LOG_TRIVIAL(info) << "print_job: try to start local print with record";
this->update_status(curr_percent, _L("Sending print job over LAN"));
result = m_agent->start_local_print_with_record(params, update_fn, cancel_fn);
if (result == BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED) {
if (result == 0) {
params.comments = "";
}
else if (result == BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED) {
params.comments = "wrong_code";
}
else if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
@ -346,6 +361,7 @@ void PrintJob::process()
params.comments = (boost::format("failed(%1%)") % result).str();
}
if (result < 0) {
is_try_lan_mode_failed = true;
// try to send with cloud
BOOST_LOG_TRIVIAL(warning) << "print_job: try to send with cloud";
this->update_status(curr_percent, _L("Sending print job through cloud service"));
@ -384,7 +400,7 @@ void PrintJob::process()
} else if (result == BAMBU_NETWORK_ERR_TIMEOUT) {
msg_text = timeout_to_upload_str;
} else if (result == BAMBU_NETWORK_ERR_INVALID_RESULT) {
msg_text = _L("Failed to send the print job. Please try again.");
msg_text = _L("Failed to send the print job. Please try again.");
} else if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
msg_text = _L("Failed to send the print job. Please try again.");
} else {
@ -394,7 +410,15 @@ void PrintJob::process()
curr_percent = 0;
msg_text += wxString::Format("[%d][%s]", result, error_text);
}
update_status(curr_percent, msg_text);
if (result == BAMBU_NETWORK_ERR_INVALID_RESULT) {
this->show_networking_test(msg_text);
}
else {
update_status(curr_percent, msg_text);
}
BOOST_LOG_TRIVIAL(error) << "print_job: failed, result = " << result;
} else {
BOOST_LOG_TRIVIAL(error) << "print_job: send ok.";

View file

@ -18,6 +18,7 @@ public:
virtual ~ProgressIndicator() = default;
virtual void clear_percent() = 0;
virtual void show_networking_test(wxString msg) = 0;
virtual void set_range(int range) = 0;
virtual void set_cancel_callback(CancelFn = CancelFn()) = 0;
virtual void set_progress(int pr) = 0;

View file

@ -162,9 +162,26 @@ void SendJob::process()
PartPlate* plate = m_plater->get_partplate_list().get_plate(job_data.plate_idx);
if (plate == nullptr) {
plate = m_plater->get_partplate_list().get_curr_plate();
if (plate == nullptr)
return;
if (job_data.plate_idx == PLATE_ALL_IDX) {
//all plate
for (int index = 0; index < total_plate_num; index++)
{
PartPlate* plate_n = m_plater->get_partplate_list().get_plate(index);
if (plate_n && plate_n->is_valid_gcode_file())
{
plate = plate_n;
break;
}
}
}
else {
plate = m_plater->get_partplate_list().get_curr_plate();
}
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);
return;
}
}
/* check gcode is valid */
@ -350,7 +367,7 @@ void SendJob::process()
}
if (result == BAMBU_NETWORK_ERR_WRONG_IP_ADDRESS) {
msg_text = _L("Failed uploading print file. Please enter ip address again.");
msg_text = timeout_to_upload_str;
}
update_status(curr_percent, msg_text);