NPTHs obey HOLE_CLEARANCE, not CLEARANCE.

Also, plating thickness appears on both walls, so diameter is drill
plus 2X plating thickness.
This commit is contained in:
Jeff Young 2022-04-04 20:42:00 +01:00
parent f272056f20
commit a118249093
1 changed files with 37 additions and 24 deletions

View File

@ -400,13 +400,33 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone( BOARD_ITEM* aItem,
DRC_RTREE* zoneTree = m_board->m_CopperZoneRTrees[ aZone ].get(); DRC_RTREE* zoneTree = m_board->m_CopperZoneRTrees[ aZone ].get();
EDA_RECT itemBBox = aItem->GetBoundingBox(); EDA_RECT itemBBox = aItem->GetBoundingBox();
DRC_CONSTRAINT constraint; DRC_CONSTRAINT constraint;
DRC_CONSTRAINT_T constraintType = CLEARANCE_CONSTRAINT;
int clearance = -1; int clearance = -1;
int actual; int actual;
VECTOR2I pos; VECTOR2I pos;
PAD* pad = nullptr;
bool flashed = false;
bool hasHole = false;
bool platedHole = false;
if( aItem->Type() == PCB_PAD_T )
{
pad = static_cast<PAD*>( aItem );
flashed = pad->FlashLayer( aLayer );
hasHole = pad->GetDrillSize().x > 0 || pad->GetDrillSize().y > 0;
if( !flashed && !hasHole )
return;
platedHole = hasHole && pad->GetAttribute() == PAD_ATTRIB::PTH;
}
if( zoneTree && testClearance ) if( zoneTree && testClearance )
{ {
constraint = m_drcEngine->EvalRules( CLEARANCE_CONSTRAINT, aItem, aZone, aLayer ); if( pad && !flashed && hasHole && !platedHole )
constraintType = HOLE_CLEARANCE_CONSTRAINT;
constraint = m_drcEngine->EvalRules( constraintType, aItem, aZone, aLayer );
clearance = constraint.GetValue().Min(); clearance = constraint.GetValue().Min();
} }
@ -414,29 +434,22 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone( BOARD_ITEM* aItem,
{ {
std::shared_ptr<SHAPE> itemShape = aItem->GetEffectiveShape( aLayer ); std::shared_ptr<SHAPE> itemShape = aItem->GetEffectiveShape( aLayer );
if( aItem->Type() == PCB_PAD_T ) if( pad && !flashed && hasHole )
{ {
PAD* pad = static_cast<PAD*>( aItem );
if( !pad->FlashLayer( aLayer ) )
{
if( pad->GetDrillSize().x == 0 && pad->GetDrillSize().y == 0 )
return;
const SHAPE_SEGMENT* hole = pad->GetEffectiveHoleShape(); const SHAPE_SEGMENT* hole = pad->GetEffectiveHoleShape();
int size = hole->GetWidth(); int size = hole->GetWidth();
// Note: drill size represents finish size, which means the actual hole // Note: drill size represents finish size, which means the actual hole size is
// size is the plating thickness larger. // 2x the plating thickness larger.
if( pad->GetAttribute() == PAD_ATTRIB::PTH ) if( platedHole )
size += m_board->GetDesignSettings().GetHolePlatingThickness(); size += 2 * m_board->GetDesignSettings().GetHolePlatingThickness();
itemShape = std::make_shared<SHAPE_SEGMENT>( hole->GetSeg(), size ); itemShape = std::make_shared<SHAPE_SEGMENT>( hole->GetSeg(), size );
} }
}
if( zoneTree && zoneTree->QueryColliding( itemBBox, itemShape.get(), aLayer, if( zoneTree && zoneTree->QueryColliding( itemBBox, itemShape.get(), aLayer,
std::max( 0, clearance - m_drcEpsilon ), &actual, &pos ) ) std::max( 0, clearance - m_drcEpsilon ),
&actual, &pos ) )
{ {
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_CLEARANCE ); std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_CLEARANCE );