From d65d61a586e56af35c06f956e720aab87ab6e6e7 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Wed, 30 Oct 2024 20:34:46 +0800 Subject: [PATCH] ENH: CLI: support filament unprintable check JIRA: no-jira Change-Id: Iffb400f5cf6df062179e8d8426aa0dca05a7500c --- src/BambuStudio.cpp | 10 +++++++++- src/libslic3r/Utils.hpp | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/BambuStudio.cpp b/src/BambuStudio.cpp index 5f75b7498..2e2882c43 100644 --- a/src/BambuStudio.cpp +++ b/src/BambuStudio.cpp @@ -145,7 +145,8 @@ std::map cli_errors = { {CLI_OBJECT_COLLISION_IN_LAYER_PRINT, "Object conflicts were detected. Please verify the slicing of all plates in Bambu Studio before uploading."}, {CLI_SPIRAL_MODE_INVALID_PARAMS, "Some slicing parameters cannot work with Spiral Vase mode. Please solve the issue in Bambu Studio before uploading."}, {CLI_SLICING_ERROR, "Failed slicing the model. Please verify the slicing of all plates on Bambu Studio before uploading."}, - {CLI_GCODE_PATH_CONFLICTS, " G-code conflicts detected after slicing. Please make sure the 3mf file can be successfully sliced in the latest Bambu Studio."} + {CLI_GCODE_PATH_CONFLICTS, " G-code conflicts detected after slicing. Please make sure the 3mf file can be successfully sliced in the latest Bambu Studio."}, + {CLI_FILAMENT_UNPRINTABLE_ON_FIRST_LAYER, "Found some filament unprintable at first layer on current Plate. Please make sure the 3mf file can be successfully sliced with the same Plate type in the latest Bambu Studio."} }; typedef struct _sliced_plate_info{ @@ -5516,6 +5517,13 @@ int CLI::run(int argc, char **argv) slice_time[TIME_USING_CACHE] = slice_time[TIME_USING_CACHE] + ((long long)Slic3r::Utils::get_current_milliseconds_time_utc() - temp_time); BOOST_LOG_TRIVIAL(info) << "export_gcode finished: time_using_cache update to " << slice_time[TIME_USING_CACHE] << " secs."; + if (gcode_result && gcode_result->filament_printable_reuslt.has_value()) { + //found gcode error + BOOST_LOG_TRIVIAL(error) << "plate " << index + 1 << ": found some filament unprintable on current bed- "<< gcode_result->filament_printable_reuslt.plate_name << std::endl; + record_exit_reson(outfile_dir, CLI_FILAMENT_UNPRINTABLE_ON_FIRST_LAYER, index + 1, cli_errors[CLI_FILAMENT_UNPRINTABLE_ON_FIRST_LAYER], sliced_info); + flush_and_exit(CLI_FILAMENT_UNPRINTABLE_ON_FIRST_LAYER); + } + //outfile_final = (dynamic_cast(print))->print_statistics().finalize_output_path(outfile); //m_fff_print->export_gcode(m_temp_output_path, m_gcode_result, [this](const ThumbnailsParams& params) { return this->render_thumbnails(params); }); }/* else { diff --git a/src/libslic3r/Utils.hpp b/src/libslic3r/Utils.hpp index b63b49573..711cff864 100644 --- a/src/libslic3r/Utils.hpp +++ b/src/libslic3r/Utils.hpp @@ -63,6 +63,7 @@ #define CLI_SLICING_ERROR -100 #define CLI_GCODE_PATH_CONFLICTS -101 +#define CLI_FILAMENT_UNPRINTABLE_ON_FIRST_LAYER -103 namespace boost { namespace filesystem { class directory_entry; }}