diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index da4cec78d6..57a60fda06 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -1193,6 +1193,9 @@ ConfigSubstitutions ConfigBase::load_from_gcode_file(const std::string &file, Fo std::string bambuslicer_gcode_header = "; "; bambuslicer_gcode_header += SLIC3R_APP_NAME; + std::string orcaslicer_gcode_header = std::string("; generated by "); + orcaslicer_gcode_header += Slic3r::header_slic3r_generated(); + std::string header; bool header_found = false; while (std::getline(ifs, header)) { @@ -1202,7 +1205,8 @@ ConfigSubstitutions ConfigBase::load_from_gcode_file(const std::string &file, Fo line_c = skip_word(line_c); line_c = skip_whitespaces(line_c); // BBS - if (strncmp(bambuslicer_gcode_header.c_str(), line_c, strlen(bambuslicer_gcode_header.c_str())) == 0) { + if (strncmp(bambuslicer_gcode_header.c_str(), line_c, strlen(bambuslicer_gcode_header.c_str())) == 0 || + strncmp(orcaslicer_gcode_header.c_str(), line_c, strlen(orcaslicer_gcode_header.c_str())) == 0) { header_found = true; break; } diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 6d01badf2e..67a53958dc 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1499,7 +1499,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato file.write_format("; HEADER_BLOCK_START\n"); // Write information on the generator. - file.write_format("; %s\n", Slic3r::header_slic3r_generated().c_str()); + file.write_format("; generated by %s on %s\n", Slic3r::header_slic3r_generated().c_str(), Slic3r::Utils::local_timestamp().c_str()); //BBS: total estimated printing time file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str()); //BBS: total layer number @@ -1531,13 +1531,10 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato file.write("; CONFIG_BLOCK_END\n\n"); } else { file.write_format("; hack-fix: write fake slicer info here so that " - "Moonraker will extract thumbs.\n"); - file.write_format( - "; %s\n\n", - std::string( - std::string("generated by SuperSlicer " SoftFever_VERSION " on ") + - Slic3r::Utils::utc_timestamp()) - .c_str()); + "preprocess_cancellation can process.\n"); + file.write_format("; %s\n\n", std::string(std::string("generated by SuperSlicer " SoftFever_VERSION " on ") + + Slic3r::Utils::local_timestamp()) + .c_str()); DoExport::export_thumbnails_to_file( thumbnail_cb, print.get_plate_index(), print.full_print_config().option("thumbnails")->values, diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index 15e30a3482..3d4d26fb86 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -784,7 +784,7 @@ std::string Model::get_backup_path() std::time_t t = std::time(0); std::tm* now_time = std::localtime(&t); std::stringstream buf; - buf << "/bamboo_model/"; + buf << "/orcaslicer_model/"; buf << std::put_time(now_time, "%a_%b_%d/%H_%M_%S#"); buf << pid << "#"; buf << this->id().id; diff --git a/src/libslic3r/Time.hpp b/src/libslic3r/Time.hpp index c03251986b..026a6f22bc 100644 --- a/src/libslic3r/Time.hpp +++ b/src/libslic3r/Time.hpp @@ -32,6 +32,10 @@ inline std::string utc_timestamp() return utc_timestamp(get_current_time_utc()); } +inline std::string local_timestamp() { + return time2str(get_current_time_utc(), TimeZone::local, TimeFormat::gcode); +} + // String to time_t function. Returns time_t(-1) if fails to parse the input. time_t str2time(const std::string &str, TimeZone zone, TimeFormat fmt);