ENH:allow printing of all files in the SD card
Change-Id: I72097ddc1fa1020de2133753f14c0715322ea3cd
This commit is contained in:
parent
d8767b2cfe
commit
9d65199a2b
|
@ -235,6 +235,11 @@ void PrintJob::process()
|
|||
params.task_bed_type = this->task_bed_type;
|
||||
params.print_type = this->m_print_type;
|
||||
|
||||
if (m_print_type == "from_sdcard_view") {
|
||||
params.dst_file = m_dst_path;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
@ -270,7 +275,7 @@ void PrintJob::process()
|
|||
}
|
||||
|
||||
|
||||
if (params.preset_name.empty()) { params.preset_name = wxString::Format("%s_plate_%d", m_project_name, curr_plate_idx).ToStdString(); }
|
||||
if (params.preset_name.empty() && m_print_type == "from_normal") { params.preset_name = wxString::Format("%s_plate_%d", m_project_name, curr_plate_idx).ToStdString(); }
|
||||
if (params.project_name.empty()) {params.project_name = m_project_name;}
|
||||
|
||||
wxString error_text;
|
||||
|
@ -506,6 +511,12 @@ void PrintJob::set_project_name(std::string name)
|
|||
m_project_name = name;
|
||||
}
|
||||
|
||||
void PrintJob::set_dst_name(std::string path)
|
||||
{
|
||||
m_dst_path = path;
|
||||
}
|
||||
|
||||
|
||||
void PrintJob::on_check_ip_address_fail(std::function<void()> func)
|
||||
{
|
||||
m_enter_ip_address_fun_fail = func;
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
std::string task_ams_mapping_info;
|
||||
std::string connection_type;
|
||||
std::string m_print_type;
|
||||
std::string m_dst_path;
|
||||
|
||||
int m_print_from_sdc_plate_idx = 0;
|
||||
|
||||
|
@ -99,6 +100,7 @@ public:
|
|||
void process() override;
|
||||
void finalize() override;
|
||||
void set_project_name(std::string name);
|
||||
void set_dst_name(std::string path);
|
||||
void on_check_ip_address_fail(std::function<void()> func);
|
||||
void on_check_ip_address_success(std::function<void()> func);
|
||||
void connect_to_local_mqtt();
|
||||
|
|
|
@ -510,8 +510,10 @@ void MediaFilePanel::doAction(size_t index, int action)
|
|||
_L("Error"), wxOK).ShowModal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
auto &file = fs->GetFile(index);
|
||||
int gcode_file_count = Slic3r::GUI::wxGetApp().plater()->update_print_required_data(config, model, plate_data_list, from_u8(file.name).ToStdString());
|
||||
int gcode_file_count = Slic3r::GUI::wxGetApp().plater()->update_print_required_data(config, model, plate_data_list, from_u8(file.name).ToStdString(), file.path);
|
||||
|
||||
if (gcode_file_count > 0) {
|
||||
wxPostEvent(Slic3r::GUI::wxGetApp().plater(), SimpleEvent(EVT_PRINT_FROM_SDCARD_VIEW));
|
||||
|
|
|
@ -2267,7 +2267,7 @@ struct Plater::priv
|
|||
//BBS: add popup object table logic
|
||||
bool PopupObjectTable(int object_id, int volume_id, const wxPoint& position);
|
||||
void on_action_send_to_printer(bool isall = false);
|
||||
int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name);
|
||||
int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path);
|
||||
private:
|
||||
bool layers_height_allowed() const;
|
||||
|
||||
|
@ -6312,10 +6312,10 @@ void Plater::priv::on_action_print_plate_from_sdcard(SimpleEvent&)
|
|||
m_select_machine_dlg->ShowModal();
|
||||
}
|
||||
|
||||
int Plater::priv::update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name)
|
||||
int Plater::priv::update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path)
|
||||
{
|
||||
if (!m_select_machine_dlg) m_select_machine_dlg = new SelectMachineDialog(q);
|
||||
return m_select_machine_dlg->update_print_required_data(config, model, plate_data_list, file_name);
|
||||
return m_select_machine_dlg->update_print_required_data(config, model, plate_data_list, file_name, file_path);
|
||||
}
|
||||
|
||||
void Plater::priv::on_action_send_to_printer(bool isall)
|
||||
|
@ -10961,9 +10961,9 @@ bool Plater::undo_redo_string_getter(const bool is_undo, int idx, const char** o
|
|||
return false;
|
||||
}
|
||||
|
||||
int Plater::update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name)
|
||||
int Plater::update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path)
|
||||
{
|
||||
return p->update_print_required_data(config, model, plate_data_list, file_name);
|
||||
return p->update_print_required_data(config, model, plate_data_list, file_name, file_path);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -387,7 +387,7 @@ public:
|
|||
void redo_to(int selection);
|
||||
bool undo_redo_string_getter(const bool is_undo, int idx, const char** out_text);
|
||||
void undo_redo_topmost_string_getter(const bool is_undo, std::string& out_text);
|
||||
int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name);
|
||||
int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path);
|
||||
bool search_string_getter(int idx, const char** label, const char** tooltip);
|
||||
// For the memory statistics.
|
||||
const Slic3r::UndoRedo::Stack& undo_redo_stack_main() const;
|
||||
|
|
|
@ -1416,16 +1416,16 @@ void SelectMachineDialog::init_bind()
|
|||
if (obj->dev_id == e.GetString()) {
|
||||
m_comboBox_printer->SetValue(obj->dev_name + "(LAN)");
|
||||
}
|
||||
}else if(e.GetInt() == 1){
|
||||
}else if(e.GetInt() == 1 && (m_print_type == PrintFromType::FROM_SDCARD_VIEW)){
|
||||
on_send_print();
|
||||
}
|
||||
else if (e.GetInt() == -2) {
|
||||
else if (e.GetInt() == -2 && (m_print_type == PrintFromType::FROM_SDCARD_VIEW)) {
|
||||
show_status(PrintDialogStatus::PrintStatusSendingCanceled);
|
||||
prepare_mode();
|
||||
MessageDialog msg_wingow(nullptr, _L("Printer local connection failed, please try again."), "", wxAPPLY | wxOK);
|
||||
msg_wingow.ShowModal();
|
||||
}
|
||||
else if (e.GetInt() == 5) {
|
||||
else if (e.GetInt() == 5 && (m_print_type == PrintFromType::FROM_SDCARD_VIEW)) {
|
||||
show_status(PrintDialogStatus::PrintStatusSendingCanceled);
|
||||
prepare_mode();
|
||||
|
||||
|
@ -2239,6 +2239,8 @@ void SelectMachineDialog::show_errors(wxString &info)
|
|||
|
||||
void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
||||
{
|
||||
bool has_slice_warnings = false;
|
||||
|
||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) return;
|
||||
MachineObject* obj_ = dev->get_selected_machine();
|
||||
|
@ -2248,17 +2250,15 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||
std::vector<wxString> confirm_text;
|
||||
confirm_text.push_back(_L("Please check the following:") + "\n\n");
|
||||
|
||||
#if 1
|
||||
//Check Printer Model Id
|
||||
bool is_same_printer_type = is_same_printer_model();
|
||||
if (!is_same_printer_type)
|
||||
if (!is_same_printer_type && (m_print_type == PrintFromType::FROM_NORMAL)) {
|
||||
confirm_text.push_back(_L("The printer type selected when generating G-Code is not consistent with the currently selected printer. It is recommended that you use the same printer type for slicing.") + "\n");
|
||||
#else
|
||||
bool is_same_printer_type = true;
|
||||
#endif
|
||||
|
||||
//Check slice warnings
|
||||
bool has_slice_warnings = false;
|
||||
has_slice_warnings = true;
|
||||
}
|
||||
|
||||
|
||||
PartPlate* plate = m_plater->get_partplate_list().get_curr_plate();
|
||||
|
||||
for (auto warning : plate->get_slice_result()->warnings) {
|
||||
|
@ -2334,7 +2334,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||
confirm_text.push_back(_L("There are some unknown filaments in the AMS mappings. Please check whether they are the required filaments. If they are okay, press \"Confirm\" to start printing.") + "\n");
|
||||
}
|
||||
|
||||
if (!is_same_printer_type || has_slice_warnings) {
|
||||
if (has_slice_warnings) {
|
||||
wxString confirm_title = _L("Warning");
|
||||
ConfirmBeforeSendDialog confirm_dlg(this, wxID_ANY, confirm_title);
|
||||
confirm_dlg.Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, &confirm_dlg](wxCommandEvent& e) {
|
||||
|
@ -2542,13 +2542,20 @@ void SelectMachineDialog::on_send_print()
|
|||
|
||||
try {
|
||||
m_print_job->m_print_from_sdc_plate_idx = m_required_data_plate_data_list[m_print_plate_idx]->plate_index + 1;
|
||||
m_print_job->set_dst_name(m_required_data_file_path);
|
||||
}
|
||||
catch (...) {}
|
||||
BOOST_LOG_TRIVIAL(info) << "print_job: m_print_plate_idx =" << m_print_job->m_print_from_sdc_plate_idx;
|
||||
|
||||
auto input_str_arr = wxGetApp().split_str(m_required_data_file_name,".gcode.3mf");
|
||||
if (input_str_arr.size() > 1) {
|
||||
m_print_job->set_project_name(input_str_arr[0]);
|
||||
auto input_str_arr = wxGetApp().split_str(m_required_data_file_name, ".gcode.3mf");
|
||||
if (input_str_arr.size() <= 1) {
|
||||
input_str_arr = wxGetApp().split_str(m_required_data_file_name, ".3mf");
|
||||
if (input_str_arr.size() > 1) {
|
||||
m_print_job->set_project_name(wxString(input_str_arr[0]).utf8_string());
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_print_job->set_project_name(wxString(input_str_arr[0]).utf8_string());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2695,7 +2702,7 @@ bool SelectMachineDialog::is_timeout()
|
|||
return false;
|
||||
}
|
||||
|
||||
int SelectMachineDialog::update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name)
|
||||
int SelectMachineDialog::update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path)
|
||||
{
|
||||
m_required_data_plate_data_list.clear();
|
||||
m_required_data_config = config;
|
||||
|
@ -2708,6 +2715,7 @@ int SelectMachineDialog::update_print_required_data(Slic3r::DynamicPrintConfig c
|
|||
}
|
||||
|
||||
m_required_data_file_name = file_name;
|
||||
m_required_data_file_path = file_path;
|
||||
return m_required_data_plate_data_list.size();
|
||||
}
|
||||
|
||||
|
|
|
@ -315,6 +315,7 @@ private:
|
|||
Slic3r::Model m_required_data_model;
|
||||
Slic3r::PlateDataPtrs m_required_data_plate_data_list;
|
||||
std::string m_required_data_file_name;
|
||||
std::string m_required_data_file_path;
|
||||
|
||||
protected:
|
||||
PrintFromType m_print_type{FROM_NORMAL};
|
||||
|
@ -446,7 +447,7 @@ public:
|
|||
bool is_blocking_printing();
|
||||
bool has_tips(MachineObject* obj);
|
||||
bool is_timeout();
|
||||
int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name);
|
||||
int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path);
|
||||
void set_print_type(PrintFromType type) {m_print_type = type;};
|
||||
bool Show(bool show);
|
||||
bool do_ams_mapping(MachineObject* obj_);
|
||||
|
|
|
@ -176,6 +176,7 @@ struct PrintParams {
|
|||
int origin_profile_id = 0;
|
||||
std::string origin_model_id;
|
||||
std::string print_type;
|
||||
std::string dst_file;
|
||||
|
||||
/* access options */
|
||||
std::string dev_ip;
|
||||
|
|
|
@ -12,4 +12,5 @@ set(BBL_INTERNAL_TESTING "1")
|
|||
endif()
|
||||
|
||||
# The build_version should start from 50 in master branch
|
||||
set(SLIC3R_VERSION "01.06.09.57")
|
||||
|
||||
set(SLIC3R_VERSION "01.06.10.51")
|
||||
|
|
Loading…
Reference in New Issue