@@ -5520,6 +5520,14 @@ bool Sidebar::has_broken_mixed_filament() const
55205520{
55215521 auto* plater = dynamic_cast<Plater*>(GetParent());
55225522 if (!plater) return false;
5523+ return has_broken_mixed_filament(plater->get_partplate_list().get_curr_plate());
5524+ }
5525+
5526+ bool Sidebar::has_broken_mixed_filament(const PartPlate* plate) const
5527+ {
5528+ if (!plate) return false;
5529+ auto* plater = dynamic_cast<Plater*>(GetParent());
5530+ if (!plater) return false;
55235531
55245532 auto& project_config = wxGetApp().preset_bundle->project_config;
55255533 auto* is_mixed_opt = project_config.option<ConfigOptionBools>("filament_is_mixed");
@@ -5555,13 +5563,10 @@ bool Sidebar::has_broken_mixed_filament() const
55555563 std::set<size_t> broken_1based;
55565564 for (size_t s : broken_slots) broken_1based.insert(s + 1);
55575565
5558- // Scan model objects on current plate for raw extruder assignments
5566+ // Scan model objects on the given plate for raw extruder assignments
55595567 // (don't use get_extruders() which expands mixed slots)
5560- auto* curr_plate = plater->get_partplate_list().get_curr_plate();
5561- if (!curr_plate) return false;
5562-
55635568 for (auto& entry : plater->model().objects) {
5564- if (!curr_plate ->contain_instance_totally(entry, 0))
5569+ if (!plate ->contain_instance_totally(entry, 0))
55655570 continue;
55665571 // Check object-level extruder
55675572 int obj_ext = entry->config.has("extruder") ? entry->config.extruder() : 1;
@@ -10849,9 +10854,11 @@ void Plater::priv::set_current_panel(wxPanel* panel, bool no_slice)
1084910854 if (current_plate->is_slice_result_valid() && this->model.objects.empty() && !current_has_print_instances)
1085010855 only_has_gcode_need_preview = true;
1085110856
10852- BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": from set_current_panel, no_slice %1%, export_in_progress %2%, model_fits %3%, m_is_slicing %4%")%no_slice%export_in_progress%model_fits%m_is_slicing;
10857+ bool mixed_broken = sidebar->has_broken_mixed_filament();
10858+
10859+ BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": from set_current_panel, no_slice %1%, export_in_progress %2%, model_fits %3%, m_is_slicing %4%, mixed_broken %5%")%no_slice%export_in_progress%model_fits%m_is_slicing%mixed_broken;
1085310860
10854- if (!no_slice && !this->model.objects.empty() && !export_in_progress && model_fits && current_has_print_instances)
10861+ if (!no_slice && !this->model.objects.empty() && !export_in_progress && model_fits && current_has_print_instances && !mixed_broken )
1085510862 {
1085610863 //if already running in background, not relice here
1085710864 //BBS: add more judge for slicing
@@ -20311,6 +20318,11 @@ void Plater::reslice()
2031120318 return;
2031220319 }
2031320320
20321+ if (sidebar().has_broken_mixed_filament()) {
20322+ BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": broken mixed filament detected, refuse to slice";
20323+ return;
20324+ }
20325+
2031420326 // In case SLA gizmo is in editing mode, refuse to continue
2031520327 // and notify user that he should leave it first.
2031620328 if (get_view3D_canvas3D()->get_gizmos_manager().is_in_editing_mode(true))
0 commit comments