Don't run DRC rules on non-existant layers.
Fixes https://gitlab.com/kicad/code/kicad/issues/13753
This commit is contained in:
parent
235925d62c
commit
8ecf64b6c5
|
@ -38,6 +38,7 @@ bool DRC_CACHE_GENERATOR::Run()
|
|||
int& m_largestClearance = m_board->m_DRCMaxClearance;
|
||||
int& m_largestPhysicalClearance = m_board->m_DRCMaxPhysicalClearance;
|
||||
DRC_CONSTRAINT worstConstraint;
|
||||
LSET boardCopperLayers = LSET::AllCuMask( m_board->GetCopperLayerCount() );
|
||||
|
||||
if( m_drcEngine->QueryWorstConstraint( CLEARANCE_CONSTRAINT, worstConstraint ) )
|
||||
m_largestClearance = worstConstraint.GetValue().Min();
|
||||
|
@ -61,7 +62,7 @@ bool DRC_CACHE_GENERATOR::Run()
|
|||
{
|
||||
m_board->m_DRCZones.push_back( zone );
|
||||
|
||||
if( ( zone->GetLayerSet() & LSET::AllCuMask() ).any() )
|
||||
if( ( zone->GetLayerSet() & boardCopperLayers ).any() )
|
||||
{
|
||||
m_board->m_DRCCopperZones.push_back( zone );
|
||||
m_largestClearance = std::max( m_largestClearance, zone->GetLocalClearance() );
|
||||
|
@ -82,7 +83,7 @@ bool DRC_CACHE_GENERATOR::Run()
|
|||
{
|
||||
m_board->m_DRCZones.push_back( zone );
|
||||
|
||||
if( ( zone->GetLayerSet() & LSET::AllCuMask() ).any() )
|
||||
if( ( zone->GetLayerSet() & boardCopperLayers ).any() )
|
||||
{
|
||||
m_board->m_DRCCopperZones.push_back( zone );
|
||||
m_largestClearance = std::max( m_largestClearance, zone->GetLocalClearance() );
|
||||
|
@ -109,7 +110,7 @@ bool DRC_CACHE_GENERATOR::Run()
|
|||
if( !reportProgress( ii++, count, progressDelta ) )
|
||||
return false;
|
||||
|
||||
LSET layers = item->GetLayerSet();
|
||||
LSET copperLayers = item->GetLayerSet() & boardCopperLayers;
|
||||
|
||||
// Special-case pad holes which pierce all the copper layers
|
||||
if( item->Type() == PCB_PAD_T )
|
||||
|
@ -117,10 +118,10 @@ bool DRC_CACHE_GENERATOR::Run()
|
|||
PAD* pad = static_cast<PAD*>( item );
|
||||
|
||||
if( pad->HasHole() )
|
||||
layers |= LSET::AllCuMask();
|
||||
copperLayers = boardCopperLayers;
|
||||
}
|
||||
|
||||
for( PCB_LAYER_ID layer : layers.Seq() )
|
||||
for( PCB_LAYER_ID layer : copperLayers.Seq() )
|
||||
{
|
||||
if( IsCopperLayer( layer ) )
|
||||
m_board->m_CopperItemRTreeCache->Insert( item, layer, m_largestClearance );
|
||||
|
|
|
@ -442,12 +442,14 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances()
|
|||
std::map<BOARD_ITEM*, int> freePadsUsageMap;
|
||||
std::unordered_map<PTR_PTR_CACHE_KEY, layers_checked> checkedPairs;
|
||||
|
||||
LSET boardCopperLayers = LSET::AllCuMask( m_board->GetCopperLayerCount() );
|
||||
|
||||
for( PCB_TRACK* track : m_board->Tracks() )
|
||||
{
|
||||
if( !reportProgress( ii++, m_board->Tracks().size(), progressDelta ) )
|
||||
break;
|
||||
|
||||
for( PCB_LAYER_ID layer : LSET( track->GetLayerSet() & LSET::AllCuMask() ).Seq() )
|
||||
for( PCB_LAYER_ID layer : LSET( track->GetLayerSet() & boardCopperLayers ).Seq() )
|
||||
{
|
||||
std::shared_ptr<SHAPE> trackShape = track->GetEffectiveShape( layer );
|
||||
|
||||
|
@ -765,11 +767,13 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadClearances( )
|
|||
|
||||
std::unordered_map<PTR_PTR_CACHE_KEY, int> checkedPairs;
|
||||
|
||||
LSET boardCopperLayers = LSET::AllCuMask( m_board->GetCopperLayerCount() );
|
||||
|
||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||
{
|
||||
for( PAD* pad : footprint->Pads() )
|
||||
{
|
||||
for( PCB_LAYER_ID layer : pad->GetLayerSet().Seq() )
|
||||
for( PCB_LAYER_ID layer : LSET( pad->GetLayerSet() & boardCopperLayers ).Seq() )
|
||||
{
|
||||
std::shared_ptr<SHAPE> padShape = pad->GetEffectiveShape( layer );
|
||||
|
||||
|
|
Loading…
Reference in New Issue