ENH: Add prompt information when mixture of PLA and PETG

jira: STUDIO-9659
Change-Id: I03a09dd796074d0872010672bdd85688bb7f1715
This commit is contained in:
zhimin.zeng 2025-01-14 17:51:10 +08:00 committed by lane.wei
parent 481199c6a2
commit 903b230f38
5 changed files with 35 additions and 3 deletions

View File

@ -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<bool>(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<bool>(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())

View File

@ -385,7 +385,8 @@ class GLCanvas3D
FilamentPrintableError,
MultiExtruderPrintableError, // after slice
MultiExtruderHeightOutside, // after slice
FilamentUnPrintableOnFirstLayer
FilamentUnPrintableOnFirstLayer,
MixUsePLAAndPETG
};
class RenderStats

View File

@ -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<int> 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<ConfigOptionStrings>("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;

View File

@ -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<int> &tpu_filaments);
bool check_mixture_of_pla_and_petg(const DynamicPrintConfig & config);
/* instance related operations*/
//judge whether instance is bound in plate or not

View File

@ -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)
}