Merge branch 'v1.7.2-remote'

Signed-off-by: SoftFever <softfeverever@gmail.com>

# Conflicts:
#	deps/ZLIB/ZLIB.cmake
#	localization/i18n/OrcaSlicer.pot
#	localization/i18n/de/OrcaSlicer_de.po
#	localization/i18n/en/OrcaSlicer_en.po
#	localization/i18n/es/OrcaSlicer_es.po
#	localization/i18n/fr/OrcaSlicer_fr.po
#	localization/i18n/hu/OrcaSlicer_hu.po
#	localization/i18n/it/OrcaSlicer_it.po
#	localization/i18n/ja/OrcaSlicer_ja.po
#	localization/i18n/ko/OrcaSlicer_ko.po
#	localization/i18n/list.txt
#	localization/i18n/nl/OrcaSlicer_nl.po
#	localization/i18n/sv/OrcaSlicer_sv.po
#	localization/i18n/zh_cn/OrcaSlicer_zh_CN.po
#	resources/calib/PressureAdvance/pa_pattern.3mf
#	resources/handy_models/Disc.stl
#	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/BambuStudio.mo
#	resources/i18n/ko/BambuStudio.mo
#	resources/i18n/nl/BambuStudio.mo
#	resources/i18n/sv/BambuStudio.mo
#	resources/i18n/zh_cn/BambuStudio.mo
#	resources/profiles/Anycubic.json
#	resources/profiles/Anycubic/machine/Anycubic Kobra 2 0.4 nozzle.json
#	resources/profiles/BBL.json
#	resources/profiles/BBL/filament/Bambu ASA @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/filament/Bambu ASA @BBL X1C 0.4 nozzle.json
#	resources/profiles/BBL/filament/Bambu ASA @BBL X1C.json
#	resources/profiles/BBL/filament/Bambu PA-CF @base.json
#	resources/profiles/BBL/filament/Bambu PA6-CF @BBL X1C.json
#	resources/profiles/BBL/filament/Bambu PA6-CF @base.json
#	resources/profiles/BBL/filament/Bambu PETG-CF @BBL X1C.json
#	resources/profiles/BBL/filament/Bambu Support W @BBL X1.json
#	resources/profiles/BBL/filament/Bambu TPU 95A @BBL X1.json
#	resources/profiles/BBL/filament/Generic HIPS @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/filament/Generic HIPS @BBL X1C.json
#	resources/profiles/BBL/filament/Generic PA-CF.json
#	resources/profiles/BBL/filament/Generic PC.json
#	resources/profiles/BBL/filament/Generic PETG-CF @BBL X1C.json
#	resources/profiles/BBL/filament/Generic PLA @0.2 nozzle.json
#	resources/profiles/BBL/filament/Generic PLA High Speed @BBL P1P 0.2 nozzle.json
#	resources/profiles/BBL/filament/Generic PLA High Speed @BBL P1P.json
#	resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C.json
#	resources/profiles/BBL/filament/Generic PLA-CF.json
#	resources/profiles/BBL/filament/Generic PLA.json
#	resources/profiles/BBL/filament/Generic TPU.json
#	resources/profiles/BBL/filament/Overture Matte PLA @BBL P1P 0.2 nozzle.json
#	resources/profiles/BBL/filament/Overture Matte PLA @BBL P1P.json
#	resources/profiles/BBL/filament/Overture Matte PLA @BBL X1.json
#	resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C.json
#	resources/profiles/BBL/filament/Overture Matte PLA @base.json
#	resources/profiles/BBL/filament/Overture PLA @BBL P1P 0.2 nozzle.json
#	resources/profiles/BBL/filament/Overture PLA @BBL P1P.json
#	resources/profiles/BBL/filament/Overture PLA @BBL X1.json
#	resources/profiles/BBL/filament/Overture PLA @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/filament/Overture PLA @BBL X1C.json
#	resources/profiles/BBL/filament/Overture PLA @base.json
#	resources/profiles/BBL/filament/P1P/Bambu TPU 95A @BBL P1P.json
#	resources/profiles/BBL/filament/P1P/Generic PLA @BBL P1P 0.2 nozzle.json
#	resources/profiles/BBL/filament/P1P/Generic TPU @BBL P1P.json
#	resources/profiles/BBL/filament/P1P/eSUN PLA+ @BBL P1P 0.2 nozzle.json
#	resources/profiles/BBL/filament/P1P/eSUN PLA+ @BBL P1P.json
#	resources/profiles/BBL/filament/PolyLite ABS @BBL P1P 0.2 nozzle.json
#	resources/profiles/BBL/filament/PolyLite ABS @BBL P1P.json
#	resources/profiles/BBL/filament/PolyLite ABS @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/filament/PolyLite ABS @BBL X1C.json
#	resources/profiles/BBL/filament/PolyLite ABS @base.json
#	resources/profiles/BBL/filament/PolyLite ASA @BBL P1P 0.2 nozzle.json
#	resources/profiles/BBL/filament/PolyLite ASA @BBL P1P.json
#	resources/profiles/BBL/filament/PolyLite ASA @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/filament/PolyLite ASA @BBL X1C.json
#	resources/profiles/BBL/filament/PolyLite ASA @base.json
#	resources/profiles/BBL/filament/PolyLite PETG @BBL P1P 0.2 nozzle.json
#	resources/profiles/BBL/filament/PolyLite PETG @BBL P1P.json
#	resources/profiles/BBL/filament/PolyLite PETG @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/filament/PolyLite PETG @BBL X1C.json
#	resources/profiles/BBL/filament/PolyLite PETG @base.json
#	resources/profiles/BBL/filament/PolyLite PLA @BBL X1.json
#	resources/profiles/BBL/filament/PolyTerra PLA @BBL X1.json
#	resources/profiles/BBL/filament/eSUN PLA+ @BBL X1.json
#	resources/profiles/BBL/filament/eSUN PLA+ @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/filament/eSUN PLA+ @BBL X1C.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.2 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.6 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1P 0.8 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1S 0.2 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1S 0.6 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab P1S 0.8 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 0.2 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 0.6 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 0.8 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.2 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.6 nozzle.json
#	resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.8 nozzle.json
#	resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json
#	resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/process/0.08mm Extra Fine @BBL P1P.json
#	resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json
#	resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/process/0.10mm Standard @BBL P1P 0.2 nozzle.json
#	resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/process/0.12mm Fine @BBL P1P.json
#	resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json
#	resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json
#	resources/profiles/BBL/process/0.16mm Optimal @BBL P1P.json
#	resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json
#	resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json
#	resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json
#	resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json
#	resources/profiles/BBL/process/0.20mm Strength @BBL P1P.json
#	resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json
#	resources/profiles/BBL/process/0.24mm Draft @BBL P1P.json
#	resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json
#	resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json
#	resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json
#	resources/profiles/BBL/process/0.28mm Extra Draft @BBL P1P.json
#	resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json
#	resources/profiles/BBL/process/0.30mm Standard @BBL P1P 0.6 nozzle.json
#	resources/profiles/BBL/process/0.30mm Standard @BBL X1 0.6 nozzle.json
#	resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json
#	resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json
#	resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json
#	resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json
#	resources/profiles/BBL/process/0.40mm Standard @BBL P1P 0.8 nozzle.json
#	resources/profiles/BBL/process/0.40mm Standard @BBL X1 0.8 nozzle.json
#	resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json
#	resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json
#	resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json
#	resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json
#	resources/profiles/BBL/process/fdm_process_bbl_common.json
#	resources/profiles/Creality.json
#	resources/profiles/Creality/machine/Creality CR-10 Max 0.4 nozzle.json
#	resources/profiles/Creality/machine/Creality CR-10 V2 0.4 nozzle.json
#	resources/profiles/Creality/machine/Creality CR-6 Max 0.2 nozzle.json
#	resources/profiles/Creality/machine/Creality CR-6 Max 0.4 nozzle.json
#	resources/profiles/Creality/machine/Creality CR-6 Max 0.6 nozzle.json
#	resources/profiles/Creality/machine/Creality CR-6 Max 0.8 nozzle.json
#	resources/profiles/Creality/machine/Creality CR-6 SE 0.2 nozzle.json
#	resources/profiles/Creality/machine/Creality CR-6 SE 0.4 nozzle.json
#	resources/profiles/Creality/machine/Creality CR-6 SE 0.6 nozzle.json
#	resources/profiles/Creality/machine/Creality CR-6 SE 0.8 nozzle.json
#	resources/profiles/Creality/machine/Creality Ender-3 S1 0.4 nozzle.json
#	resources/profiles/Creality/machine/Creality Ender-3 S1 Pro 0.4 nozzle.json
#	resources/profiles/Creality/machine/Creality Ender-5 0.4 nozzle.json
#	resources/profiles/Creality/machine/Creality Ender-5 Plus 0.4 nozzle.json
#	resources/profiles/Creality/machine/Creality Ender-5 S1 0.4 nozzle.json
#	resources/profiles/Creality/machine/Creality Ender-5S 0.4 nozzle.json
#	resources/profiles/Creality/machine/Creality Ender-6 0.4 nozzle.json
#	resources/profiles/Elegoo.json
#	resources/profiles/Elegoo/machine/Elegoo Neptune 0.4 nozzle.json
#	resources/profiles/Elegoo/machine/Elegoo Neptune 2 0.4 nozzle.json
#	resources/profiles/Elegoo/machine/Elegoo Neptune 2D 0.4 nozzle.json
#	resources/profiles/Elegoo/machine/Elegoo Neptune 2S 0.4 nozzle.json
#	resources/profiles/Elegoo/machine/Elegoo Neptune 3 0.4 nozzle.json
#	resources/profiles/Elegoo/machine/Elegoo Neptune 3 Max 0.4 nozzle.json
#	resources/profiles/Elegoo/machine/Elegoo Neptune 3 Plus 0.4 nozzle.json
#	resources/profiles/Elegoo/machine/Elegoo Neptune 3 Pro 0.4 nozzle.json
#	resources/profiles/Elegoo/machine/Elegoo Neptune X 0.4 nozzle.json
#	resources/profiles/Prusa.json
#	resources/profiles/Prusa/machine/Prusa MINI 0.4 nozzle.json
#	resources/profiles/Prusa/machine/Prusa MK3S 0.4 nozzle.json
#	resources/profiles/Qidi/machine/Qidi X-CF Pro 0.4 nozzle.json
#	resources/profiles/Qidi/machine/Qidi X-Max 0.4 nozzle.json
#	resources/profiles/Qidi/machine/Qidi X-Max 3 0.4 nozzle.json
#	resources/profiles/Qidi/machine/Qidi X-Plus 0.4 nozzle.json
#	resources/profiles/Qidi/machine/Qidi X-Plus 3 0.4 nozzle.json
#	resources/profiles/Qidi/machine/Qidi X-Smart 3 0.4 nozzle.json
#	resources/profiles/Tronxy.json
#	resources/profiles/Tronxy/machine/Tronxy X5SA 400 0.4 nozzle.json
#	resources/profiles/Tronxy/process/0.08mm Extra Fine @Tronxy.json
#	resources/profiles/Tronxy/process/0.12mm Fine @Tronxy.json
#	resources/profiles/Tronxy/process/0.15mm Optimal @Tronxy.json
#	resources/profiles/Tronxy/process/0.20mm Standard @Tronxy.json
#	resources/profiles/Tronxy/process/0.24mm Draft @Tronxy.json
#	resources/profiles/Tronxy/process/0.28mm Extra Draft @Tronxy.json
#	resources/profiles/Voxelab/machine/Voxelab Aquila X2 0.4 nozzle.json
#	resources/web/data/text.js
#	src/OrcaSlicer.cpp
#	src/libslic3r/GCode.cpp
#	src/libslic3r/GCode/SeamPlacer.cpp
#	src/libslic3r/GCode/SeamPlacer.hpp
#	src/libslic3r/GCodeWriter.cpp
#	src/libslic3r/GCodeWriter.hpp
#	src/libslic3r/Preset.cpp
#	src/libslic3r/PresetBundle.cpp
#	src/libslic3r/Print.cpp
#	src/libslic3r/PrintConfig.cpp
#	src/libslic3r/PrintConfig.hpp
#	src/libslic3r/TreeSupport.cpp
#	src/libslic3r/calib.cpp
#	src/libslic3r/calib.hpp
#	src/slic3r/GUI/BackgroundSlicingProcess.cpp
#	src/slic3r/GUI/BedShapeDialog.cpp
#	src/slic3r/GUI/ConfigManipulation.cpp
#	src/slic3r/GUI/GUI.cpp
#	src/slic3r/GUI/GUI_App.cpp
#	src/slic3r/GUI/GUI_Factories.cpp
#	src/slic3r/GUI/GUI_ObjectList.cpp
#	src/slic3r/GUI/Jobs/ArrangeJob.cpp
#	src/slic3r/GUI/OptionsGroup.cpp
#	src/slic3r/GUI/PartPlate.cpp
#	src/slic3r/GUI/PartPlate.hpp
#	src/slic3r/GUI/Plater.cpp
#	src/slic3r/GUI/StatusPanel.cpp
#	src/slic3r/GUI/Tab.cpp
#	src/slic3r/GUI/Widgets/AMSControl.hpp
#	version.inc
This commit is contained in:
SoftFever 2023-09-29 19:46:49 +08:00
commit b8172316b8
608 changed files with 23446 additions and 10493 deletions

View file

@ -1,5 +1,5 @@
#include "CalibUtils.hpp"
#include "../GUI/I18N.hpp"
#include "../GUI/GUI_App.hpp"
#include "../GUI/DeviceManager.hpp"
#include "../GUI/Jobs/ProgressIndicator.hpp"
@ -28,6 +28,10 @@ static std::string MachineBedTypeString[5] = {
std::string get_calib_mode_name(CalibMode cali_mode, int stage)
{
switch(cali_mode) {
case CalibMode::Calib_PA_Line:
return "pa_line_calib_mode";
case CalibMode::Calib_PA_Pattern:
return "pa_pattern_calib_mode";
case CalibMode::Calib_Flow_Rate:
if (stage == 1)
return "flow_rate_coarse_calib_mode";
@ -51,7 +55,15 @@ std::string get_calib_mode_name(CalibMode cali_mode, int stage)
CalibMode CalibUtils::get_calib_mode_by_name(const std::string name, int& cali_stage)
{
if (name == "flow_rate_coarse_calib_mode") {
if (name == "pa_line_calib_mode") {
cali_stage = 0;
return CalibMode::Calib_PA_Line;
}
else if (name == "pa_pattern_calib_mode") {
cali_stage = 1;
return CalibMode::Calib_PA_Line;
}
else if (name == "flow_rate_coarse_calib_mode") {
cali_stage = 1;
return CalibMode::Calib_Flow_Rate;
}
@ -170,7 +182,7 @@ std::array<Vec3d, 4> get_cut_plane_points(const BoundingBoxf3 &bbox, const doubl
return plane_pts;
}
void CalibUtils::calib_PA(const X1CCalibInfos& calib_infos, int mode, std::string& error_message)
void CalibUtils::calib_PA(const X1CCalibInfos& calib_infos, int mode, wxString& error_message)
{
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev)
@ -348,7 +360,7 @@ bool CalibUtils::get_flow_ratio_calib_results(std::vector<FlowRatioCalibResult>&
return flow_ratio_calib_results.size() > 0;
}
void CalibUtils::calib_flowrate(int pass, const CalibInfo& calib_info, std::string& error_message)
void CalibUtils::calib_flowrate(int pass, const CalibInfo &calib_info, wxString &error_message)
{
if (pass != 1 && pass != 2)
return;
@ -443,16 +455,78 @@ void CalibUtils::calib_flowrate(int pass, const CalibInfo& calib_info, std::stri
send_to_print(calib_info, error_message, pass);
}
void CalibUtils::calib_generic_PA(const CalibInfo &calib_info, std::string &error_message)
void CalibUtils::calib_pa_pattern(const CalibInfo &calib_info, Model& model)
{
DynamicPrintConfig& print_config = calib_info.print_prest->config;
DynamicPrintConfig& filament_config = calib_info.filament_prest->config;
DynamicPrintConfig& printer_config = calib_info.printer_prest->config;
DynamicPrintConfig full_config;
full_config.apply(FullPrintConfig::defaults());
full_config.apply(print_config);
full_config.apply(filament_config);
full_config.apply(printer_config);
float nozzle_diameter = printer_config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(0);
for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) {
print_config.set_key_value(opt.first, new ConfigOptionFloat(opt.second));
}
print_config.set_key_value("outer_wall_speed",
new ConfigOptionFloat(CalibPressureAdvance::find_optimal_PA_speed(
full_config, print_config.get_abs_value("line_width"),
print_config.get_abs_value("layer_height"), 0)));
for (const auto opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) {
print_config.set_key_value(opt.first, new ConfigOptionFloat(nozzle_diameter * opt.second / 100));
}
for (const auto opt : SuggestedConfigCalibPAPattern().int_pairs) {
print_config.set_key_value(opt.first, new ConfigOptionInt(opt.second));
}
print_config.set_key_value(SuggestedConfigCalibPAPattern().brim_pair.first,
new ConfigOptionEnum<BrimType>(SuggestedConfigCalibPAPattern().brim_pair.second));
//DynamicPrintConfig full_config;
full_config.apply(FullPrintConfig::defaults());
full_config.apply(print_config);
full_config.apply(filament_config);
full_config.apply(printer_config);
Vec3d plate_origin(0, 0, 0);
CalibPressureAdvancePattern pa_pattern(calib_info.params, full_config, true, model, plate_origin);
Pointfs bedfs = full_config.opt<ConfigOptionPoints>("printable_area")->values;
double current_width = bedfs[2].x() - bedfs[0].x();
double current_depth = bedfs[2].y() - bedfs[0].y();
Vec3d half_pattern_size = Vec3d(pa_pattern.print_size_x() / 2, pa_pattern.print_size_y() / 2, 0);
Vec3d offset = Vec3d(current_width / 2, current_depth / 2, 0) - half_pattern_size;
pa_pattern.set_start_offset(offset);
pa_pattern.generate_custom_gcodes(full_config, true, model, plate_origin);
model.calib_pa_pattern = std::make_unique<CalibPressureAdvancePattern>(pa_pattern);
}
void CalibUtils::calib_generic_PA(const CalibInfo &calib_info, wxString &error_message)
{
const Calib_Params &params = calib_info.params;
if (params.mode != CalibMode::Calib_PA_Line)
if (params.mode != CalibMode::Calib_PA_Line && params.mode != CalibMode::Calib_PA_Pattern)
return;
Model model;
std::string input_file = Slic3r::resources_dir() + "/calib/pressure_advance/pressure_advance_test.stl";
std::string input_file;
if (params.mode == CalibMode::Calib_PA_Line)
input_file = Slic3r::resources_dir() + "/calib/pressure_advance/pressure_advance_test.stl";
else if (params.mode == CalibMode::Calib_PA_Pattern)
input_file = Slic3r::resources_dir() + "/calib/pressure_advance/pa_pattern.3mf";
read_model_from_file(input_file, model);
if (params.mode == CalibMode::Calib_PA_Pattern)
calib_pa_pattern(calib_info, model);
DynamicPrintConfig print_config = calib_info.print_prest->config;
DynamicPrintConfig filament_config = calib_info.filament_prest->config;
DynamicPrintConfig printer_config = calib_info.printer_prest->config;
@ -472,7 +546,7 @@ void CalibUtils::calib_generic_PA(const CalibInfo &calib_info, std::string &erro
send_to_print(calib_info, error_message);
}
void CalibUtils::calib_temptue(const CalibInfo& calib_info, std::string& error_message)
void CalibUtils::calib_temptue(const CalibInfo &calib_info, wxString &error_message)
{
const Calib_Params &params = calib_info.params;
if (params.mode != CalibMode::Calib_Temp_Tower)
@ -542,7 +616,7 @@ void CalibUtils::calib_temptue(const CalibInfo& calib_info, std::string& error_m
send_to_print(calib_info, error_message);
}
void CalibUtils::calib_max_vol_speed(const CalibInfo& calib_info, std::string& error_message)
void CalibUtils::calib_max_vol_speed(const CalibInfo &calib_info, wxString &error_message)
{
const Calib_Params &params = calib_info.params;
if (params.mode != CalibMode::Calib_Vol_speed_Tower)
@ -621,7 +695,7 @@ void CalibUtils::calib_max_vol_speed(const CalibInfo& calib_info, std::string& e
send_to_print(calib_info, error_message);
}
void CalibUtils::calib_VFA(const CalibInfo& calib_info, std::string& error_message)
void CalibUtils::calib_VFA(const CalibInfo &calib_info, wxString &error_message)
{
const Calib_Params &params = calib_info.params;
if (params.mode != CalibMode::Calib_VFA_Tower)
@ -662,7 +736,7 @@ void CalibUtils::calib_VFA(const CalibInfo& calib_info, std::string& error_messa
cut_model(model, plane_pts, ModelObjectCutAttribute::KeepLower);
}
else {
error_message = L("The start, end or step is not valid value.");
error_message = _L("The start, end or step is not valid value.");
return;
}
@ -679,7 +753,7 @@ void CalibUtils::calib_VFA(const CalibInfo& calib_info, std::string& error_messa
send_to_print(calib_info, error_message);
}
void CalibUtils::calib_retraction(const CalibInfo &calib_info, std::string &error_message)
void CalibUtils::calib_retraction(const CalibInfo &calib_info, wxString &error_message)
{
const Calib_Params &params = calib_info.params;
if (params.mode != CalibMode::Calib_Retraction_tower)
@ -752,7 +826,7 @@ bool CalibUtils::get_pa_k_n_value_by_cali_idx(const MachineObject *obj, int cali
return false;
}
void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, std::string& error_message)
void CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &full_config, const Calib_Params &params, wxString &error_message)
{
Pointfs bedfs = full_config.opt<ConfigOptionPoints>("printable_area")->values;
double print_height = full_config.opt_float("printable_height");
@ -763,8 +837,13 @@ void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& f
plate_size[1] = bedfs[2].y() - bedfs[0].y();
plate_size[2] = print_height;
// todo: adjust the objects position
if (model->objects.size() == 1) {
if (params.mode == CalibMode::Calib_PA_Pattern) {
ModelInstance *instance = model->objects[0]->instances[0];
Vec3d offset = model->calib_pa_pattern->get_start_offset() +
Vec3d(model->calib_pa_pattern->handle_xy_size() / 2, -model->calib_pa_pattern->handle_xy_size() / 2 - model->calib_pa_pattern->handle_spacing(), 0);
instance->set_offset(offset);
}
else if (model->objects.size() == 1) {
ModelInstance *instance = model->objects[0]->instances[0];
instance->set_offset(instance->get_offset() + Vec3d(current_width / 2, current_depth / 2, 0));
} else {
@ -789,7 +868,7 @@ void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& f
BuildVolume build_volume(bedfs, print_height);
unsigned int count = model->update_print_volume_state(build_volume);
if (count == 0) {
error_message = L("Unable to calibrate: maybe because the set calibration value range is too large, or the step is too small");
error_message = _L("Unable to calibrate: maybe because the set calibration value range is too large, or the step is too small");
return;
}
@ -898,8 +977,25 @@ void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& f
release_PlateData_list(plate_data_list);
}
void CalibUtils::send_to_print(const CalibInfo &calib_info, std::string &error_message, int flow_ratio_mode)
void CalibUtils::send_to_print(const CalibInfo &calib_info, wxString &error_message, int flow_ratio_mode)
{
{ // before send
json j;
j["print"]["cali_mode"] = calib_info.params.mode;
j["print"]["start"] = calib_info.params.start;
j["print"]["end"] = calib_info.params.end;
j["print"]["step"] = calib_info.params.step;
j["print"]["print_numbers"] = calib_info.params.print_numbers;
j["print"]["flow_ratio_mode"] = flow_ratio_mode;
j["print"]["tray_id"] = calib_info.select_ams;
j["print"]["dev_id"] = calib_info.dev_id;
j["print"]["bed_type"] = calib_info.bed_type;
j["print"]["printer_prest"] = calib_info.printer_prest ? calib_info.printer_prest->name : "";
j["print"]["filament_prest"] = calib_info.filament_prest ? calib_info.filament_prest->name : "";
j["print"]["print_prest"] = calib_info.print_prest ? calib_info.print_prest->name : "";
BOOST_LOG_TRIVIAL(info) << "send_cali_job - before send: " << j.dump();
}
std::string dev_id = calib_info.dev_id;
std::string select_ams = calib_info.select_ams;
std::shared_ptr<ProgressIndicator> process_bar = calib_info.process_bar;
@ -907,35 +1003,35 @@ void CalibUtils::send_to_print(const CalibInfo &calib_info, std::string &error_m
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) {
error_message = L("Need select printer");
error_message = _L("Need select printer");
return;
}
MachineObject* obj_ = dev->get_selected_machine();
if (obj_ == nullptr) {
error_message = L("Need select printer");
error_message = _L("Need select printer");
return;
}
if (obj_->is_in_upgrading()) {
error_message = L("Cannot send the print job when the printer is updating firmware");
error_message = _L("Cannot send the print job when the printer is updating firmware");
return;
}
else if (obj_->is_system_printing()) {
error_message = L("The printer is executing instructions. Please restart printing after it ends");
error_message = _L("The printer is executing instructions. Please restart printing after it ends");
return;
}
else if (obj_->is_in_printing()) {
error_message = L("The printer is busy on other print job");
error_message = _L("The printer is busy on other print job");
return;
}
else if (!obj_->is_function_supported(PrinterFunction::FUNC_PRINT_WITHOUT_SD) && (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD)) {
error_message = L("An SD card needs to be inserted before printing.");
error_message = _L("An SD card needs to be inserted before printing.");
return;
}
if (obj_->is_lan_mode_printer()) {
if (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD) {
error_message = L("An SD card needs to be inserted before printing via LAN.");
error_message = _L("An SD card needs to be inserted before printing via LAN.");
return;
}
}
@ -978,23 +1074,19 @@ void CalibUtils::send_to_print(const CalibInfo &calib_info, std::string &error_m
print_job->task_ams_mapping_info = "";
print_job->task_use_ams = select_ams == "[254]" ? false : true;
CalibMode cali_mode = calib_info.params.mode;
CalibMode cali_mode = calib_info.params.mode;
print_job->m_project_name = get_calib_mode_name(cali_mode, flow_ratio_mode);
print_job->set_calibration_task(true);
print_job->has_sdcard = obj_->has_sdcard();
print_job->set_print_config(MachineBedTypeString[bed_type], true, false, false, false, true);
print_job->set_print_job_finished_event(wxGetApp().plater()->get_send_calibration_finished_event(), print_job->m_project_name);
{ // record the print job
{ // after send: record the print job
json j;
j["print"]["cali_type"] = calib_info.params.mode;
j["print"]["flow_ratio_mode"] = flow_ratio_mode;
j["print"]["tray_id"] = calib_info.select_ams;
j["print"]["dev_id"] = calib_info.dev_id;
j["print"]["start"] = calib_info.params.start;
j["print"]["end"] = calib_info.params.end;
j["print"]["step"] = calib_info.params.step;
BOOST_LOG_TRIVIAL(trace) << "send_cali_job: " << j.dump();
j["print"]["project_name"] = print_job->m_project_name;
j["print"]["is_cali_task"] = print_job->m_is_calibration_task;
BOOST_LOG_TRIVIAL(info) << "send_cali_job - after send: " << j.dump();
}
print_job->start();