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
This commit is contained in:
Jeff Young 2022-10-07 18:11:19 +01:00
parent b8dfbe02ad
commit d6f1d5da76
1 changed files with 23 additions and 12 deletions

View File

@ -224,16 +224,23 @@ bool ROUTER::isStartingPointRoutable( const VECTOR2I& aWhere, ITEM* aStartItem,
}
ITEM_SET candidates = QueryHoverItems( aWhere );
wxString failureReason;
for( ITEM* item : candidates.Items() )
{
if( item->Parent() && item->Parent()->GetLayer() == Edge_Cuts )
{
// Edge cuts are put on all layers, but they're not *really* on all layers
if( item->Parent() && item->Parent()->GetLayer() == Edge_Cuts )
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<PAD*>( 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 )