From 6e0c58adec00a6924123e72e032477d64017b029 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 19 Nov 2020 22:34:06 +0000 Subject: [PATCH] Include local clearances even if no implicit rule was found. The real test should be to apply it any time an explicit rule is *not* found. Fixes https://gitlab.com/kicad/code/kicad/issues/6426 --- pcbnew/drc/drc_engine.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index d839133e5b..a5d78cb4d3 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -968,12 +968,14 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRulesForItems( DRC_CONSTRAINT_TYPE_T aConstraintI } } + bool explicitConstraintFound = constraintRef && !implicit; + // Unfortunately implicit rules don't work for local clearances (such as zones) because // they have to be max'ed with netclass values (which are already implicit rules), and our // rule selection paradigm is "winner takes all". - if( constraintRef && aConstraintId == CLEARANCE_CONSTRAINT && implicit ) + if( aConstraintId == CLEARANCE_CONSTRAINT && !explicitConstraintFound ) { - int global = constraintRef->m_Value.Min(); + int global = constraintRef ? constraintRef->m_Value.Min() : 0; int localA = ac ? ac->GetLocalClearance( nullptr ) : 0; int localB = bc ? bc->GetLocalClearance( nullptr ) : 0; int clearance = global;