This commit is contained in:
Jeff Young 2022-04-09 20:39:35 +01:00
parent 18fb2ddff6
commit 82820d4b1c
1 changed files with 12 additions and 13 deletions

View File

@ -404,12 +404,17 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone( BOARD_ITEM* aItem,
int clearance = -1; int clearance = -1;
int actual; int actual;
VECTOR2I pos; VECTOR2I pos;
PCB_VIA* via = nullptr;
PAD* pad = nullptr; PAD* pad = nullptr;
bool flashed = false; bool flashed = false;
bool hasHole = false; bool hasHole = false;
bool platedHole = false; bool platedHole = false;
if( aItem->Type() == PCB_PAD_T ) if( aItem->Type() == PCB_VIA_T )
{
via = static_cast<PCB_VIA*>( aItem );
}
else if( aItem->Type() == PCB_PAD_T )
{ {
pad = static_cast<PAD*>( aItem ); pad = static_cast<PAD*>( aItem );
flashed = pad->FlashLayer( aLayer ); flashed = pad->FlashLayer( aLayer );
@ -466,24 +471,18 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone( BOARD_ITEM* aItem,
} }
} }
if( zoneTree && testHoles && ( aItem->Type() == PCB_VIA_T || aItem->Type() == PCB_PAD_T ) ) if( zoneTree && testHoles && ( pad || via ) )
{ {
std::unique_ptr<SHAPE_SEGMENT> holeShape; std::unique_ptr<SHAPE_SEGMENT> holeShape;
if( aItem->Type() == PCB_VIA_T ) if( via && via->GetLayerSet().Contains( aLayer ) )
{ {
PCB_VIA* via = static_cast<PCB_VIA*>( aItem ); holeShape.reset( new SHAPE_SEGMENT( via->GetPosition(), via->GetPosition(),
pos = via->GetPosition(); via->GetDrill() ) );
if( via->GetLayerSet().Contains( aLayer ) )
holeShape.reset( new SHAPE_SEGMENT( pos, pos, via->GetDrill() ) );
} }
else if( aItem->Type() == PCB_PAD_T ) else if( pad && pad->GetDrillSize().x )
{ {
PAD* pad = static_cast<PAD*>( aItem ); holeShape.reset( new SHAPE_SEGMENT( *pad->GetEffectiveHoleShape() ) );
if( pad->GetDrillSize().x )
holeShape.reset( new SHAPE_SEGMENT( *pad->GetEffectiveHoleShape() ) );
} }
if( holeShape ) if( holeShape )