From 73836b50fcad5bd5701cbbcdb01103a93d623825 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 19 Jun 2022 21:45:33 +0100 Subject: [PATCH] Add proper collision test to via placer. Also moves DISALLOW constraint processing outside the loop as it performs it's own loop over any objects referenced by the rules. Fixes https://gitlab.com/kicad/code/kicad/issues/11832 --- pcbnew/tools/drawing_tool.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 3b409f73f0..76acd0484c 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -2527,16 +2527,10 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) if( ( aOther->Type() == PCB_ZONE_T || aOther->Type() == PCB_FP_ZONE_T ) && static_cast( aOther )->GetIsRuleArea() ) { - ZONE* zone = static_cast( aOther ); + ZONE* ruleArea = static_cast( aOther ); - if( zone->GetDoNotAllowVias() ) - return true; - - constraint = m_drcEngine->EvalRules( DISALLOW_CONSTRAINT, aVia, nullptr, - UNDEFINED_LAYER ); - - if( constraint.m_DisallowFlags && constraint.GetSeverity() != RPT_SEVERITY_IGNORE ) - return true; + if( ruleArea->GetDoNotAllowVias() ) + return ruleArea->Outline()->Collide( aVia->GetPosition(), aVia->GetWidth() / 2 ); return false; } @@ -2642,6 +2636,12 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) checkedItems.insert( item ); } + DRC_CONSTRAINT constraint = m_drcEngine->EvalRules( DISALLOW_CONSTRAINT, aVia, nullptr, + UNDEFINED_LAYER ); + + if( constraint.m_DisallowFlags && constraint.GetSeverity() != RPT_SEVERITY_IGNORE ) + return true; + return false; }