From e15c2fd88d8345f53afa907aa88762e0ea9805f2 Mon Sep 17 00:00:00 2001 From: cjw Date: Fri, 18 Apr 2025 09:07:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=A0=8F=E5=8F=96=E6=B6=88?= =?UTF-8?q?=20|=20=EF=BC=8Cgcode=E5=AF=BC=E5=87=BA=EF=BC=8C=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E5=AD=97=E4=BD=93=E5=8F=98=E5=A4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- slic3r/GUI/GLCanvas3D.cpp | 2 +- slic3r/GUI/GUI_App.cpp | 2 +- slic3r/GUI/MainFrame.cpp | 67 ++++++++++++++++++++++++--------------- slic3r/GUI/Tab.cpp | 59 ++++++++++++++++++++++------------ 4 files changed, 82 insertions(+), 48 deletions(-) diff --git a/slic3r/GUI/GLCanvas3D.cpp b/slic3r/GUI/GLCanvas3D.cpp index 7dbbacf..b6599e0 100644 --- a/slic3r/GUI/GLCanvas3D.cpp +++ b/slic3r/GUI/GLCanvas3D.cpp @@ -8102,7 +8102,7 @@ void GLCanvas3D::_render_separator_toolbar_left() const float left = main_toolbar_left + (m_main_toolbar.get_width()) * inv_zoom; m_separator_toolbar.set_position(top, left); - m_separator_toolbar.render(*this,GLToolbarItem::SeparatorLine); + //m_separator_toolbar.render(*this,GLToolbarItem::SeparatorLine); } void GLCanvas3D::_render_collapse_toolbar() const diff --git a/slic3r/GUI/GUI_App.cpp b/slic3r/GUI/GUI_App.cpp index 1ea89de..82e49a5 100644 --- a/slic3r/GUI/GUI_App.cpp +++ b/slic3r/GUI/GUI_App.cpp @@ -372,7 +372,7 @@ public: memDc.DrawBitmap(version_bmp, 50, 500, false); BitmapCache title_cache; - wxBitmap title_bmp = *title_cache.load_svg("ui_title", FromDIP(600), FromDIP(600)); + wxBitmap title_bmp = *title_cache.load_svg("ui_title", FromDIP(700), FromDIP(700)); memDc.DrawBitmap(title_bmp, 50, 350, false); BitmapCache config_cache; diff --git a/slic3r/GUI/MainFrame.cpp b/slic3r/GUI/MainFrame.cpp index 42e1a66..daa5031 100644 --- a/slic3r/GUI/MainFrame.cpp +++ b/slic3r/GUI/MainFrame.cpp @@ -1565,7 +1565,8 @@ wxBoxSizer* MainFrame::create_side_tools() m_publish_btn = new Button(this, _L("Upload"), "bar_publish", 0, FromDIP(16)); m_slice_btn = new SideButton(this, _L("Slice plate"), ""); m_slice_option_btn = new SideButton(this, "", "sidebutton_dropdown", 0, FromDIP(14)); - m_print_btn = new SideButton(this, _L("Print plate"), ""); + //m_print_btn = new SideButton(this, _L("Print plate"), ""); + m_print_btn = new SideButton(this, _L("Export G-code file"), ""); m_print_option_btn = new SideButton(this, "", "sidebutton_dropdown", 0, FromDIP(14)); update_side_button_style(); @@ -1723,7 +1724,7 @@ wxBoxSizer* MainFrame::create_side_tools() p->Dismiss(); });*/ - p->append_button(send_gcode_btn); + //p->append_button(send_gcode_btn); //p->append_button(upload_gcode_btn); p->append_button(export_gcode_btn); } @@ -1736,8 +1737,8 @@ wxBoxSizer* MainFrame::create_side_tools() //SideButton* send_to_printer_btn = new SideButton(p, _L("Send"), ""); //send_to_printer_btn->SetCornerRadius(0); - SideButton* export_sliced_file_btn = new SideButton(p, _L("Export plate sliced file"), ""); - export_sliced_file_btn->SetCornerRadius(0); + //SideButton* export_sliced_file_btn = new SideButton(p, _L("Export plate sliced file"), ""); + //export_sliced_file_btn->SetCornerRadius(0); /* SideButton* export_all_sliced_file_btn = new SideButton(p, _L("Export all sliced file"), ""); export_all_sliced_file_btn->SetCornerRadius(0);*/ @@ -1782,15 +1783,24 @@ wxBoxSizer* MainFrame::create_side_tools() p->Dismiss(); });*/ - export_sliced_file_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { + /*export_sliced_file_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { m_print_btn->SetLabel(_L("Export plate sliced file")); m_print_select = eExportSlicedFile; m_print_enable = get_enable_print_status(); m_print_btn->Enable(m_print_enable); this->Layout(); p->Dismiss(); + });*/ + SideButton* export_gcode_btn = new SideButton(p, _L("Export G-code file"), ""); + export_gcode_btn->SetCornerRadius(0); + export_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { + m_print_btn->SetLabel(_L("Export G-code file")); + m_print_select = eExportGcode; + m_print_enable = get_enable_print_status(); + m_print_btn->Enable(m_print_enable); + this->Layout(); + p->Dismiss(); }); - /* export_all_sliced_file_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { m_print_btn->SetLabel(_L("Export all sliced file")); m_print_select = eExportAllSlicedFile; @@ -1804,7 +1814,8 @@ wxBoxSizer* MainFrame::create_side_tools() //p->append_button(print_all_btn); //p->append_button(send_to_printer_btn); //p->append_button(send_to_printer_all_btn); - p->append_button(export_sliced_file_btn); + //p->append_button(export_sliced_file_btn); + p->append_button(export_gcode_btn); //p->append_button(export_all_sliced_file_btn); /*if (enable_multi_machine) { SideButton* print_multi_machine_btn = new SideButton(p, _L("Send to Multi-device"), ""); @@ -3561,24 +3572,30 @@ void MainFrame::on_config_changed(DynamicPrintConfig* config) const void MainFrame::set_print_button_to_default(PrintSelectType select_type) { - if (select_type == PrintSelectType::ePrintPlate) { - m_print_btn->SetLabel(_L("Print plate")); - m_print_select = ePrintPlate; - if (m_print_enable) - m_print_enable = get_enable_print_status(); - m_print_btn->Enable(m_print_enable); - this->Layout(); - } else if (select_type == PrintSelectType::eSendGcode) { - m_print_btn->SetLabel(_L("Print")); - m_print_select = eSendGcode; - if (m_print_enable) - m_print_enable = get_enable_print_status() && can_send_gcode(); - m_print_btn->Enable(m_print_enable); - this->Layout(); - } else { - //unsupport - return; - } + //if (select_type == PrintSelectType::ePrintPlate) { + // m_print_btn->SetLabel(_L("Print plate")); + // m_print_select = ePrintPlate; + // if (m_print_enable) + // m_print_enable = get_enable_print_status(); + // m_print_btn->Enable(m_print_enable); + // this->Layout(); + //} else if (select_type == PrintSelectType::eSendGcode) { + // m_print_btn->SetLabel(_L("Print")); + // m_print_select = eSendGcode; + // if (m_print_enable) + // m_print_enable = get_enable_print_status() && can_send_gcode(); + // m_print_btn->Enable(m_print_enable); + // this->Layout(); + //} else { + // //unsupport + // return; + //} + m_print_btn->SetLabel(_L("Export G-code file")); + m_print_select = eExportGcode; + if (m_print_enable) + m_print_enable = get_enable_print_status(); + m_print_btn->Enable(m_print_enable); + this->Layout(); } void MainFrame::add_to_recent_projects(const wxString& filename) diff --git a/slic3r/GUI/Tab.cpp b/slic3r/GUI/Tab.cpp index 39b51b3..d302aeb 100644 --- a/slic3r/GUI/Tab.cpp +++ b/slic3r/GUI/Tab.cpp @@ -2083,12 +2083,12 @@ void TabPrint::build() page = add_options_page(L("Support"), "support"); optgroup = page->new_optgroup("", L"param_support"); optgroup->append_single_option_line("enable_support", "support"); - optgroup->append_single_option_line("support_type", "support#support-types"); - optgroup->append_single_option_line("support_style", "support#support-styles"); - optgroup->append_single_option_line("support_threshold_angle", "support#threshold-angle"); - optgroup->append_single_option_line("support_on_build_plate_only"); - optgroup->append_single_option_line("support_critical_regions_only"); - optgroup->append_single_option_line("support_remove_small_overhang"); + //optgroup->append_single_option_line("support_type", "support#support-types"); + //optgroup->append_single_option_line("support_style", "support#support-styles"); + //optgroup->append_single_option_line("support_threshold_angle", "support#threshold-angle"); + //optgroup->append_single_option_line("support_on_build_plate_only"); + //optgroup->append_single_option_line("support_critical_regions_only"); + //optgroup->append_single_option_line("support_remove_small_overhang"); //optgroup->append_single_option_line("enforce_support_layers"); //optgroup = page->new_optgroup(L("Raft"), L"param_raft"); @@ -4549,22 +4549,39 @@ void TabConfig::toggle_options() { if (m_preset_bundle) { is_BBL_printer = m_preset_bundle->configs.get_edited_preset().is_bbl_vendor_preset(m_preset_bundle); } - //std::string cde = "1"; - //m_preset_bundle->filament_presets - /* for (auto& f : m_preset_bundle->filament_presets) { - cde = f; - }*/ + bool enable_support = m_preset_bundle->prints.get_edited_preset().config.opt_bool("enable_support"); - //for (auto el : { "support_style", "support_base_pattern", - // "support_base_pattern_spacing", "support_expansion", "support_angle", - // "support_interface_pattern", "support_interface_top_layers", "support_interface_bottom_layers", - // "bridge_no_support", "max_bridge_length", "support_top_z_distance", "support_bottom_z_distance", - // //BBS: add more support params to dependent of enable_support - // "support_type", "support_on_build_plate_only", - // "support_remove_small_overhang","support_interface_not_for_body", - // "support_object_xy_distance","support_object_first_layer_gap"/*, "independent_support_layer_height"*/ }) - // toggle_option(el, have_support_material); - + for (auto el : { "support_style", "support_base_pattern", + "support_base_pattern_spacing", "support_expansion", "support_angle", + "support_interface_pattern", "support_interface_top_layers", "support_interface_bottom_layers", + "bridge_no_support", "max_bridge_length", "support_top_z_distance", "support_bottom_z_distance", + //BBS: add more support params to dependent of enable_support + "support_type", "support_on_build_plate_only", + "support_remove_small_overhang","support_interface_not_for_body", + "support_object_xy_distance","support_object_first_layer_gap",/* "independent_support_layer_height"*/ + "support_filament","support_interface_filament"}) + toggle_option(el, enable_support); + + Field* field = m_active_page->get_field("support_style"); + auto support_type = m_config->opt_enum("support_type"); + if (auto choice = dynamic_cast(field)) { + auto def = print_config_def.get("support_style"); + std::vector enum_set_normal = { smsDefault, smsGrid, smsSnug }; + std::vector enum_set_tree = { smsDefault, smsTreeSlim, smsTreeStrong, smsTreeHybrid, smsTreeOrganic }; + auto& set = is_tree(support_type) ? enum_set_tree : enum_set_normal; + auto& opt = const_cast(field->m_opt); + auto cb = dynamic_cast(choice->window); + auto n = cb->GetValue(); + opt.enum_values.clear(); + opt.enum_labels.clear(); + cb->Clear(); + for (auto i : set) { + opt.enum_values.push_back(def->enum_values[i]); + opt.enum_labels.push_back(def->enum_labels[i]); + cb->Append(_(def->enum_labels[i])); + } + cb->SetValue(n); + } //p->combos_filament //m_preset_bundle->configs.update_dirty(); //wxString abc = wxString::FromUTF8( m_preset_bundle->configs.get_selected_preset().name);