diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 9b13ca1522..6a327fe0e3 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -1365,7 +1365,9 @@ bool LINE_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinis std::unique_ptr ap = std::make_unique( arc ); lastItem = ap.get(); - m_lastNode->Add( std::move( ap ) ); + if( !m_lastNode->Add( std::move( ap ) ) ) + lastItem = nullptr; + lastArc = arcIndex; } } diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index a9396927c2..8057a15dc9 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -662,10 +662,19 @@ void NODE::addArc( ARC* aArc ) } -void NODE::Add( std::unique_ptr< ARC > aArc ) +bool NODE::Add( std::unique_ptr< ARC > aArc, bool aAllowRedundant ) { + const SHAPE_ARC& arc = aArc->CArc(); + + if( !aAllowRedundant && findRedundantArc( arc.GetP0(), arc.GetP1(), aArc->Layers(), + aArc->Net() ) ) + { + return false; + } + aArc->SetOwner( this ); addArc( aArc.release() ); + return true; } diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h index 3b3dfb8d27..cc1ec654a7 100644 --- a/pcbnew/router/pns_node.h +++ b/pcbnew/router/pns_node.h @@ -257,7 +257,7 @@ public: bool Add( std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant = false ); void Add( std::unique_ptr< SOLID > aSolid ); void Add( std::unique_ptr< VIA > aVia ); - void Add( std::unique_ptr< ARC > aArc ); + bool Add( std::unique_ptr< ARC > aArc, bool aAllowRedundant = false ); void Add( LINE& aLine, bool aAllowRedundant = false );