Diff pair gap only overrides netclass clearance when it's smaller.

Fixes https://gitlab.com/kicad/code/kicad/issues/8676
This commit is contained in:
Jeff Young 2021-06-24 16:54:59 +01:00
parent 744dadd412
commit 232ffe97be
1 changed files with 17 additions and 14 deletions

View File

@ -295,22 +295,25 @@ void DRC_ENGINE::loadImplicitRules()
constraint.Value().SetOpt( nc->GetDiffPairGap() ); constraint.Value().SetOpt( nc->GetDiffPairGap() );
netclassRule->AddConstraint( constraint ); netclassRule->AddConstraint( constraint );
// The diffpair gap overrides the netclass min clearance, but not the board // A narrower diffpair gap overrides the netclass min clearance (but is still
// min clearance. // trimmed to the board min clearance, which is absolute).
netclassRule = new DRC_RULE; if( nc->GetDiffPairGap() < nc->GetClearance() )
netclassRule->m_Name = wxString::Format( _( "netclass '%s' (diff pair)" ), {
ncName ); netclassRule = new DRC_RULE;
netclassRule->m_Implicit = true; netclassRule->m_Name = wxString::Format( _( "netclass '%s' (diff pair)" ),
ncName );
netclassRule->m_Implicit = true;
expr = wxString::Format( "A.NetClass == '%s' && AB.isCoupledDiffPair()", expr = wxString::Format( "A.NetClass == '%s' && AB.isCoupledDiffPair()",
ncName ); ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr ); netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule ); netclassItemSpecificRules.push_back( netclassRule );
DRC_CONSTRAINT min_clearanceConstraint( CLEARANCE_CONSTRAINT ); DRC_CONSTRAINT min_clearanceConstraint( CLEARANCE_CONSTRAINT );
min_clearanceConstraint.Value().SetMin( std::max( bds.m_MinClearance, min_clearanceConstraint.Value().SetMin( std::max( bds.m_MinClearance,
nc->GetDiffPairGap() ) ); nc->GetDiffPairGap() ) );
netclassRule->AddConstraint( min_clearanceConstraint ); netclassRule->AddConstraint( min_clearanceConstraint );
}
} }
if( nc->GetViaDiameter() || nc->GetViaDrill() ) if( nc->GetViaDiameter() || nc->GetViaDrill() )