From 4481fe62b51545f0b681e88e7199de361d142ab6 Mon Sep 17 00:00:00 2001 From: Dylan <331506+macdylan@users.noreply.github.com> Date: Thu, 4 May 2023 22:18:44 +0800 Subject: [PATCH] Add a new placehoder `is_extruder_used` for IDEX printers (#951) * add placeholder 'is_extruder_used' for IDEX * fix code_font using fixed-width font * fix cmd+shift+g --- src/libslic3r/GCode.cpp | 6 ++++++ src/slic3r/GUI/Field.cpp | 5 +++-- src/slic3r/GUI/MainFrame.cpp | 6 +++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 272f5a5009..55ee0d2c83 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1725,6 +1725,12 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato m_placeholder_parser.set("has_wipe_tower", has_wipe_tower); //m_placeholder_parser.set("has_single_extruder_multi_material_priming", has_wipe_tower && print.config().single_extruder_multi_material_priming); m_placeholder_parser.set("total_toolchanges", std::max(0, print.wipe_tower_data().number_of_toolchanges)); // Check for negative toolchanges (single extruder mode) and set to 0 (no tool change). + + std::vector is_extruder_used(print.config().filament_diameter.size(), 0); + for (unsigned int extruder : tool_ordering.all_extruders()) + is_extruder_used[extruder] = true; + m_placeholder_parser.set("is_extruder_used", new ConfigOptionBools(is_extruder_used)); + Vec2f plate_offset = m_writer.get_xy_offset(); { BoundingBoxf bbox(print.config().printable_area.values); diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 4852264200..2a5d280ed3 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -511,8 +511,9 @@ void TextCtrl::BUILD() { m_combine_side_text = !m_opt.multiline; if (parent_is_custom_ctrl && m_opt.height < 0) opt_height = (double) text_ctrl->GetSize().GetHeight() / m_em_unit; - if (m_opt.is_code) // BBS - temp->SetFont(Slic3r::GUI::wxGetApp().normal_font()); + temp->SetFont(m_opt.is_code ? + Slic3r::GUI::wxGetApp().code_font() : + Slic3r::GUI::wxGetApp().normal_font()); wxGetApp().UpdateDarkUI(temp); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index bc58b25fe5..64f498bf1e 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -542,7 +542,11 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_ m_print_enable = get_enable_print_status(); m_print_btn->Enable(m_print_enable); if (m_print_enable) { - wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_PRINT_PLATE)); + PresetBundle &preset_bundle = *wxGetApp().preset_bundle; + if (preset_bundle.printers.get_edited_preset().is_bbl_vendor_preset(&preset_bundle)) + wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_PRINT_PLATE)); + else + wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SEND_GCODE)); } evt.Skip(); return;