Browse Source

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
6.0.7
Seth Hillbrand 5 years ago
parent
commit
6ffb72159a
  1. 21
      pcbnew/connectivity/connectivity_data.cpp

21
pcbnew/connectivity/connectivity_data.cpp

@ -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…
Cancel
Save