Remove vias if they only connect to single layer
A via takes up zone space on additional layers, so if we are not connecting to those layers, then we should remove it. Fixes https://gitlab.com/kicad/code/kicad/issues/7004
This commit is contained in:
parent
1e96374715
commit
6ffb72159a
|
@ -612,6 +612,27 @@ bool CONNECTIVITY_DATA::TestTrackEndpointDangling( TRACK* aTrack, wxPoint* aPos
|
|||
}
|
||||
}
|
||||
|
||||
// Test if a via is only connected on one layer
|
||||
if( aTrack->Type() == PCB_VIA_T )
|
||||
{
|
||||
const CN_ITEM::CONNECTED_ITEMS& connected = citem->ConnectedItems();
|
||||
|
||||
// This is a bit redundant but better safe than sorry here
|
||||
if( connected.empty() )
|
||||
return true;
|
||||
|
||||
// Here, we check if the via is connected only to items on a single layer
|
||||
int first_layer = connected.front()->Layer();
|
||||
|
||||
for( auto& item : connected )
|
||||
{
|
||||
if( item->Layer() != first_layer )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue