From ed7b3373d146866e9e068111674c396e8b4687af Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 9 Jan 2021 16:43:13 +0000 Subject: [PATCH] Disentangle copper- and board-edge-clearances in Clearance Resolution... Fixes https://gitlab.com/kicad/code/kicad/issues/6983 --- pcbnew/tools/board_inspection_tool.cpp | 29 +++++++++++--------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/pcbnew/tools/board_inspection_tool.cpp b/pcbnew/tools/board_inspection_tool.cpp index a42cd1a043..a0771be3d4 100644 --- a/pcbnew/tools/board_inspection_tool.cpp +++ b/pcbnew/tools/board_inspection_tool.cpp @@ -242,24 +242,8 @@ void BOARD_INSPECTION_TOOL::reportClearance( DRC_CONSTRAINT_T aClearanceType, PC footprint->BuildPolyCourtyards(); } - int clearance = 0; - - if( aClearanceType == CLEARANCE_CONSTRAINT ) - { - if( ( aA && ( aA->GetLayerSet() & LSET( 2, Edge_Cuts, Margin ) ).any() ) - || ( aB && ( aB->GetLayerSet() & LSET( 2, Edge_Cuts, Margin ) ).any() ) ) - { - auto edgeConstraint = drcEngine.EvalRulesForItems( EDGE_CLEARANCE_CONSTRAINT, aA, aB, - aLayer, r ); - - clearance = edgeConstraint.m_Value.HasMin() ? edgeConstraint.m_Value.Min() : 0; - } - } - auto constraint = drcEngine.EvalRulesForItems( aClearanceType, aA, aB, aLayer, r ); - - if( constraint.m_Value.HasMin() && constraint.m_Value.Min() > clearance ) - clearance = constraint.m_Value.Min(); + int clearance = constraint.m_Value.Min(); wxString clearanceStr = StringFromValue( r->GetUnits(), clearance, true ); @@ -381,6 +365,17 @@ int BOARD_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent ) b->GetSelectMenuText( r->GetUnits() ), m_frame->GetBoard()->GetLayerName( layer ) ) ); } + else if( a->GetLayer() == Edge_Cuts || a->GetLayer() == Margin + || b->GetLayer() == Edge_Cuts || b->GetLayer() == Margin ) + { + r->Report( "" + _( "Edge clearance resolution for:" ) + "" ); + + r->Report( wxString::Format( "", + EscapeHTML( getItemDescription( a ) ), + EscapeHTML( getItemDescription( b ) ) ) ); + + reportClearance( EDGE_CLEARANCE_CONSTRAINT, layer, a, b, r ); + } else { r->Report( "" + _( "Clearance resolution for:" ) + "" );