Check drilled holes against other holes, even if laser burned.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18142
This commit is contained in:
Jeff Young 2024-06-03 21:52:39 +01:00
parent 9f2c9636f0
commit 18e33a0957
5 changed files with 21 additions and 29 deletions

View File

@ -1189,16 +1189,11 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
} }
} }
else if( c->constraint.m_Type == HOLE_TO_HOLE_CONSTRAINT else if( c->constraint.m_Type == HOLE_TO_HOLE_CONSTRAINT
&& ( !a->HasDrilledHole() || !b->HasDrilledHole() ) ) && ( !a->HasDrilledHole() && !b->HasDrilledHole() ) )
{ {
// Report non-drilled-holes as an implicit condition // Report non-drilled-holes as an implicit condition
if( aReporter ) REPORT( wxString::Format( _( "%s is not a drilled hole; rule ignored." ),
{ a->GetItemDescription( this ) ) )
const BOARD_ITEM* x = !a->HasDrilledHole() ? a : b;
REPORT( wxString::Format( _( "%s is not a drilled hole; rule ignored." ),
x->GetItemDescription( this ) ) )
}
} }
else if( !c->condition || c->condition->GetExpression().IsEmpty() ) else if( !c->condition || c->condition->GetExpression().IsEmpty() )
{ {

View File

@ -102,7 +102,7 @@ DRC_ITEM DRC_ITEM::holeClearance( DRCE_HOLE_CLEARANCE,
wxT( "hole_clearance" ) ); wxT( "hole_clearance" ) );
DRC_ITEM DRC_ITEM::holeNearHole( DRCE_DRILLED_HOLES_TOO_CLOSE, DRC_ITEM DRC_ITEM::holeNearHole( DRCE_DRILLED_HOLES_TOO_CLOSE,
_( "Drilled holes too close together" ), _( "Drilled hole too close to other hole" ),
wxT( "hole_to_hole" ) ); wxT( "hole_to_hole" ) );
DRC_ITEM DRC_ITEM::holesCoLocated( DRCE_DRILLED_HOLES_COLOCATED, DRC_ITEM DRC_ITEM::holesCoLocated( DRCE_DRILLED_HOLES_COLOCATED,

View File

@ -76,20 +76,17 @@ private:
}; };
static std::shared_ptr<SHAPE_CIRCLE> getDrilledHoleShape( BOARD_ITEM* aItem ) static std::shared_ptr<SHAPE_CIRCLE> getHoleShape( BOARD_ITEM* aItem )
{ {
if( aItem->HasDrilledHole() ) if( aItem->Type() == PCB_VIA_T )
{ {
if( aItem->Type() == PCB_VIA_T ) PCB_VIA* via = static_cast<PCB_VIA*>( aItem );
{ return std::make_shared<SHAPE_CIRCLE>( via->GetCenter(), via->GetDrillValue() / 2 );
PCB_VIA* via = static_cast<PCB_VIA*>( aItem ); }
return std::make_shared<SHAPE_CIRCLE>( via->GetCenter(), via->GetDrillValue() / 2 ); else if( aItem->Type() == PCB_PAD_T )
} {
else if( aItem->Type() == PCB_PAD_T ) PAD* pad = static_cast<PAD*>( aItem );
{ return std::make_shared<SHAPE_CIRCLE>( pad->GetPosition(), pad->GetDrillSize().x / 2 );
PAD* pad = static_cast<PAD*>( aItem );
return std::make_shared<SHAPE_CIRCLE>( pad->GetPosition(), pad->GetDrillSize().x / 2 );
}
} }
return std::make_shared<SHAPE_CIRCLE>( VECTOR2I( 0, 0 ), 0 ); return std::make_shared<SHAPE_CIRCLE>( VECTOR2I( 0, 0 ), 0 );
@ -179,7 +176,7 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run()
// holes (which are generally drilled post laminataion). // holes (which are generally drilled post laminataion).
if( via->GetViaType() != VIATYPE::MICROVIA ) if( via->GetViaType() != VIATYPE::MICROVIA )
{ {
std::shared_ptr<SHAPE_CIRCLE> holeShape = getDrilledHoleShape( via ); std::shared_ptr<SHAPE_CIRCLE> holeShape = getHoleShape( via );
m_holeTree.QueryColliding( via, Edge_Cuts, Edge_Cuts, m_holeTree.QueryColliding( via, Edge_Cuts, Edge_Cuts,
// Filter: // Filter:
@ -221,10 +218,10 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::Run()
if( !reportProgress( ii++, count, progressDelta ) ) if( !reportProgress( ii++, count, progressDelta ) )
return false; // DRC cancelled return false; // DRC cancelled
// We only care about drilled (ie: round) holes // We only care about drilled (ie: round) pad holes
if( pad->HasDrilledHole() ) if( pad->HasDrilledHole() )
{ {
std::shared_ptr<SHAPE_CIRCLE> holeShape = getDrilledHoleShape( pad ); std::shared_ptr<SHAPE_CIRCLE> holeShape = getHoleShape( pad );
m_holeTree.QueryColliding( pad, Edge_Cuts, Edge_Cuts, m_holeTree.QueryColliding( pad, Edge_Cuts, Edge_Cuts,
// Filter: // Filter:
@ -276,11 +273,11 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::testHoleAgainstHole( BOARD_ITEM* aItem, SHA
if( !reportCoLocation && !reportHole2Hole ) if( !reportCoLocation && !reportHole2Hole )
return false; return false;
std::shared_ptr<SHAPE_CIRCLE> otherHole = getDrilledHoleShape( aOther ); std::shared_ptr<SHAPE_CIRCLE> otherHole = getHoleShape( aOther );
int epsilon = m_board->GetDesignSettings().GetDRCEpsilon(); int epsilon = m_board->GetDesignSettings().GetDRCEpsilon();
SEG::ecoord epsilon_sq = SEG::Square( epsilon ); SEG::ecoord epsilon_sq = SEG::Square( epsilon );
// Blind-buried or microvias that don't overlap layers aren't an issue. // Blind-buried vias are drilled prior to stackup; they're only an issue if they share layers
if( aItem->Type() == PCB_VIA_T && aOther->Type() == PCB_VIA_T ) if( aItem->Type() == PCB_VIA_T && aOther->Type() == PCB_VIA_T )
{ {
LSET viaHoleLayers = static_cast<PCB_VIA*>( aItem )->GetLayerSet() & LSET::AllCuMask(); LSET viaHoleLayers = static_cast<PCB_VIA*>( aItem )->GetLayerSet() & LSET::AllCuMask();
@ -306,7 +303,7 @@ bool DRC_TEST_PROVIDER_HOLE_TO_HOLE::testHoleAgainstHole( BOARD_ITEM* aItem, SHA
auto constraint = m_drcEngine->EvalRules( HOLE_TO_HOLE_CONSTRAINT, aItem, aOther, auto constraint = m_drcEngine->EvalRules( HOLE_TO_HOLE_CONSTRAINT, aItem, aOther,
UNDEFINED_LAYER /* holes pierce all layers */ ); UNDEFINED_LAYER /* holes pierce all layers */ );
int minClearance = constraint.GetValue().Min() - epsilon; int minClearance = std::max( 0, constraint.GetValue().Min() - epsilon );
if( constraint.GetSeverity() != RPT_SEVERITY_IGNORE if( constraint.GetSeverity() != RPT_SEVERITY_IGNORE
&& minClearance >= 0 && minClearance >= 0

View File

@ -422,7 +422,7 @@ public:
bool HasDrilledHole() const override bool HasDrilledHole() const override
{ {
return m_viaType == VIATYPE::THROUGH; return m_viaType == VIATYPE::THROUGH || m_viaType == VIATYPE::BLIND_BURIED;
} }
std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override; std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;

View File

@ -1112,7 +1112,7 @@ int BOARD_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent )
r->Flush(); r->Flush();
} }
if( a->HasDrilledHole() && b->HasDrilledHole() ) if( a->HasDrilledHole() || b->HasDrilledHole() )
{ {
if( !pageAdded ) if( !pageAdded )
{ {