mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-03-10 13:27:07 -06:00
ENH: support multi-color with external
Jira: [STUDIO-12520] Change-Id: I34c88b6a84514a0e56e65723f91d1a2940128e8d (cherry picked from commit b8879ec648e038080628190fc363251229bbd5ee)
This commit is contained in:
parent
ca87a0a395
commit
a7ad18e66e
8 changed files with 75 additions and 8 deletions
|
|
@ -6397,6 +6397,7 @@ void MachineObject::parse_new_info(json print)
|
|||
is_support_airprinting_detection = get_flag_bits(fun, 45);
|
||||
|
||||
m_air_duct_data.m_support_cooling_filter = get_flag_bits(fun, 46);
|
||||
is_support_ext_change_assist = get_flag_bits(fun, 48);
|
||||
}
|
||||
|
||||
/*aux*/
|
||||
|
|
|
|||
|
|
@ -1132,6 +1132,7 @@ public:
|
|||
bool is_support_internal_timelapse { false };// fun[28], support timelapse without SD card
|
||||
bool is_support_command_homing { false };// fun[32]
|
||||
bool is_support_brtc{false}; // fun[31], support tcp and upload protocol
|
||||
bool is_support_ext_change_assist{false};
|
||||
|
||||
// refine printer function options
|
||||
bool is_support_spaghetti_detection{false};
|
||||
|
|
|
|||
|
|
@ -241,6 +241,7 @@ void PrintJob::process(Ctl &ctl)
|
|||
params.auto_bed_leveling = this->auto_bed_leveling;
|
||||
params.auto_flow_cali = this->auto_flow_cali;
|
||||
params.auto_offset_cali = this->auto_offset_cali;
|
||||
params.task_ext_change_assist = this->task_ext_change_assist;
|
||||
|
||||
if (m_print_type == "from_sdcard_view") {
|
||||
params.dst_file = m_dst_path;
|
||||
|
|
|
|||
|
|
@ -82,12 +82,13 @@ public:
|
|||
bool cloud_print_only { false };
|
||||
bool has_sdcard { false };
|
||||
bool task_use_ams { true };
|
||||
bool task_ext_change_assist { false };
|
||||
|
||||
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,
|
||||
void set_print_config(std::string bed_type, bool bed_leveling, bool flow_cali, bool vabration_cali, bool record_timelapse, bool layer_inspect, bool ext_change_assist,
|
||||
int auto_bed_levelingt,
|
||||
int auto_flow_calit,
|
||||
int auto_offset_calit)
|
||||
|
|
@ -98,10 +99,12 @@ public:
|
|||
task_vibration_cali = vabration_cali;
|
||||
task_record_timelapse = record_timelapse;
|
||||
task_layer_inspect = layer_inspect;
|
||||
task_ext_change_assist = ext_change_assist;
|
||||
|
||||
auto_bed_leveling = auto_bed_levelingt;
|
||||
auto_flow_cali = auto_flow_calit;
|
||||
auto_offset_cali = auto_offset_calit;
|
||||
|
||||
}
|
||||
|
||||
int status_range() const
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
#include "Widgets/ProgressDialog.hpp"
|
||||
#include "Widgets/RoundedRectangle.hpp"
|
||||
#include "Widgets/StaticBox.hpp"
|
||||
#include "Widgets/CheckBox.hpp"
|
||||
#include "Widgets/Label.hpp"
|
||||
#include "ConnectPrinter.hpp"
|
||||
#include "Jobs/BoostThreadWorker.hpp"
|
||||
#include "Jobs/PlaterWorker.hpp"
|
||||
|
|
@ -421,6 +423,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||
m_statictext_ams_msg->Hide();
|
||||
|
||||
/*ams mapping suggestions*/
|
||||
|
||||
m_link_edit_nozzle = new Label(m_scroll_area, wxEmptyString);
|
||||
m_link_edit_nozzle->SetFont(::Label::Body_13);
|
||||
m_link_edit_nozzle->SetForegroundColour(0x00ae42);
|
||||
|
|
@ -443,6 +446,24 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||
wxPostEvent(plater, evt);
|
||||
});
|
||||
|
||||
m_check_ext_change_assist = new CheckBox(m_scroll_area, wxID_ANY);
|
||||
m_check_ext_change_assist->SetValue(false);
|
||||
m_check_ext_change_assist->SetBackgroundColour(*wxWHITE);
|
||||
m_check_ext_change_assist->SetToolTip(_L("Manually change external spool during printing for multi-color printing"));
|
||||
m_check_ext_change_assist->Hide();
|
||||
m_label_ext_change_assist = new Label(m_scroll_area, _L("Multi-color with external"));
|
||||
m_label_ext_change_assist->Wrap(-1);
|
||||
m_label_ext_change_assist->SetMaxSize(wxSize(FromDIP(200), -1));
|
||||
m_label_ext_change_assist->SetFont(::Label::Body_13);
|
||||
m_label_ext_change_assist->SetBackgroundColour(*wxWHITE);
|
||||
m_label_ext_change_assist->SetToolTip(_L("Manually change external spool during printing for multi-color printing"));
|
||||
|
||||
wxSizer* suggestion_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
suggestion_sizer->Add(m_link_edit_nozzle, 0, wxLEFT, 0);
|
||||
suggestion_sizer->Add(0, 0, 1, wxEXPAND, 0);
|
||||
suggestion_sizer->Add(m_check_ext_change_assist, 0, wxRIGHT, FromDIP(10));
|
||||
suggestion_sizer->Add(m_label_ext_change_assist, 0, wxRIGHT, 0);
|
||||
|
||||
m_mapping_sugs_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
//auto m_img_mapping_sugs = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("warning", this, 16), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)));
|
||||
auto m_txt_mapping_sugs = new Label(m_scroll_area, wxEmptyString);
|
||||
|
|
@ -518,7 +539,6 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||
m_checkbox_list["bed_leveling"] = option_auto_bed_level;
|
||||
m_checkbox_list["flow_cali"] = option_flow_dynamics_cali;
|
||||
m_checkbox_list["nozzle_offset_cali"] = option_nozzle_offset_cali_cali;
|
||||
|
||||
for (auto print_opt : m_checkbox_list_order) {
|
||||
print_opt->Bind(EVT_SWITCH_PRINT_OPTION, [this](auto &e) { save_option_vals(); });
|
||||
}
|
||||
|
|
@ -686,7 +706,8 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||
m_scroll_sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
|
||||
m_scroll_sizer->Add(m_mapping_sugs_sizer, 0, wxLEFT|wxRIGHT, FromDIP(15));
|
||||
m_scroll_sizer->Add(m_change_filament_times_sizer, 0,wxLEFT|wxRIGHT, FromDIP(15));
|
||||
m_scroll_sizer->Add(m_link_edit_nozzle, 0, wxLEFT|wxRIGHT, FromDIP(15));
|
||||
// m_scroll_sizer->Add(m_link_edit_nozzle, 0, wxLEFT|wxRIGHT, FromDIP(15));
|
||||
m_scroll_sizer->Add(suggestion_sizer, 0, wxLEFT|wxRIGHT|wxEXPAND, FromDIP(15));
|
||||
m_scroll_sizer->Add(sizer_split_options, 1, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15));
|
||||
m_scroll_sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
|
||||
m_scroll_sizer->Add(m_options_other, 0, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15));
|
||||
|
|
@ -761,6 +782,11 @@ void SelectMachineDialog::init_bind()
|
|||
Layout();
|
||||
}
|
||||
});
|
||||
|
||||
m_check_ext_change_assist->Bind(wxEVT_TOGGLEBUTTON, [this](auto &e) {
|
||||
m_ext_change_assist = e.IsChecked();
|
||||
e.Skip();
|
||||
});
|
||||
}
|
||||
|
||||
void SelectMachineDialog::show_print_failed_info(bool show, int code, wxString description, wxString extra)
|
||||
|
|
@ -1383,7 +1409,7 @@ bool SelectMachineDialog::is_nozzle_type_match(ExtderData data, wxString& error_
|
|||
{
|
||||
pos = _L("left nozzle");
|
||||
}
|
||||
else if ((target_machine_nozzle_id == MAIN_NOZZLE_ID))
|
||||
else if(target_machine_nozzle_id == MAIN_NOZZLE_ID)
|
||||
{
|
||||
pos = _L("right nozzle");
|
||||
}
|
||||
|
|
@ -1888,8 +1914,10 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||
}
|
||||
|
||||
if (main_external_spool_filas.size() > 1 || deputy_external_spool_filas.size() > 1) {
|
||||
confirm_text.push_back(ConfirmBeforeSendInfo(_L("More than one filament types have been mapped to the same external spool, which may cause printing issues. The printer won't pause during printing.")));
|
||||
has_slice_warnings = true;
|
||||
if(!m_ext_change_assist ){
|
||||
confirm_text.push_back(ConfirmBeforeSendInfo(_L("More than one filament types have been mapped to the same external spool, which may cause printing issues. The printer won't pause during printing.")));
|
||||
has_slice_warnings = true;
|
||||
}
|
||||
} else {
|
||||
//check filaments type in external spool
|
||||
for (const auto& mapping_info : m_ams_mapping_result) {
|
||||
|
|
@ -2228,6 +2256,16 @@ void SelectMachineDialog::update_option_opts(MachineObject *obj)
|
|||
update_options_layout();
|
||||
}
|
||||
|
||||
bool SelectMachineDialog::is_enable_external_change_assist(std::vector<FilamentInfo>& ams_mapping_result) {
|
||||
std::map<std::string, int> v_ams_map;
|
||||
v_ams_map[VIRTUAL_AMS_MAIN_ID_STR] = 0;
|
||||
v_ams_map[VIRTUAL_AMS_DEPUTY_ID_STR] = 0;
|
||||
for(auto info : m_ams_mapping_result){
|
||||
v_ams_map[info.ams_id]++;
|
||||
}
|
||||
return (v_ams_map[VIRTUAL_AMS_MAIN_ID_STR] > 1) || (v_ams_map[VIRTUAL_AMS_DEPUTY_ID_STR] > 1);
|
||||
}
|
||||
|
||||
void SelectMachineDialog::load_option_vals(MachineObject *obj)
|
||||
{
|
||||
if (m_is_in_sending_mode) { return;}
|
||||
|
|
@ -2491,6 +2529,7 @@ void SelectMachineDialog::on_send_print()
|
|||
false,
|
||||
timelapse_option,
|
||||
true,
|
||||
m_ext_change_assist,
|
||||
m_checkbox_list["bed_leveling"]->getValueInt(),
|
||||
m_checkbox_list["flow_cali"]->getValueInt(),
|
||||
m_checkbox_list["nozzle_offset_cali"]->getValueInt()
|
||||
|
|
@ -3213,6 +3252,22 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
|
|||
update_filament_change_count();
|
||||
}
|
||||
|
||||
/* multi color external change assist*/
|
||||
if(obj_->is_support_ext_change_assist && !m_check_ext_change_assist->IsShown()){
|
||||
m_check_ext_change_assist->Show(true);
|
||||
m_label_ext_change_assist->Show(true);
|
||||
}else if(!obj_->is_support_ext_change_assist &&m_check_ext_change_assist->IsShown()){
|
||||
m_check_ext_change_assist->Hide();
|
||||
m_label_ext_change_assist->Hide();
|
||||
}
|
||||
/*check external change assist*/
|
||||
if(!m_ams_mapping_result.empty() && is_enable_external_change_assist(m_ams_mapping_result)){
|
||||
m_check_ext_change_assist->Enable(true);
|
||||
}else{
|
||||
m_check_ext_change_assist->SetValue(false);
|
||||
m_check_ext_change_assist->Enable(false);
|
||||
}
|
||||
|
||||
/*reading done*/
|
||||
if (wxGetApp().app_config) {
|
||||
if (obj_->upgrade_force_upgrade) {
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ private:
|
|||
bool m_is_canceled{ false };
|
||||
bool m_is_rename_mode{ false };
|
||||
bool m_check_flag {false};
|
||||
bool m_ext_change_assist{ false };
|
||||
PrintPageMode m_print_page_mode{PrintPageMode::PrintPageModePrepare};
|
||||
std::string m_print_error_msg;
|
||||
std::string m_print_error_extra;
|
||||
|
|
@ -369,6 +370,8 @@ protected:
|
|||
Label* m_stext_weight{ nullptr };
|
||||
PrinterMsgPanel * m_statictext_ams_msg{nullptr};
|
||||
Label* m_txt_change_filament_times{ nullptr };
|
||||
CheckBox* m_check_ext_change_assist{ nullptr };
|
||||
Label* m_label_ext_change_assist{ nullptr };
|
||||
|
||||
PrinterInfoBox* m_printer_box { nullptr};
|
||||
PrinterMsgPanel * m_text_printer_msg{nullptr};
|
||||
|
|
@ -509,6 +512,9 @@ private:
|
|||
void load_option_vals(MachineObject* obj);
|
||||
void save_option_vals();
|
||||
void save_option_vals(MachineObject *obj);
|
||||
|
||||
// enbale or disable external change assist
|
||||
bool is_enable_external_change_assist(std::vector<FilamentInfo>& ams_mapping_result);
|
||||
};
|
||||
|
||||
class PrinterInfoBox : public StaticBox
|
||||
|
|
|
|||
|
|
@ -1518,7 +1518,7 @@ void CalibUtils::send_to_print(const CalibInfo &calib_info, wxString &error_mess
|
|||
print_job->set_calibration_task(true);
|
||||
|
||||
print_job->has_sdcard = obj_->get_sdcard_state() == MachineObject::SdcardState::HAS_SDCARD_NORMAL;
|
||||
print_job->set_print_config(MachineBedTypeString[bed_type], true, false, false, false, true, 0, 0, 0);
|
||||
print_job->set_print_config(MachineBedTypeString[bed_type], true, false, false, false, true, false, 0, 0, 0);
|
||||
print_job->set_print_job_finished_event(wxGetApp().plater()->get_send_calibration_finished_event(), print_job->m_project_name);
|
||||
|
||||
{ // after send: record the print job
|
||||
|
|
@ -1533,4 +1533,3 @@ void CalibUtils::send_to_print(const CalibInfo &calib_info, wxString &error_mess
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -276,6 +276,7 @@ struct PrintParams {
|
|||
int auto_bed_leveling{ 0 };
|
||||
int auto_flow_cali{ 0 };
|
||||
int auto_offset_cali{ 0 };
|
||||
bool task_ext_change_assist{false};
|
||||
};
|
||||
|
||||
struct TaskQueryParams
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue