mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 18:27:58 -06:00
tweak generator info and use local time stamp for better readability
This commit is contained in:
parent
f914a36a7f
commit
2895477da4
4 changed files with 15 additions and 10 deletions
|
@ -1193,6 +1193,9 @@ ConfigSubstitutions ConfigBase::load_from_gcode_file(const std::string &file, Fo
|
||||||
std::string bambuslicer_gcode_header = "; ";
|
std::string bambuslicer_gcode_header = "; ";
|
||||||
bambuslicer_gcode_header += SLIC3R_APP_NAME;
|
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;
|
std::string header;
|
||||||
bool header_found = false;
|
bool header_found = false;
|
||||||
while (std::getline(ifs, header)) {
|
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_word(line_c);
|
||||||
line_c = skip_whitespaces(line_c);
|
line_c = skip_whitespaces(line_c);
|
||||||
// BBS
|
// 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;
|
header_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1499,7 +1499,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
|
|
||||||
file.write_format("; HEADER_BLOCK_START\n");
|
file.write_format("; HEADER_BLOCK_START\n");
|
||||||
// Write information on the generator.
|
// 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
|
//BBS: total estimated printing time
|
||||||
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str());
|
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str());
|
||||||
//BBS: total layer number
|
//BBS: total layer number
|
||||||
|
@ -1531,13 +1531,10 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
file.write("; CONFIG_BLOCK_END\n\n");
|
file.write("; CONFIG_BLOCK_END\n\n");
|
||||||
} else {
|
} else {
|
||||||
file.write_format("; hack-fix: write fake slicer info here so that "
|
file.write_format("; hack-fix: write fake slicer info here so that "
|
||||||
"Moonraker will extract thumbs.\n");
|
"preprocess_cancellation can process.\n");
|
||||||
file.write_format(
|
file.write_format("; %s\n\n", std::string(std::string("generated by SuperSlicer " SoftFever_VERSION " on ") +
|
||||||
"; %s\n\n",
|
Slic3r::Utils::local_timestamp())
|
||||||
std::string(
|
.c_str());
|
||||||
std::string("generated by SuperSlicer " SoftFever_VERSION " on ") +
|
|
||||||
Slic3r::Utils::utc_timestamp())
|
|
||||||
.c_str());
|
|
||||||
|
|
||||||
DoExport::export_thumbnails_to_file(
|
DoExport::export_thumbnails_to_file(
|
||||||
thumbnail_cb, print.get_plate_index(), print.full_print_config().option<ConfigOptionPoints>("thumbnails")->values,
|
thumbnail_cb, print.get_plate_index(), print.full_print_config().option<ConfigOptionPoints>("thumbnails")->values,
|
||||||
|
|
|
@ -784,7 +784,7 @@ std::string Model::get_backup_path()
|
||||||
std::time_t t = std::time(0);
|
std::time_t t = std::time(0);
|
||||||
std::tm* now_time = std::localtime(&t);
|
std::tm* now_time = std::localtime(&t);
|
||||||
std::stringstream buf;
|
std::stringstream buf;
|
||||||
buf << "/bamboo_model/";
|
buf << "/orcaslicer_model/";
|
||||||
buf << std::put_time(now_time, "%a_%b_%d/%H_%M_%S#");
|
buf << std::put_time(now_time, "%a_%b_%d/%H_%M_%S#");
|
||||||
buf << pid << "#";
|
buf << pid << "#";
|
||||||
buf << this->id().id;
|
buf << this->id().id;
|
||||||
|
|
|
@ -32,6 +32,10 @@ inline std::string utc_timestamp()
|
||||||
return utc_timestamp(get_current_time_utc());
|
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.
|
// 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);
|
time_t str2time(const std::string &str, TimeZone zone, TimeFormat fmt);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue