From 0ac765c5bb98f5c88891ef221af8cb70a5da9814 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 11 Sep 2021 23:53:19 +0100 Subject: [PATCH] Special case footprint zones which can be on "inner layers". Also improves the reporting so that it reports the actual conflict layer rather than just the first layer the object is on. Fixes https://gitlab.com/kicad/code/kicad/issues/9144 --- pcbnew/drc/drc_test_provider_misc.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/pcbnew/drc/drc_test_provider_misc.cpp b/pcbnew/drc/drc_test_provider_misc.cpp index a13dffddd0..0b17bfa027 100644 --- a/pcbnew/drc/drc_test_provider_misc.cpp +++ b/pcbnew/drc/drc_test_provider_misc.cpp @@ -134,7 +134,7 @@ void DRC_TEST_PROVIDER_MISC::testDisabledLayers() auto checkDisabledLayers = [&]( BOARD_ITEM* item ) -> bool { - bool onDisabledLayer = false; + PCB_LAYER_ID badLayer = UNDEFINED_LAYER; if( item->Type() == PCB_PAD_T ) { @@ -143,12 +143,12 @@ void DRC_TEST_PROVIDER_MISC::testDisabledLayers() if( pad->GetAttribute() == PAD_ATTRIB::SMD || pad->GetAttribute() == PAD_ATTRIB::CONN ) { - onDisabledLayer = disabledLayers.test( item->GetLayer() ); + if( disabledLayers.test( item->GetLayer() ) ) + badLayer = item->GetLayer(); } else { - // Through hole pad is on whatever layers are there - onDisabledLayer = false; + // Through hole pad is on whatever layers there are. } } else if( item->Type() == PCB_VIA_T ) @@ -159,18 +159,29 @@ void DRC_TEST_PROVIDER_MISC::testDisabledLayers() via->LayerPair( &top, &bottom ); - onDisabledLayer = disabledLayers.test( top ) || disabledLayers.test( bottom ); + if( disabledLayers.test( top ) ) + badLayer = top; + else if( disabledLayers.test( bottom ) ) + badLayer = bottom; + } + else if( item->Type() == PCB_FP_ZONE_T ) + { + // Footprint zones just get a top/bottom/inner setting, so they're on + // whatever inner layers there are. } else { - onDisabledLayer = ( disabledLayers & item->GetLayerSet() ).any(); + LSET badLayers = disabledLayers & item->GetLayerSet(); + + if( badLayers.any() ) + badLayer = badLayers.Seq().front(); } - if( onDisabledLayer ) + if( badLayer != UNDEFINED_LAYER ) { std::shared_ptrdrcItem = DRC_ITEM::Create( DRCE_DISABLED_LAYER_ITEM ); - m_msg.Printf( _( "(layer %s)" ), item->GetLayerName() ); + m_msg.Printf( _( "(layer %s)" ), badLayer ); drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg ); drcItem->SetItems( item );