From af841d1318abdbb62ae3c7af4e6fe06dfc7bbe9d Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 11 Dec 2020 17:04:14 +0000 Subject: [PATCH] Pay attention to flashed layers when doing DRC layer switch. Fixes https://gitlab.com/kicad/code/kicad/issues/6710 --- pcbnew/dialogs/dialog_drc.cpp | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 0e224f6046..0bda650599 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -303,6 +303,28 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent ) const KIID& itemID = node ? RC_TREE_MODEL::ToUUID( aEvent.GetItem() ) : niluuid; BOARD_ITEM* item = board->GetItem( itemID ); + auto getActiveLayers = + []( BOARD_ITEM* aItem ) -> LSET + { + if( aItem->Type() == PCB_PAD_T ) + { + PAD* pad = static_cast( aItem ); + LSET layers; + + for( int layer : aItem->GetLayerSet().Seq() ) + { + if( pad->FlashLayer( layer ) ) + layers.set( layer ); + } + + return layers; + } + else + { + return aItem->GetLayerSet(); + } + }; + if( item && node ) { PCB_LAYER_ID principalLayer = item->GetLayer(); @@ -335,16 +357,16 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent ) BOARD_ITEM* d = board->GetItem( rc_item->GetAuxItem3ID() ); if( a ) - violationLayers &= a->GetLayerSet(); + violationLayers &= getActiveLayers( a ); if( b ) - violationLayers &= b->GetLayerSet(); + violationLayers &= getActiveLayers( b ); if( c ) - violationLayers &= c->GetLayerSet(); + violationLayers &= getActiveLayers( c ); if( d ) - violationLayers &= d->GetLayerSet(); + violationLayers &= getActiveLayers( d ); } if( violationLayers.count() )