diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 05c8c6b4c..e0853cb9f 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -977,14 +977,9 @@ void PartPlate::release_opengl_resource() std::vector PartPlate::get_extruders(bool conside_custom_gcode) const { std::vector plate_extruders; - // if gcode.3mf file - if (m_model->objects.empty()) { - for (int i = 0; i < slice_filaments_info.size(); i++) { - plate_extruders.push_back(slice_filaments_info[i].id + 1); - } - return plate_extruders; - } - + if (check_objects_empty_and_gcode3mf(plate_extruders)) { + return plate_extruders; + } // if 3mf file const DynamicPrintConfig& glb_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; int glb_support_intf_extr = glb_config.opt_int("support_interface_filament"); @@ -1155,17 +1150,25 @@ std::vector PartPlate::get_extruders_under_cli(bool conside_custom_gcode, D return plate_extruders; } +bool PartPlate::check_objects_empty_and_gcode3mf(std::vector &result) const +{ + if (m_model->objects.empty()) {//objects is empty + if (wxGetApp().plater()->is_gcode_3mf()) { // if gcode.3mf file + for (int i = 0; i < slice_filaments_info.size(); i++) { + result.push_back(slice_filaments_info[i].id + 1); + } + } + return true; + } + return false; +} + std::vector PartPlate::get_extruders_without_support(bool conside_custom_gcode) const { std::vector plate_extruders; - // if gcode.3mf file - if (m_model->objects.empty()) { - for (int i = 0; i < slice_filaments_info.size(); i++) { - plate_extruders.push_back(slice_filaments_info[i].id + 1); - } - return plate_extruders; - } - + if (check_objects_empty_and_gcode3mf(plate_extruders)) { + return plate_extruders; + } // if 3mf file const DynamicPrintConfig& glb_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; @@ -1203,13 +1206,9 @@ std::vector PartPlate::get_extruders_without_support(bool conside_custom_gc std::vector PartPlate::get_used_extruders() { std::vector used_extruders; - // if gcode.3mf file - if (m_model->objects.empty()) { - for (int i = 0; i < slice_filaments_info.size(); i++) { - used_extruders.push_back(slice_filaments_info[i].id + 1); - } - return used_extruders; - } + if (check_objects_empty_and_gcode3mf(used_extruders)) { + return used_extruders; + } GCodeProcessorResult* result = get_slice_result(); if (!result) diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index d6930eacc..105fa7700 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -288,6 +288,7 @@ public: Vec3d get_origin() { return m_origin; } Vec3d estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double wipe_volume, int plate_extruder_size = 0, bool use_global_objects = false) const; arrangement::ArrangePolygon estimate_wipe_tower_polygon(const DynamicPrintConfig & config, int plate_index, int plate_extruder_size = 0, bool use_global_objects = false) const; + bool check_objects_empty_and_gcode3mf(std::vector &result) const; std::vector get_extruders(bool conside_custom_gcode = false) const; std::vector get_extruders_under_cli(bool conside_custom_gcode, DynamicPrintConfig& full_config) const; std::vector get_extruders_without_support(bool conside_custom_gcode = false) const; diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 9480aad0a..fc6d502e8 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -265,6 +265,7 @@ public: void calib_VFA(const Calib_Params ¶ms); //BBS: add only gcode mode + bool is_gcode_3mf() { return m_only_gcode && m_exported_file; } bool only_gcode_mode() { return m_only_gcode; } void set_only_gcode(bool only_gcode) { m_only_gcode = only_gcode; }