From a351aa8cb04f910d27a4f652bbc20b49475a54f8 Mon Sep 17 00:00:00 2001 From: HYzd766 <108379794+HYzd766@users.noreply.github.com> Date: Mon, 3 Nov 2025 21:34:11 +0800 Subject: [PATCH] Multi-color code compatible with QIDI models (#11185) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * The 0.30mm layer height configuration for the 0.4 nozzle of the QIDI model has been removed * Merge branch 'main' into main * Merge branch 'SoftFever:main' into main * Revert "The 0.30mm layer height configuration for the 0.4 nozzle of the QIDI model has been removed" This reverts commit 8d296720b8de58b1bfa4f008a24cee841a8472c6. * Update Qidi Q2 0.4 nozzle.json 修改Q2打印高度 * Merge branch 'SoftFever:main' into main * Merge branch 'SoftFever:main' into main * change machine_gcode * Merge branch 'main' of https://github.com/HYzd766/OrcaSlicer * Merge branch 'SoftFever:main' into main * Multi-color code compatible with QIDI models * Merge branch 'main' into main * toggle axis visibility on canvas (#9666) * toggle axis visibility on canvas * set show_axes config on toggle * fix: Add pause and filament change to machine gcodes for Sovol SV08 MAX (#11214) * Add fixed Ironing Angle setting for uniform surface finish (#11195) * Initial working fixed ironing angle implemented with new Fixed ironing angle setting * update documentation * Combine Fill.is_using_template_angle and Fill.alternate_fill_direction into Fill.fixed_angle * Rename SurfaceFillParams.is_using_template_angle to SurfaceFillParam.fixed_angle. --- src/libslic3r/GCode.cpp | 16 ++++++++++++---- src/libslic3r/GCode.hpp | 1 + src/libslic3r/PresetBundle.cpp | 3 +++ src/libslic3r/PresetBundle.hpp | 5 ++++- src/libslic3r/Print.cpp | 4 ++-- src/libslic3r/Print.hpp | 3 +++ src/slic3r/GUI/BackgroundSlicingProcess.cpp | 1 + src/slic3r/GUI/Tab.cpp | 9 +++++++-- 8 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index e3624e8bd9..8818cb3c21 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1268,7 +1268,7 @@ static std::vector get_path_of_change_filament(const Print& print) std::string WipeTowerIntegration::prime(GCode &gcodegen) { std::string gcode; - if (!gcodegen.is_BBL_Printer()) { + if (!gcodegen.is_BBL_Printer() && !gcodegen.is_QIDI_Printer()) { for (const WipeTower::ToolChangeResult &tcr : m_priming) { if (!tcr.extrusions.empty()) gcode += append_tcr2(gcodegen, tcr, tcr.new_tool); @@ -1284,7 +1284,7 @@ static std::vector get_path_of_change_filament(const Print& print) assert(m_layer_idx >= 0); if (m_layer_idx >= (int) m_tool_changes.size()) return gcode; - if (!gcodegen.is_BBL_Printer()) { + if (!gcodegen.is_BBL_Printer() && !gcodegen.is_QIDI_Printer()) { if (gcodegen.writer().need_toolchange(extruder_id) || finish_layer) { if (m_layer_idx < (int) m_tool_changes.size()) { if (!(size_t(m_tool_change_idx) < m_tool_changes[m_layer_idx].size())) @@ -1373,7 +1373,7 @@ static std::vector get_path_of_change_filament(const Print& print) std::string WipeTowerIntegration::finalize(GCode &gcodegen) { std::string gcode; - if (!gcodegen.is_BBL_Printer()) { + if (!gcodegen.is_BBL_Printer() && !gcodegen.is_QIDI_Printer()) { if (std::abs(gcodegen.writer().get_position().z() - m_final_purge.print_z) > EPSILON) gcode += gcodegen.change_layer(m_final_purge.print_z); gcode += append_tcr2(gcodegen, m_final_purge, -1); @@ -1795,6 +1795,13 @@ bool GCode::is_BBL_Printer() return false; } +bool GCode::is_QIDI_Printer() +{ + if (m_curr_print) + return m_curr_print->is_QIDI_printer(); + return false; +} + void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* result, ThumbnailsGeneratorCallback thumbnail_cb) { PROFILE_CLEAR(); @@ -2205,6 +2212,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato // modifies m_silent_time_estimator_enabled DoExport::init_gcode_processor(print.config(), m_processor, m_silent_time_estimator_enabled); const bool is_bbl_printers = print.is_BBL_printer(); + const bool is_qidi_printers = print.is_QIDI_printer(); m_calib_config.clear(); // resets analyzer's tracking data m_last_height = 0.f; @@ -2487,7 +2495,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato throw Slic3r::SlicingError(_(L("No object can be printed. Maybe too small"))); has_wipe_tower = print.has_wipe_tower() && tool_ordering.has_wipe_tower(); // Orca: support all extruder priming - initial_extruder_id = (!is_bbl_printers && has_wipe_tower && !print.config().single_extruder_multi_material_priming) ? + initial_extruder_id = (!is_bbl_printers && has_wipe_tower && !print.config().single_extruder_multi_material_priming && !is_qidi_printers) ? // The priming towers will be skipped. tool_ordering.all_extruders().back() : // Don't skip the priming towers. diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 5e8dc8bdd1..dd7d7d3202 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -250,6 +250,7 @@ public: std::string unretract() { return m_writer.unlift() + m_writer.unretract(); } std::string set_extruder(unsigned int extruder_id, double print_z, bool by_object=false); bool is_BBL_Printer(); + bool is_QIDI_Printer(); // SoftFever std::string set_object_info(Print* print); diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 7169ac5ea9..b12111cdca 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -535,6 +535,9 @@ VendorType PresetBundle::get_current_vendor_type() { if(vendor_name.compare("BBL") == 0) t = VendorType::Marlin_BBL; + + if(vendor_name.compare("Qidi") == 0) + t = VendorType::Klipper_Qidi; } return t; } diff --git a/src/libslic3r/PresetBundle.hpp b/src/libslic3r/PresetBundle.hpp index 09b34e7f58..3c6aa9e6e6 100644 --- a/src/libslic3r/PresetBundle.hpp +++ b/src/libslic3r/PresetBundle.hpp @@ -25,7 +25,8 @@ enum class VendorType { Unknown = 0, Klipper, Marlin, - Marlin_BBL + Marlin_BBL, + Klipper_Qidi }; namespace Slic3r { @@ -144,6 +145,8 @@ public: VendorType get_current_vendor_type(); // Vendor related handy functions bool is_bbl_vendor() { return get_current_vendor_type() == VendorType::Marlin_BBL; } + bool is_qidi_vendor() { return get_current_vendor_type() == VendorType::Klipper_Qidi; } + // Whether using bbl network for print upload bool use_bbl_network(); // Whether using bbl's device tab diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 77179b5c5c..a7cf84de14 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -3077,7 +3077,7 @@ void Print::_make_wipe_tower() // BBS const unsigned int number_of_extruders = (unsigned int)(m_config.filament_colour.values.size()); - const auto bUseWipeTower2 = is_BBL_printer() ? false : true; + const auto bUseWipeTower2 = is_BBL_printer() || is_QIDI_printer() ? false : true; // Let the ToolOrdering class know there will be initial priming extrusions at the start of the print. m_wipe_tower_data.tool_ordering = ToolOrdering(*this, (unsigned int) -1, bUseWipeTower2 ? true : false); m_wipe_tower_data.tool_ordering.sort_and_build_data(*this, (unsigned int)-1, bUseWipeTower2 ? true : false); @@ -3261,7 +3261,7 @@ void Print::_make_wipe_tower() wipe_volumes.push_back(std::vector(flush_matrix.begin()+i*number_of_extruders, flush_matrix.begin()+(i+1)*number_of_extruders)); // Orca: itertate over wipe_volumes and change the non-zero values to the prime_volume - if ((!m_config.purge_in_prime_tower || !m_config.single_extruder_multi_material) && !is_BBL_printer()) { + if ((!m_config.purge_in_prime_tower || !m_config.single_extruder_multi_material) && !is_BBL_printer() && !is_QIDI_printer()) { for (unsigned int i = 0; i < number_of_extruders; ++i) { for (unsigned int j = 0; j < number_of_extruders; ++j) { if (wipe_volumes[i][j] > 0) { diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index e485d7259c..dafca39387 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -1065,6 +1065,8 @@ public: //SoftFever bool &is_BBL_printer() { return m_isBBLPrinter; } const bool is_BBL_printer() const { return m_isBBLPrinter; } + bool &is_QIDI_printer() { return m_isQIDIPrinter; } + const bool is_QIDI_printer() const { return m_isQIDIPrinter; } CalibMode& calib_mode() { return m_calib_params.mode; } const CalibMode calib_mode() const { return m_calib_params.mode; } void set_calib_params(const Calib_Params& params); @@ -1132,6 +1134,7 @@ private: //SoftFever bool m_isBBLPrinter; + bool m_isQIDIPrinter; // Ordered collections of extrusion paths to build skirt loops and brim. ExtrusionEntityCollection m_skirt; diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index c1624f4a4e..919aeaf4b5 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -681,6 +681,7 @@ StringObjectException BackgroundSlicingProcess::validate(StringObjectException * assert(m_print == m_fff_print); m_fff_print->is_BBL_printer() = wxGetApp().preset_bundle->is_bbl_vendor(); + m_fff_print->is_QIDI_printer() = wxGetApp().preset_bundle->is_qidi_vendor(); return m_print->validate(warning, collison_polygons, height_polygons); } diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index a53051b6dd..c79b0ff418 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -5045,6 +5045,11 @@ void TabPrinter::toggle_options() is_BBL_printer = wxGetApp().preset_bundle->is_bbl_vendor(); } + bool is_QIDI_printer = false; + if (m_preset_bundle) { + is_QIDI_printer = wxGetApp().preset_bundle->is_qidi_vendor(); + } + bool have_multiple_extruders = true; //m_extruders_count > 1; //if (m_active_page->title() == "Custom G-code") { @@ -5077,7 +5082,7 @@ void TabPrinter::toggle_options() "extra_loading_move", "high_current_on_filament_swap", }) - toggle_option(el, !is_BBL_printer); + toggle_option(el, !is_BBL_printer && !is_QIDI_printer); auto bSEMM = m_config->opt_bool("single_extruder_multi_material"); if (!bSEMM && m_config->opt_bool("manual_filament_change")) { @@ -5087,7 +5092,7 @@ void TabPrinter::toggle_options() } toggle_option("extruders_count", !bSEMM); toggle_option("manual_filament_change", bSEMM); - toggle_option("purge_in_prime_tower", bSEMM && !is_BBL_printer); + toggle_option("purge_in_prime_tower", bSEMM && (!is_BBL_printer && !is_QIDI_printer)); } wxString extruder_number; long val = 1;