Allow diffpair gap to override netclass clearance value.

Fixes https://gitlab.com/kicad/code/kicad/issues/7975
This commit is contained in:
Jeff Young 2021-03-20 21:18:18 +00:00
parent ce46fe6581
commit 44e2151ade
1 changed files with 25 additions and 3 deletions

View File

@ -245,7 +245,8 @@ void DRC_ENGINE::loadImplicitRules()
if( nc->GetClearance() ) if( nc->GetClearance() )
{ {
DRC_CONSTRAINT constraint( CLEARANCE_CONSTRAINT ); DRC_CONSTRAINT constraint( CLEARANCE_CONSTRAINT );
constraint.Value().SetMin( std::max( bds.m_MinClearance, nc->GetClearance() ) ); constraint.Value().SetMin( std::max( bds.m_MinClearance,
nc->GetClearance() ) );
netclassRule->AddConstraint( constraint ); netclassRule->AddConstraint( constraint );
} }
@ -261,7 +262,8 @@ void DRC_ENGINE::loadImplicitRules()
if( nc->GetDiffPairWidth() || nc->GetDiffPairGap() ) if( nc->GetDiffPairWidth() || nc->GetDiffPairGap() )
{ {
netclassRule = new DRC_RULE; netclassRule = new DRC_RULE;
netclassRule->m_Name = wxString::Format( _( "netclass '%s'" ), ncName ); netclassRule->m_Name = wxString::Format( _( "netclass '%s' (diff pair)" ),
ncName );
netclassRule->m_Implicit = true; netclassRule->m_Implicit = true;
expr = wxString::Format( "A.NetClass == '%s' && A.isDiffPair()", expr = wxString::Format( "A.NetClass == '%s' && A.isDiffPair()",
@ -280,12 +282,32 @@ void DRC_ENGINE::loadImplicitRules()
if( nc->GetDiffPairGap() ) if( nc->GetDiffPairGap() )
{ {
DRC_CONSTRAINT constraint( DIFF_PAIR_GAP_CONSTRAINT ); DRC_CONSTRAINT constraint( DIFF_PAIR_GAP_CONSTRAINT );
constraint.Value().SetMin( std::max( bds.m_MinClearance, nc->GetClearance() ) ); constraint.Value().SetMin( bds.m_MinClearance );
constraint.Value().SetOpt( nc->GetDiffPairGap() ); constraint.Value().SetOpt( nc->GetDiffPairGap() );
netclassRule->AddConstraint( constraint ); netclassRule->AddConstraint( constraint );
} }
} }
if( nc->GetDiffPairGap() )
{
netclassRule = new DRC_RULE;
netclassRule->m_Name = wxString::Format( _( "netclass '%s' (diff pair)" ),
ncName );
netclassRule->m_Implicit = true;
expr = wxString::Format( "A.NetClass == '%s' && A.isDiffPair() "
"&& B.NetClass == '%s' && B.isDiffPair()",
ncName,
ncName );
netclassRule->m_Condition = new DRC_RULE_CONDITION( expr );
netclassItemSpecificRules.push_back( netclassRule );
DRC_CONSTRAINT constraint( CLEARANCE_CONSTRAINT );
constraint.Value().SetMin( std::max( bds.m_MinClearance,
nc->GetDiffPairGap() ) );
netclassRule->AddConstraint( constraint );
}
if( nc->GetViaDiameter() || nc->GetViaDrill() ) if( nc->GetViaDiameter() || nc->GetViaDrill() )
{ {
netclassRule = new DRC_RULE; netclassRule = new DRC_RULE;