NEW: set bed type when printing

Change-Id: I94b32e6264ecae4a8a6ca20eed0d08d13c6e391d
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2023-03-12 18:02:33 +08:00 committed by Lane.Wei
parent 34ec55db80
commit f3aa76e4c2
4 changed files with 16 additions and 3 deletions

View File

@ -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);

View File

@ -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<BedType>(bed_type_key);
return btDefault;
}

View File

@ -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; }

View File

@ -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 );