Don't connect disparate nets

Only some elements get their nets assigned based on connectivity.  Other
elements should be keps in different clusters for connection

Fixes https://gitlab.com/kicad/code/kicad/issues/12622
This commit is contained in:
Seth Hillbrand 2022-10-11 15:02:22 -07:00
parent 148467d2a1
commit c9f11827a7
1 changed files with 4 additions and 6 deletions

View File

@ -745,9 +745,6 @@ void CN_CONNECTIVITY_ALGO::MarkNetAsDirty( int aNet )
void CN_VISITOR::checkZoneItemConnection( CN_ZONE_LAYER* aZoneLayer, CN_ITEM* aItem ) void CN_VISITOR::checkZoneItemConnection( CN_ZONE_LAYER* aZoneLayer, CN_ITEM* aItem )
{ {
if( aZoneLayer->Net() != aItem->Net() && !aItem->CanChangeNet() )
return;
PCB_LAYER_ID layer = aZoneLayer->GetLayer(); PCB_LAYER_ID layer = aZoneLayer->GetLayer();
if( !aItem->Parent()->IsOnLayer( layer ) ) if( !aItem->Parent()->IsOnLayer( layer ) )
@ -789,9 +786,6 @@ void CN_VISITOR::checkZoneZoneConnection( CN_ZONE_LAYER* aZoneLayerA, CN_ZONE_LA
const ZONE* zoneA = static_cast<const ZONE*>( aZoneLayerA->Parent() ); const ZONE* zoneA = static_cast<const ZONE*>( aZoneLayerA->Parent() );
const ZONE* zoneB = static_cast<const ZONE*>( aZoneLayerB->Parent() ); const ZONE* zoneB = static_cast<const ZONE*>( aZoneLayerB->Parent() );
if( aZoneLayerB->Net() != aZoneLayerA->Net() )
return; // we only test zones belonging to the same net
const BOX2I& boxA = aZoneLayerA->BBox(); const BOX2I& boxA = aZoneLayerA->BBox();
const BOX2I& boxB = aZoneLayerB->BBox(); const BOX2I& boxB = aZoneLayerB->BBox();
@ -848,6 +842,10 @@ bool CN_VISITOR::operator()( CN_ITEM* aCandidate )
if( parentA == parentB ) if( parentA == parentB )
return true; return true;
// Don't connect items in different nets that can't be changed
if( !aCandidate->CanChangeNet() && !m_item->CanChangeNet() && aCandidate->Net() != m_item->Net() )
return true;
// If both m_item and aCandidate are marked dirty, they will both be searched // If both m_item and aCandidate are marked dirty, they will both be searched
// Since we are reciprocal in our connection, we arbitrarily pick one of the connections // Since we are reciprocal in our connection, we arbitrarily pick one of the connections
// to conduct the expensive search // to conduct the expensive search