From 58f553a9cad972363c21209285bb4b1b142f95a0 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Mon, 11 Oct 2021 10:18:28 -0700 Subject: [PATCH] Check for layer when DRC on vias and non-zone items We were already checking for zone-zone overlap but missing checks when running against (possibly) buried vias as well as the general check Fixes https://gitlab.com/kicad/code/kicad/issues/9366 --- pcbnew/pcb_expr_evaluator.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index f0e64c6480..424a53e8bc 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -474,7 +474,9 @@ bool calcIsInsideArea( BOARD_ITEM* aItem, const EDA_RECT& aItemBBox, PCB_EXPR_CO PCB_VIA* via = static_cast( aItem ); const SHAPE_CIRCLE holeShape( via->GetPosition(), via->GetDrillValue() ); - return areaOutline.Collide( &holeShape ); + /// Avoid buried vias that don't overlap the zone's layers + if( ( via->GetLayerSet() & aArea->GetLayerSet() ).any() ) + return areaOutline.Collide( &holeShape ); } return false; @@ -555,6 +557,9 @@ bool calcIsInsideArea( BOARD_ITEM* aItem, const EDA_RECT& aItemBBox, PCB_EXPR_CO } else { + if( !( aArea->GetLayerSet().Contains( aCtx->GetLayer() ) ) ) + return false; + if( !shape ) shape = aItem->GetEffectiveShape( aCtx->GetLayer() );