Skip to content

Commit da6f2e9

Browse files
FengMi-BamBulanewei120
authored andcommitted
ENH: 含有broken耗材的盘预览禁止切片
jira: none Change-Id: I4e51de17e2d433be49e9b1834d346d0c06bc93a1
1 parent 4c420b5 commit da6f2e9

3 files changed

Lines changed: 23 additions & 8 deletions

File tree

src/slic3r/GUI/GLCanvas3D.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8754,7 +8754,9 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
87548754
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::SLICE_FAILED;
87558755
}
87568756
else {
8757-
if ((plate_list.get_plate(i)->has_printable_instances() && !plate_list.get_plate(i)->can_slice()) || plate_list.get_plate(i)->has_outside_object())
8757+
if ((plate_list.get_plate(i)->has_printable_instances() && !plate_list.get_plate(i)->can_slice())
8758+
|| plate_list.get_plate(i)->has_outside_object()
8759+
|| wxGetApp().plater()->sidebar().has_broken_mixed_filament(plate_list.get_plate(i)))
87588760
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::SLICE_FAILED;
87598761
else {
87608762
if (plate_list.get_plate(i)->get_slicing_percent() < 0.0f)

src/slic3r/GUI/Plater.cpp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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))

src/slic3r/GUI/Plater.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ class Sidebar : public wxPanel
269269
void recalc_filament_scroll_sizes();
270270
void update_mixed_filament_list();
271271
bool has_broken_mixed_filament() const;
272+
bool has_broken_mixed_filament(const PartPlate* plate) const;
272273
Search::OptionsSearcher& get_searcher();
273274
std::string& get_search_line();
274275
void set_is_gcode_file(bool flag);

0 commit comments

Comments
 (0)