diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 7f4b232d7..f911c2ae9 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3006,6 +3006,9 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re bool filament_printable = cur_plate->check_filament_printable(wxGetApp().preset_bundle->full_config(), filament_printable_error_msg); _set_warning_notification(EWarning::FilamentPrintableError, !filament_printable); + bool mix_pla_and_petg = cur_plate->check_mixture_of_pla_and_petg(wxGetApp().preset_bundle->full_config()); + _set_warning_notification(EWarning::MixUsePLAAndPETG, !mix_pla_and_petg); + bool model_fits = contained_min_one && !m_model->objects.empty() && !partlyOut && object_results.filaments.empty() && tpu_valid; post_event(Event(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, model_fits)); ppl.get_curr_plate()->update_slice_ready_status(model_fits); @@ -3017,6 +3020,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re //_set_warning_notification(EWarning::SlaSupportsOutside, false); _set_warning_notification(EWarning::TPUPrintableError, false); _set_warning_notification(EWarning::FilamentPrintableError, false); + _set_warning_notification(EWarning::MixUsePLAAndPETG, false); post_event(Event(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, false)); } } @@ -10161,6 +10165,9 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) error = ErrorType::SLICING_ERROR; break; } + case EWarning::MixUsePLAAndPETG: + text = _u8L("PLA and PETG filaments detected in the mixture. Adjust parameters according to the Wiki to ensure print quality."); + break; } //BBS: this may happened when exit the app, plater is null if (!wxGetApp().plater()) diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 579b5238a..bf5ffc0fb 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -385,7 +385,8 @@ class GLCanvas3D FilamentPrintableError, MultiExtruderPrintableError, // after slice MultiExtruderHeightOutside, // after slice - FilamentUnPrintableOnFirstLayer + FilamentUnPrintableOnFirstLayer, + MixUsePLAAndPETG }; class RenderStats diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 9e3a947d1..dce2e3fcf 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -1364,6 +1364,29 @@ bool PartPlate::check_tpu_printable_status(const DynamicPrintConfig & config, co return tpu_valid; } +bool PartPlate::check_mixture_of_pla_and_petg(const DynamicPrintConfig &config) +{ + bool has_pla = false; + bool has_petg = false; + + std::vector used_filaments = get_extruders(true); // 1 base + if (!used_filaments.empty()) { + for (auto filament_idx : used_filaments) { + int filament_id = filament_idx - 1; + std::string filament_type = config.option("filament_type")->values.at(filament_id); + if (filament_type == "PLA") + has_pla = true; + if (filament_type == "PETG") + has_petg = true; + } + } + + if (has_pla && has_petg) + return false; + + return true; +} + Vec3d PartPlate::estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double wipe_volume, int plate_extruder_size, bool use_global_objects) const { Vec3d wipe_tower_size; diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index b8c490adb..bcb8e267a 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -316,6 +316,7 @@ public: int get_physical_extruder_by_filament_id(const DynamicConfig& g_config, int idx) const; bool check_filament_printable(const DynamicPrintConfig & config, wxString& error_message); bool check_tpu_printable_status(const DynamicPrintConfig & config, const std::vector &tpu_filaments); + bool check_mixture_of_pla_and_petg(const DynamicPrintConfig & config); /* instance related operations*/ //judge whether instance is bound in plate or not diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index a13272cb3..c93cbe953 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3837,7 +3837,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) "nozzle_height", "skirt_loops", "skirt_distance", "brim_width", "brim_object_gap", "brim_type", "nozzle_diameter", "single_extruder_multi_material", "enable_prime_tower", "wipe_tower_x", "wipe_tower_y", "prime_tower_width", "prime_tower_brim_width", "prime_tower_outer_first", "prime_tower_skip_points", "prime_volume", - "extruder_colour", "filament_colour", "material_colour", "printable_height", "extruder_printable_height", "printer_model", "printer_technology", + "extruder_colour", "filament_colour", "filament_type", "material_colour", "printable_height", "extruder_printable_height", "printer_model", "printer_technology", // These values are necessary to construct SlicingParameters by the Canvas3D variable layer height editor. "layer_height", "initial_layer_print_height", "min_layer_height", "max_layer_height", "brim_width", "wall_loops", "wall_filament", "sparse_infill_density", "sparse_infill_filament", "top_shell_layers", @@ -14460,7 +14460,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config) continue; } } - if (opt_key == "material_colour") { + if (opt_key == "material_colour" || opt_key == "filament_type") { update_scheduled = true; // update should be scheduled (for update 3DScene) }