Run hole-to-hole checks on Edge_Cuts layer.

Also makes the flashing logic inside PAD::GetEffectiveShape() easier
to understand.

Fixes https://gitlab.com/kicad/code/kicad/issues/12296
This commit is contained in:
Jeff Young 2022-08-29 12:33:31 +01:00
parent f0956e48f2
commit e0f6a6e475
3 changed files with 30 additions and 10 deletions

View File

@ -147,7 +147,7 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run()
// We only care about drilled (ie: round) holes // We only care about drilled (ie: round) holes
if( pad->GetDrillSize().x && pad->GetDrillSize().x == pad->GetDrillSize().y ) if( pad->GetDrillSize().x && pad->GetDrillSize().x == pad->GetDrillSize().y )
m_holeTree.Insert( item, F_Cu, m_largestHoleToHoleClearance ); m_holeTree.Insert( item, Edge_Cuts, m_largestHoleToHoleClearance );
} }
else if( item->Type() == PCB_VIA_T ) else if( item->Type() == PCB_VIA_T )
{ {
@ -155,7 +155,7 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run()
// We only care about mechanically drilled (ie: non-laser) holes // We only care about mechanically drilled (ie: non-laser) holes
if( via->GetViaType() == VIATYPE::THROUGH ) if( via->GetViaType() == VIATYPE::THROUGH )
m_holeTree.Insert( item, F_Cu, m_largestHoleToHoleClearance ); m_holeTree.Insert( item, Edge_Cuts, m_largestHoleToHoleClearance );
} }
return true; return true;
@ -178,7 +178,7 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run()
{ {
std::shared_ptr<SHAPE_CIRCLE> holeShape = getDrilledHoleShape( via ); std::shared_ptr<SHAPE_CIRCLE> holeShape = getDrilledHoleShape( via );
m_holeTree.QueryColliding( via, F_Cu, F_Cu, m_holeTree.QueryColliding( via, Edge_Cuts, Edge_Cuts,
// Filter: // Filter:
[&]( BOARD_ITEM* other ) -> bool [&]( BOARD_ITEM* other ) -> bool
{ {
@ -223,7 +223,7 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run()
{ {
std::shared_ptr<SHAPE_CIRCLE> holeShape = getDrilledHoleShape( pad ); std::shared_ptr<SHAPE_CIRCLE> holeShape = getDrilledHoleShape( pad );
m_holeTree.QueryColliding( pad, F_Cu, F_Cu, m_holeTree.QueryColliding( pad, Edge_Cuts, Edge_Cuts,
// Filter: // Filter:
[&]( BOARD_ITEM* other ) -> bool [&]( BOARD_ITEM* other ) -> bool
{ {

View File

@ -330,17 +330,36 @@ const std::shared_ptr<SHAPE_POLY_SET>& PAD::GetEffectivePolygon() const
} }
std::shared_ptr<SHAPE> PAD::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const std::shared_ptr<SHAPE> PAD::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING flashPTHPads ) const
{ {
if( ( GetAttribute() == PAD_ATTRIB::PTH && aFlash == FLASHING::NEVER_FLASHED ) if( aLayer == Edge_Cuts )
|| ( aLayer != UNDEFINED_LAYER && !FlashLayer( aLayer ) ) )
{ {
if( GetAttribute() == PAD_ATTRIB::PTH ) if( GetAttribute() == PAD_ATTRIB::PTH || GetAttribute() == PAD_ATTRIB::NPTH )
return GetEffectiveHoleShape(); return GetEffectiveHoleShape();
else else
return std::make_shared<SHAPE_NULL>(); return std::make_shared<SHAPE_NULL>();
} }
if( GetAttribute() == PAD_ATTRIB::PTH )
{
bool flash;
if( flashPTHPads == FLASHING::NEVER_FLASHED )
flash = false;
else if( flashPTHPads == FLASHING::ALWAYS_FLASHED )
flash = true;
else
flash = FlashLayer( aLayer );
if( !flash )
{
if( GetAttribute() == PAD_ATTRIB::PTH )
return GetEffectiveHoleShape();
else
return std::make_shared<SHAPE_NULL>();
}
}
if( m_shapesDirty ) if( m_shapesDirty )
BuildEffectiveShapes( aLayer ); BuildEffectiveShapes( aLayer );

View File

@ -432,8 +432,9 @@ public:
int aError, ERROR_LOC aErrorLoc ) const; int aError, ERROR_LOC aErrorLoc ) const;
// @copydoc BOARD_ITEM::GetEffectiveShape // @copydoc BOARD_ITEM::GetEffectiveShape
virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER, virtual std::shared_ptr<SHAPE>
FLASHING aFlash = FLASHING::DEFAULT ) const override; GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
FLASHING flashPTHPads = FLASHING::DEFAULT ) const override;
const std::shared_ptr<SHAPE_POLY_SET>& GetEffectivePolygon() const; const std::shared_ptr<SHAPE_POLY_SET>& GetEffectivePolygon() const;