From 6789dac20bff8030617091af90729bac6eace203 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 6 Jun 2021 18:56:33 -0400 Subject: [PATCH] PNS: Keep most recent good placement around for a rainy day Fixes https://gitlab.com/kicad/code/kicad/-/issues/8562 --- pcbnew/router/pns_line_placer.cpp | 15 +++++++++++++-- pcbnew/router/pns_line_placer.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 9d02e5131a..2ec2f57da5 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -960,8 +960,19 @@ void LINE_PLACER::routeStep( const VECTOR2I& aP ) if( fail ) { - m_head.RemoveVia(); - m_head.Clear(); + if( m_last_head.PointCount() > 0 ) + { + m_head = m_last_head; + } + else + { + m_head.RemoveVia(); + m_head.Clear(); + } + } + else + { + m_last_head = m_head; } if( !fail && Settings().FollowMouse() ) diff --git a/pcbnew/router/pns_line_placer.h b/pcbnew/router/pns_line_placer.h index c48aadad31..5b4ad15b02 100644 --- a/pcbnew/router/pns_line_placer.h +++ b/pcbnew/router/pns_line_placer.h @@ -328,6 +328,8 @@ private: LINE m_head; ///< the volatile part of the track from the previously ///< analyzed point to the current routing destination + LINE m_last_head; ///< Most recent successful (non-colliding) head + LINE m_tail; ///< routing "tail": part of the track that has been already ///< fixed due to collisions with obstacles