ENH:update image for plate type

jira: none
Change-Id: I590bf9d6596ccf5cd6e06844fb3ed247fa526ba6
This commit is contained in:
zhou.xu 2025-03-05 15:52:46 +08:00 committed by lane.wei
parent da65214326
commit 6be306e548
27 changed files with 40 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

View File

@ -6,6 +6,8 @@
"bed_model": "bbl-3dp-A1M.stl",
"bed_texture": "bbl-3dp-logo.svg",
"default_bed_type": "Textured PEI Plate",
"image_bed_type": "mini",
"not_support_bed_type":"Cool Plate;Engineering Plate",
"family": "BBL-3DP",
"machine_tech": "FFF",
"model_id": "N1",

View File

@ -6,6 +6,7 @@
"bed_model": "bbl-3dp-H2D.stl",
"bed_texture": "bbl-3dp-logo.svg",
"default_bed_type": "Textured PEI Plate",
"image_bed_type": "o",
"not_support_bed_type":"Cool Plate;Engineering Plate;Bambu Cool Plate SuperTack",
"family": "BBL-3DP",
"machine_tech": "FFF",

View File

@ -59,6 +59,7 @@
#define BBL_JSON_KEY_FAMILY "family"
#define BBL_JSON_KEY_BED_MODEL "bed_model"
#define BBL_JSON_KEY_BED_TEXTURE "bed_texture"
#define BBL_JSON_KEY_IMAGE_BED_TYPE "image_bed_type"
#define BBL_JSON_KEY_DEFAULT_BED_TYPE "default_bed_type"
#define BBL_JSON_KEY_HOTEND_MODEL "hotend_model"
#define BBL_JSON_KEY_DEFAULT_MATERIALS "default_materials"
@ -117,9 +118,9 @@ public:
// Vendor & Printer Model specific print bed model & texture.
std::string bed_model;
std::string bed_texture;
std::string image_bed_type;
std::string default_bed_type;
std::string hotend_model;
PrinterVariant* variant(const std::string &name) {
for (auto &v : this->variants)
if (v.name == name)

View File

@ -3798,6 +3798,8 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_vendor_configs_
} else if (boost::iequals(it.key(), BBL_JSON_KEY_DEFAULT_BED_TYPE)) {
// get bed type
model.default_bed_type = it.value();
} else if (boost::iequals(it.key(), BBL_JSON_KEY_IMAGE_BED_TYPE)) {
model.image_bed_type = it.value();
}
else if (boost::iequals(it.key(), BBL_JSON_KEY_BED_TEXTURE)) {
//get bed texture

View File

@ -20,18 +20,17 @@ namespace Slic3r { namespace GUI {
ImageDPIFrame::ImageDPIFrame()
: DPIFrame(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, !wxCAPTION | !wxCLOSE_BOX | wxBORDER_NONE)
{
m_image_px = 260;
m_image_px = 280;
int width = 270;
//SetTransparent(0);
SetMinSize(wxSize(FromDIP(width), -1));
SetMaxSize(wxSize(FromDIP(width), -1));
SetBackgroundColour(wxColour(242, 242, 242, 255));
m_sizer_main = new wxBoxSizer(wxVERTICAL);
auto image_sizer = new wxBoxSizer(wxVERTICAL);
auto imgsize = FromDIP(width);
m_bitmap = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("printer_preview_C13", this, m_image_px), wxDefaultPosition, wxSize(imgsize, imgsize * 0.94), 0);
image_sizer->Add(m_bitmap, 0, wxALIGN_CENTER | wxALL, FromDIP(0));
m_sizer_main->Add(image_sizer, FromDIP(0), wxALIGN_CENTER, FromDIP(0));
Bind(wxEVT_CLOSE_WINDOW, [this](auto &e) {

View File

@ -1600,12 +1600,11 @@ Sidebar::Sidebar(Plater *parent)
reset_bed_type_combox_choices();
p->combo_printer_bed->Bind(wxEVT_COMBOBOX, [this](auto &e) {
auto select_bed_type = get_cur_select_bed_type();
bool isDual = static_cast<wxBoxSizer *>(p->panel_printer_preset->GetSizer())->GetOrientation() == wxVERTICAL;
p->image_printer_bed->SetBitmap(create_scaled_bitmap(bed_type_thumbnails[select_bed_type], this, isDual ? 48 : 32));
auto image_path = get_cur_select_bed_image();
p->image_printer_bed->SetBitmap(create_scaled_bitmap(image_path, this, isDual ? 48 : 32));
if (p->big_bed_image_popup) {
p->big_bed_image_popup->set_bitmap(
create_scaled_bitmap("big_" + bed_type_thumbnails[select_bed_type], p->big_bed_image_popup, p->big_bed_image_popup->get_image_px()));
p->big_bed_image_popup->set_bitmap(create_scaled_bitmap("big_" + image_path, p->big_bed_image_popup, p->big_bed_image_popup->get_image_px()));
}
e.Skip(); // fix bug:Event spreads to sidebar
});
@ -1616,9 +1615,8 @@ Sidebar::Sidebar(Plater *parent)
wxPoint temp_pos(pos.x + rect.GetWidth(), pos.y);
if (p->big_bed_image_popup == nullptr) {
p->big_bed_image_popup = new ImageDPIFrame();
auto select_bed_type = get_cur_select_bed_type();
p->big_bed_image_popup->set_bitmap(
create_scaled_bitmap("big_" + bed_type_thumbnails[select_bed_type], p->big_bed_image_popup, p->big_bed_image_popup->get_image_px()));
auto image_path = get_cur_select_bed_image();
p->big_bed_image_popup->set_bitmap(create_scaled_bitmap("big_" + image_path, p->big_bed_image_popup, p->big_bed_image_popup->get_image_px()));
}
p->big_bed_image_popup->SetCanFocus(false);
p->big_bed_image_popup->SetPosition(temp_pos);
@ -2282,7 +2280,7 @@ void Sidebar::update_presets(Preset::Type preset_type)
extruder.combo_diameter->SetSelection(select);
extruder.diameter = diameter;
};
auto select_bed_type = get_cur_select_bed_type();
auto image_path = get_cur_select_bed_image();
if (is_dual_extruder) {
AMSCountPopupWindow::UpdateAMSCount(0, p->left_extruder);
AMSCountPopupWindow::UpdateAMSCount(1, p->right_extruder);
@ -2292,14 +2290,13 @@ void Sidebar::update_presets(Preset::Type preset_type)
update_extruder_diameter(*p->left_extruder);
update_extruder_diameter(*p->right_extruder);
//}
p->image_printer_bed->SetBitmap(create_scaled_bitmap(bed_type_thumbnails[select_bed_type], this, 48));
p->image_printer_bed->SetBitmap(create_scaled_bitmap(image_path, this, 48));
} else {
AMSCountPopupWindow::UpdateAMSCount(0, p->single_extruder);
update_extruder_variant(*p->single_extruder, 0);
//if (!p->is_switching_diameter)
update_extruder_diameter(*p->single_extruder);
p->image_printer_bed->SetBitmap(create_scaled_bitmap(bed_type_thumbnails[select_bed_type], this, 32));
p->image_printer_bed->SetBitmap(create_scaled_bitmap(image_path, this, 32));
}
if (GUI::wxGetApp().plater())
@ -2391,6 +2388,14 @@ BedType Sidebar::get_cur_select_bed_type() {
return select_bed_type;
}
std::string Sidebar::get_cur_select_bed_image()
{
auto select_bed_type = get_cur_select_bed_type();
auto series_suffix_str = m_cur_image_bed_type.empty() ? "" : ("_" + m_cur_image_bed_type);
auto image_path = bed_type_thumbnails[select_bed_type] + series_suffix_str;
return image_path;
}
void Sidebar::set_bed_type_accord_combox(BedType bed_type) {
for (size_t i = 0; i < m_cur_combox_bed_types.size(); i++) {
if (m_cur_combox_bed_types[i] == bed_type) {
@ -2398,7 +2403,11 @@ void Sidebar::set_bed_type_accord_combox(BedType bed_type) {
return;
}
}
p->combo_printer_bed->SelectAndNotify(0);
use_default_bed_type();
//re save preferred bed type
auto select_bed_type = get_cur_select_bed_type();
std::string bed_type_name = print_config_def.get("curr_bed_type")->enum_values[int(select_bed_type) - 1];
save_bed_type_to_config(bed_type_name);
}
bool Sidebar::reset_bed_type_combox_choices() {
@ -2424,6 +2433,9 @@ bool Sidebar::reset_bed_type_combox_choices() {
m_cur_combox_bed_types.clear();
if (pm &&bed_type_def && bed_type_def->enum_keys_map) {
int index = 0;
if (m_cur_image_bed_type != pm->image_bed_type) {
m_cur_image_bed_type = pm->image_bed_type;
}
for (auto item : bed_type_def->enum_labels) {
index++;
bool find = std::find(pm->not_support_bed_types.begin(), pm->not_support_bed_types.end(), item) != pm->not_support_bed_types.end();
@ -2435,6 +2447,7 @@ bool Sidebar::reset_bed_type_combox_choices() {
}
}
else {
m_cur_image_bed_type = "";
int index = 0;
for (auto item : bed_type_def->enum_labels) {
index++;
@ -2482,8 +2495,9 @@ void Sidebar::msw_rescale()
p->btn_edit_printer->msw_rescale();
p->image_printer->SetSize(PRINTER_THUMBNAIL_SIZE);
bool isDual = static_cast<wxBoxSizer *>(p->panel_printer_preset->GetSizer())->GetOrientation() == wxVERTICAL;
auto select_bed_type = get_cur_select_bed_type();
p->image_printer_bed->SetBitmap(create_scaled_bitmap(bed_type_thumbnails[select_bed_type], this, 48));
auto image_path = get_cur_select_bed_image();
p->image_printer_bed->SetBitmap(create_scaled_bitmap(image_path, this, isDual ? 48 : 32));
p->m_filament_icon->msw_rescale();
p->m_bpButton_add_filament->msw_rescale();
p->m_bpButton_del_filament->msw_rescale();

View File

@ -124,6 +124,7 @@ class Sidebar : public wxPanel
std::shared_ptr<SyncNozzleAndAmsDialog> m_sna_dialog{nullptr};
std::shared_ptr<FinishSyncAmsDialog> m_fna_dialog{nullptr};
std::vector<BedType> m_cur_combox_bed_types;
std::string m_cur_image_bed_type;
int m_last_combo_bedtype_count{0};
bool m_begin_sync_printer_status{false};
std::shared_ptr<SyncAmsInfoDialog> m_sync_dlg{nullptr};
@ -150,6 +151,7 @@ public:
bool set_bed_type(const std::string& bed_type_name);
void save_bed_type_to_config(const std::string &bed_type_name);
BedType get_cur_select_bed_type();
std::string get_cur_select_bed_image();
void set_bed_type_accord_combox(BedType bed_type);
bool reset_bed_type_combox_choices();
bool use_default_bed_type(bool is_bbl_preset = true);