From fe18f18b4c005a2c4e4b69a5866d0d065bde82aa Mon Sep 17 00:00:00 2001 From: FormerLurker Date: Thu, 18 Feb 2021 16:48:42 -0600 Subject: Support relative extrusion, limit feedrate output, and add comments to the inverse processor. Solves #49. --- ArcWelder/ArcWelder.vcxproj | 1 + ArcWelderConsole/ArcWelderConsole.vcxproj | 1 + .../ArcWelderInverseProcessor.vcxproj | 1 + ArcWelderInverseProcessor/inverse_processor.cpp | 24 +++++++++++++++++++--- ArcWelderTest/ArcWelderTest.cpp | 2 +- ArcWelderTest/ArcWelderTest.h | 4 +++- ArcWelderTest/ArcWelderTest.vcxproj | 1 + GcodeProcessorLib/GcodeProcessorLib.vcxproj | 1 + PyArcWelder/PyArcWelder.vcxproj | 1 + 9 files changed, 31 insertions(+), 5 deletions(-) diff --git a/ArcWelder/ArcWelder.vcxproj b/ArcWelder/ArcWelder.vcxproj index adaddf8..d52496b 100644 --- a/ArcWelder/ArcWelder.vcxproj +++ b/ArcWelder/ArcWelder.vcxproj @@ -251,6 +251,7 @@ true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true + MultiThreaded Console diff --git a/ArcWelderConsole/ArcWelderConsole.vcxproj b/ArcWelderConsole/ArcWelderConsole.vcxproj index 1433a00..9bfc6c5 100644 --- a/ArcWelderConsole/ArcWelderConsole.vcxproj +++ b/ArcWelderConsole/ArcWelderConsole.vcxproj @@ -176,6 +176,7 @@ true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true + MultiThreaded Console diff --git a/ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj b/ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj index 08f2524..37ec7d0 100644 --- a/ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj +++ b/ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj @@ -175,6 +175,7 @@ true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true + MultiThreaded Console diff --git a/ArcWelderInverseProcessor/inverse_processor.cpp b/ArcWelderInverseProcessor/inverse_processor.cpp index 59f24e2..c2f0b4d 100644 --- a/ArcWelderInverseProcessor/inverse_processor.cpp +++ b/ArcWelderInverseProcessor/inverse_processor.cpp @@ -413,15 +413,33 @@ void inverse_processor::plan_buffer_line(float x, float y, bool has_z, float z, std::stringstream stream; stream << std::fixed; - //output_file_ << + position * previous_pos = p_source_position_->get_previous_position_ptr(); + position* current_pos = p_source_position_->get_current_position_ptr(); stream << "G1 X" << std::setprecision(3) << x << " Y" << y; if (has_z) { stream << " Z" << z; } - stream << std::setprecision(5) << " E" << e; + + double output_e = e; + if (previous_pos->is_extruder_relative) + { + output_e = e - previous_pos->get_current_extruder().get_offset_e(); + } + + stream << std::setprecision(5) << " E" << output_e; + - stream << std::setprecision(0) << " F" << feed_rate << "\n"; + if (feed_rate != previous_pos->f) + { + stream << std::setprecision(0) << " F" << feed_rate; + } + + if (!current_pos->command.comment.empty()) + { + stream << ";" << current_pos->command.comment; + } + stream << "\n"; output_file_ << stream.str(); } diff --git a/ArcWelderTest/ArcWelderTest.cpp b/ArcWelderTest/ArcWelderTest.cpp index 237c2ac..9add004 100644 --- a/ArcWelderTest/ArcWelderTest.cpp +++ b/ArcWelderTest/ArcWelderTest.cpp @@ -292,7 +292,7 @@ static void TestAntiStutter(std::string filePath) //arc_welder arc_welder_obj(BENCHY_0_5_MM_NO_WIPE, "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\test_output.gcode", p_logger, max_resolution, false, 50, static_cast(on_progress)); //arc_welder arc_welder_obj(SIX_SPEED_TEST, "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\test_output.gcode", p_logger, max_resolution, false, 50, on_progress); arc_welder arc_welder_obj( - BENCHY_DIFFICULT, + BENCHY_L1_DIFFICULT, "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\test_output.gcode", p_logger, max_resolution, diff --git a/ArcWelderTest/ArcWelderTest.h b/ArcWelderTest/ArcWelderTest.h index db5c995..249d70b 100644 --- a/ArcWelderTest/ArcWelderTest.h +++ b/ArcWelderTest/ArcWelderTest.h @@ -67,7 +67,7 @@ static std::string DIFFICULT_CURVES = "C:\\Users\\Brad\\Documents\\3DPrinter\\An static std::string FACE_SHIELD = "C:\\Users\\Brad\\Documents\\3DPrinter\\corona_virus\\2X_Visor_Frame_0.35mm_PLA_1h25m.gcode"; static std::string SMALL_TEST = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\small_test.gcode"; static std::string SUPER_HUGE_TEST = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\super_huge_file.gcode"; -static std::string TORTURE_TEST = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\stereographic_projection_0.2mm_PLA_MK2.5MMU2_2h49m.gcode"; +//static std::string TORTURE_TEST = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\stereographic_projection_0.2mm_PLA_MK2.5MMU2_2h49m.gcode"; static std::string ORCHID_POD = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\Pla_OrchidPot.gcode"; static std::string BENCHY_DIFFICULT = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\BenchyArc_Difficult.gcode"; static std::string BENCHY_L1_DIFFICULT = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\BenchyArc_L1_Difficult.gcode"; @@ -106,6 +106,8 @@ static std::string SLOW_COUPLER = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiSt static std::string ISSUE_34 = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\spacer.gcode"; static std::string DIFFICULT_ARCS_ISSUE_34 = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\DifficultArcs\\issue_34.gcode"; +static std::string TORTURE_TEST = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\performance\\torture_test.gcode"; + diff --git a/ArcWelderTest/ArcWelderTest.vcxproj b/ArcWelderTest/ArcWelderTest.vcxproj index a0c2784..0fee64d 100644 --- a/ArcWelderTest/ArcWelderTest.vcxproj +++ b/ArcWelderTest/ArcWelderTest.vcxproj @@ -175,6 +175,7 @@ true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true + MultiThreaded Console diff --git a/GcodeProcessorLib/GcodeProcessorLib.vcxproj b/GcodeProcessorLib/GcodeProcessorLib.vcxproj index 513f74c..956df18 100644 --- a/GcodeProcessorLib/GcodeProcessorLib.vcxproj +++ b/GcodeProcessorLib/GcodeProcessorLib.vcxproj @@ -169,6 +169,7 @@ true _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true + MultiThreaded Console diff --git a/PyArcWelder/PyArcWelder.vcxproj b/PyArcWelder/PyArcWelder.vcxproj index 807a095..c49f354 100644 --- a/PyArcWelder/PyArcWelder.vcxproj +++ b/PyArcWelder/PyArcWelder.vcxproj @@ -195,6 +195,7 @@ true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true + MultiThreaded Console -- cgit v1.2.3