From 7ae77c06d034f426bc72929d06b875a0e7d9ea6e Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 27 Apr 2021 15:12:45 +0200 Subject: [PATCH] Tech ENABLE_SEAMS_VISUALIZATION -> Added threshold to place seams --- src/libslic3r/GCode/GCodeProcessor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index c64725e50..a4fd429b5 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -2375,10 +2375,12 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line) const Vec3f curr_pos(m_end_position[X], m_end_position[Y], m_end_position[Z]); const Vec3f new_pos = m_result.moves.back().position - m_extruder_offsets[m_extruder_id]; const std::optional first_vertex = m_seams_detector.get_first_vertex(); - const Vec3f mid_pos = 0.5f * (new_pos + *first_vertex); - set_end_position(mid_pos); - store_move_vertex(EMoveType::Seam); - set_end_position(curr_pos); + // the threshold value = 0.25 is arbitrary, we may find some smarter condition later + if ((new_pos - *first_vertex).norm() < 0.25f) { + set_end_position(0.5f * (new_pos + *first_vertex)); + store_move_vertex(EMoveType::Seam); + set_end_position(curr_pos); + } m_seams_detector.activate(false); }