From 682658404f736f850a881883ca2cc1e03b3833e3 Mon Sep 17 00:00:00 2001 From: FormerLurker Date: Sun, 10 May 2020 13:01:25 -0500 Subject: [PATCH] Add postprocessing settings and copyright info to output gcode file. --- .../data/lib/c/arc_welder/arc_welder.cpp | 14 +++++++++++++- .../data/lib/c/arc_welder/arc_welder.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/octoprint_arc_welder/data/lib/c/arc_welder/arc_welder.cpp b/octoprint_arc_welder/data/lib/c/arc_welder/arc_welder.cpp index 89adbe3..84de1f5 100644 --- a/octoprint_arc_welder/data/lib/c/arc_welder/arc_welder.cpp +++ b/octoprint_arc_welder/data/lib/c/arc_welder/arc_welder.cpp @@ -189,6 +189,7 @@ arc_welder_results arc_welder::process() { if (output_file_.is_open()) { + add_arcwelder_comment_to_target(); if (info_logging_enabled_) { stream.clear(); @@ -614,7 +615,6 @@ std::string arc_welder::create_g92_e(double absolute_e) int arc_welder::write_gcode_to_file(std::string gcode) { output_file_ << utilities::trim(gcode) << "\n"; - //std::cout << utilities::trim(gcode) << "\n"; return 1; } @@ -664,4 +664,16 @@ std::string arc_welder::get_arc_gcode_absolute(double e, double f, const std::st } +void arc_welder::add_arcwelder_comment_to_target() +{ + std::stringstream stream; + stream << std::fixed << std::setprecision(2); + stream << "; Postprocessed by [ArcWelder](https://github.com/FormerLurker/ArcWelderLib)\n"; + stream << "; Copyright(C) 2020 - Brad Hochgesang\n"; + stream << "; arc_welder_resolution_mm = " << resolution_mm_ << "\n"; + stream << "; arc_welder_g90_influences_extruder = " << (gcode_position_args_.g90_influences_extruder ? "True" : "False") << "\n\n"; + + output_file_ << stream.str(); +} + diff --git a/octoprint_arc_welder/data/lib/c/arc_welder/arc_welder.h b/octoprint_arc_welder/data/lib/c/arc_welder/arc_welder.h index d1ab85c..bad6aaa 100644 --- a/octoprint_arc_welder/data/lib/c/arc_welder/arc_welder.h +++ b/octoprint_arc_welder/data/lib/c/arc_welder/arc_welder.h @@ -104,6 +104,7 @@ class arc_welder protected: virtual bool on_progress_(arc_welder_progress progress); private: + void add_arcwelder_comment_to_target(); void reset(); static gcode_position_args get_args_(bool g90_g91_influences_extruder, int buffer_size); progress_callback progress_callback_;