From 4c193828056771381f7bfc6f04133bd1a45447ac Mon Sep 17 00:00:00 2001 From: FormerLurker Date: Sat, 13 Nov 2021 13:37:28 -0600 Subject: Encode more points when moving to/from extruding/retracting/travel. --- ArcWelder/arc_welder.cpp | 8 +++++--- ArcWelder/segmented_arc.cpp | 8 +++++--- ArcWelderTest/ArcWelderTest.cpp | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ArcWelder/arc_welder.cpp b/ArcWelder/arc_welder.cpp index fe129b4..ab2f6ef 100644 --- a/ArcWelder/arc_welder.cpp +++ b/ArcWelder/arc_welder.cpp @@ -582,11 +582,13 @@ int arc_welder::process_gcode(parsed_command cmd, bool is_end, bool is_reprocess ( !waiting_for_arc_ || extruder_current.is_extruding || + extruder_current.is_retracting || // Test for travel conversion - (allow_travel_arcs_ && p_cur_pos->is_travel()) || - //(previous_extruder.is_extruding && extruder_current.is_extruding) || // Test to see if + (allow_travel_arcs_ && p_cur_pos->is_travel()) + //|| (previous_extruder.is_extruding && extruder_current.is_extruding) // Test to see if + // we can get more arcs. + // || (previous_extruder.is_retracting && extruder_current.is_retracting) // Test to see if // we can get more arcs. - (previous_extruder.is_retracting && extruder_current.is_retracting) ) && p_cur_pos->is_extruder_relative == is_previous_extruder_relative && (!waiting_for_arc_ || p_pre_pos->f == p_cur_pos->f) && // might need to skip the waiting for arc check... diff --git a/ArcWelder/segmented_arc.cpp b/ArcWelder/segmented_arc.cpp index 527ad3a..f6cfff1 100644 --- a/ArcWelder/segmented_arc.cpp +++ b/ArcWelder/segmented_arc.cpp @@ -155,13 +155,15 @@ bool segmented_arc::try_add_point(printer_point p) return false; } - // Need to separate travel moves from moves with extrusion - if (points_.count() > 1) + // If we have more than 2 points, we need to make sure the current and previous moves are all of the same type. + if (points_.count() > 2) { + // TODO: Do we need this? // We already have at least an initial point and a second point. Make cure the current point and the previous are either both // travel moves, or both extrusion if (!( - (p1.e_relative != 0 && p.e_relative != 0) // Extrusions + (p1.e_relative > 0 && p.e_relative > 0) // Extrusions + || (p1.e_relative < 0 && p.e_relative < 0) // Retractions || (p1.e_relative == 0 && p.e_relative == 0) // Travel ) ) diff --git a/ArcWelderTest/ArcWelderTest.cpp b/ArcWelderTest/ArcWelderTest.cpp index 31ca28f..2aaa8e4 100644 --- a/ArcWelderTest/ArcWelderTest.cpp +++ b/ArcWelderTest/ArcWelderTest.cpp @@ -306,7 +306,7 @@ static void TestAntiStutter(std::string filePath) // BENCHY_L1_DIFFICULT // SPIRAL_TEST // SPIRAL_VASE_TEST_FUNNEL - std::string source_path = TravelWipeTest; + std::string source_path = BENCHY_DIFFICULT; std::string target_path = "C:\\Users\\Brad\\Documents\\3DPrinter\\AntiStutter\\test_output.gcode"; arc_welder_args args(source_path, target_path, p_logger); args.callback = on_progress; @@ -315,6 +315,7 @@ static void TestAntiStutter(std::string filePath) args.allow_3d_arcs = true; args.max_radius_mm = 9999; args.resolution_mm = 0.05; + args.extrusion_rate_variance_percent = 1000; arc_welder arc_welder_obj(args); arc_welder_results results = arc_welder_obj.process(); -- cgit v1.2.3