From f3aa76e4c255dc0228d0279244b032ed5adc8049 Mon Sep 17 00:00:00 2001 From: Stone Li Date: Sun, 12 Mar 2023 18:02:33 +0800 Subject: [PATCH] NEW: set bed type when printing Change-Id: I94b32e6264ecae4a8a6ca20eed0d08d13c6e391d Signed-off-by: Stone Li --- src/slic3r/GUI/Jobs/PrintJob.cpp | 5 +++++ src/slic3r/GUI/PartPlate.cpp | 8 +++++++- src/slic3r/GUI/PartPlate.hpp | 2 +- src/slic3r/GUI/SelectMachine.cpp | 4 +++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index c9a36c0ba..7bc793726 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -157,6 +157,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 +204,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); diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 77b42dad8..e11662d9d 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -133,7 +133,7 @@ void PartPlate::init() m_print = nullptr; } -BedType PartPlate::get_bed_type() const +BedType PartPlate::get_bed_type(bool load_from_project) const { std::string bed_type_key = "curr_bed_type"; @@ -144,6 +144,12 @@ BedType PartPlate::get_bed_type() const return bed_type; } + if (!load_from_project || !wxGetApp().preset_bundle) + return btDefault; + + DynamicConfig& proj_cfg = wxGetApp().preset_bundle->project_config; + if (proj_cfg.has(bed_type_key)) + return proj_cfg.opt_enum(bed_type_key); return btDefault; } diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index 0046a2918..cfb19d00a 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -210,7 +210,7 @@ public: //clear alll the instances in plate void clear(bool clear_sliced_result = true); - BedType get_bed_type() const; + BedType get_bed_type(bool load_from_project = false) const; void set_bed_type(BedType bed_type); void reset_bed_type(); DynamicPrintConfig* config() { return &m_config; } diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index fec4104ee..ab52261e6 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -415,9 +415,11 @@ SelectMachinePopup::SelectMachinePopup(wxWindow *parent) #if !BBL_RELEASE_TO_PUBLIC && defined(__WINDOWS__) m_sizer_search_bar = new wxBoxSizer(wxVERTICAL); - m_search_bar = new wxSearchCtrl( this, wxID_ANY, _L("Search"), wxDefaultPosition, wxDefaultSize, 0 ); + m_search_bar = new wxSearchCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_search_bar->ShowSearchButton( true ); m_search_bar->ShowCancelButton( false ); + m_search_bar->SetHint(_L("Search")); + m_search_bar->SetDescriptiveText(_L("Search")); m_sizer_search_bar->Add( m_search_bar, 1, wxALL| wxEXPAND, 1 ); m_sizer_main->Add(m_sizer_search_bar, 0, wxALL | wxEXPAND, FromDIP(2)); m_search_bar->Bind( wxEVT_COMMAND_TEXT_UPDATED, &SelectMachinePopup::update_machine_list, this );