diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 13ca4ced67..6e164e20b6 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1484,13 +1484,16 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato for (auto layer : object->support_layers()) zs.push_back(layer->print_z); } - std::sort(zs.begin(), zs.end()); - //BBS: merge numerically very close Z values. - auto end_it = std::unique(zs.begin(), zs.end()); - m_layer_count = (unsigned int)(end_it - zs.begin()); - for (auto it = zs.begin(); it != end_it - 1; it++) { - if (abs(*it - *(it + 1)) < EPSILON) - m_layer_count--; + if (!zs.empty()) + { + std::sort(zs.begin(), zs.end()); + //BBS: merge numerically very close Z values. + auto end_it = std::unique(zs.begin(), zs.end()); + m_layer_count = (unsigned int)(end_it - zs.begin()); + for (auto it = zs.begin(); it != end_it - 1; it++) { + if (abs(*it - *(it + 1)) < EPSILON) + m_layer_count--; + } } } print.throw_if_canceled(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index fcc362dd21..3b39d2ccf3 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4716,6 +4716,7 @@ void Plater::priv::export_gcode(fs::path output_path, bool output_path_on_remova unsigned int Plater::priv::update_restart_background_process(bool force_update_scene, bool force_update_preview) { bool switch_print = true; + //BBS: judge whether can switch print or not if ((partplate_list.get_plate_count() > 1) && !this->background_process.can_switch_print()) { @@ -11199,7 +11200,8 @@ int Plater::select_plate(int plate_index, bool need_slice) { if (need_slice) { //from preview's thumbnail if ((invalidated & PrintBase::APPLY_STATUS_INVALIDATED) || (gcode_result->moves.empty())){ - //part_plate->update_slice_result_valid_state(false); + if (invalidated & PrintBase::APPLY_STATUS_INVALIDATED) + part_plate->update_slice_result_valid_state(false); p->process_completed_with_error = -1; p->m_slice_all = false; reset_gcode_toolpaths();