From d6f1d5da768455b4aa2c4e07bcadea5cd635beb7 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 7 Oct 2022 18:11:19 +0100 Subject: [PATCH] Start-routing list needs to be a white list, not a black list. We check the collisions later in the same routine, which is where all the black-listed objects come in. Fixes https://gitlab.com/kicad/code/kicad/issues/12595 --- pcbnew/router/pns_router.cpp | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 5ba35573b9..18afbb44b3 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -224,16 +224,23 @@ bool ROUTER::isStartingPointRoutable( const VECTOR2I& aWhere, ITEM* aStartItem, } ITEM_SET candidates = QueryHoverItems( aWhere ); + wxString failureReason; for( ITEM* item : candidates.Items() ) { + // Edge cuts are put on all layers, but they're not *really* on all layers if( item->Parent() && item->Parent()->GetLayer() == Edge_Cuts ) - { - // Edge cuts are put on all layers, but they're not *really* on all layers continue; - } - if( !item->IsRoutable() && item->Layers().Overlaps( aLayer ) ) + if( !item->Layers().Overlaps( aLayer ) ) + continue; + + if( item->IsRoutable() ) + { + failureReason = wxEmptyString; + break; + } + else { BOARD_ITEM* parent = item->Parent(); @@ -244,7 +251,7 @@ bool ROUTER::isStartingPointRoutable( const VECTOR2I& aWhere, ITEM* aStartItem, PAD* pad = static_cast( parent ); if( pad->GetAttribute() == PAD_ATTRIB::NPTH ) - SetFailureReason( _( "Cannot start routing from a non-plated hole." ) ); + failureReason = _( "Cannot start routing from a non-plated hole." ); } break; @@ -255,12 +262,12 @@ bool ROUTER::isStartingPointRoutable( const VECTOR2I& aWhere, ITEM* aStartItem, if( !zone->GetZoneName().IsEmpty() ) { - SetFailureReason( wxString::Format( _( "Rule area '%s' disallows tracks." ), - zone->GetZoneName() ) ); + failureReason = wxString::Format( _( "Rule area '%s' disallows tracks." ), + zone->GetZoneName() ); } else { - SetFailureReason( _( "Rule area disallows tracks." ) ); + failureReason = _( "Rule area disallows tracks." ); } } break; @@ -269,21 +276,25 @@ bool ROUTER::isStartingPointRoutable( const VECTOR2I& aWhere, ITEM* aStartItem, case PCB_FP_TEXT_T: case PCB_TEXTBOX_T: case PCB_FP_TEXTBOX_T: - SetFailureReason( _( "Cannot start routing from a text item." ) ); + failureReason = _( "Cannot start routing from a text item." ); break; case PCB_SHAPE_T: case PCB_FP_SHAPE_T: - SetFailureReason( _( "Cannot start routing from a graphic." ) ); + failureReason = _( "Cannot start routing from a graphic." ); default: break; } - - return false; } } + if( !failureReason.IsEmpty() ) + { + SetFailureReason( failureReason ); + return false; + } + VECTOR2I startPoint = aWhere; if( m_mode == PNS_MODE_ROUTE_SINGLE )