From 3b3165ad51f130149786a3f076cac28a2cdd585a Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 9 Jun 2019 12:59:37 -0700 Subject: [PATCH] pcbnew: Allow DRC violations when marked We shouldn't consider any obstacles when we are routing in DRC violation mode. Fixes: lp:1826723 * https://bugs.launchpad.net/kicad/+bug/1826723 --- pcbnew/router/pns_line_placer.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 9ab2c22414..85e6a5d7c7 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -436,21 +436,25 @@ bool LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead ) m_currentNode->QueryColliding( &newHead, obstacles ); - for( auto& obs : obstacles ) + // If we are allowing DRC violations, we don't push back to the hull + if( !Settings().CanViolateDRC() ) { - int cl = m_currentNode->GetClearance( obs.m_item, &newHead ); - auto hull = obs.m_item->Hull( cl, newHead.Width() ); - - auto nearest = hull.NearestPoint( aP ); - Dbg()->AddLine( hull, 2, 10000 ); - - if( ( nearest - aP ).EuclideanNorm() < newHead.Width() + cl ) + for( auto& obs : obstacles ) { - buildInitialLine( nearest, newHead ); - if ( newHead.CLine().Length() > bestHead.CLine().Length() ) + int cl = m_currentNode->GetClearance( obs.m_item, &newHead ); + auto hull = obs.m_item->Hull( cl, newHead.Width() ); + + auto nearest = hull.NearestPoint( aP ); + Dbg()->AddLine( hull, 2, 10000 ); + + if( ( nearest - aP ).EuclideanNorm() < newHead.Width() + cl ) { - bestHead = newHead; - hasBest = true; + buildInitialLine( nearest, newHead ); + if ( newHead.CLine().Length() > bestHead.CLine().Length() ) + { + bestHead = newHead; + hasBest = true; + } } } }