We must check clearance on all layers of multi-layer items.
(One layer may have a custom rule.) Fixes https://gitlab.com/kicad/code/kicad/issues/12733
This commit is contained in:
parent
c8261d13a5
commit
2dec37f806
|
@ -387,26 +387,36 @@ int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* a
|
|||
return it->second;
|
||||
|
||||
PNS::CONSTRAINT constraint;
|
||||
int rv = 0;
|
||||
int layer;
|
||||
int rv = 0;
|
||||
LAYER_RANGE layers;
|
||||
|
||||
if( !aA->Layers().IsMultilayer() || !aB || aB->Layers().IsMultilayer() )
|
||||
layer = aA->Layer();
|
||||
if( !aB )
|
||||
layers = aA->Layers();
|
||||
else if( isEdge( aA ) )
|
||||
layers = aB->Layers();
|
||||
else if( isEdge( aB ) )
|
||||
layers = aA->Layers();
|
||||
else
|
||||
layer = aB->Layer();
|
||||
layers = aA->Layers().Intersection( aB->Layers() );
|
||||
|
||||
if( isCopper( aA ) && ( !aB || isCopper( aB ) ) )
|
||||
for( int layer = layers.Start(); layer <= layers.End(); ++layer )
|
||||
{
|
||||
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_CLEARANCE, aA, aB, layer, &constraint ) )
|
||||
rv = constraint.m_Value.Min();
|
||||
}
|
||||
|
||||
if( isEdge( aA ) || ( aB && isEdge( aB ) ) )
|
||||
{
|
||||
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_EDGE_CLEARANCE, aA, aB, layer, &constraint ) )
|
||||
if( isCopper( aA ) && ( !aB || isCopper( aB ) ) )
|
||||
{
|
||||
if( constraint.m_Value.Min() > rv )
|
||||
rv = constraint.m_Value.Min();
|
||||
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_CLEARANCE, aA, aB, layer, &constraint ) )
|
||||
{
|
||||
if( constraint.m_Value.Min() > rv )
|
||||
rv = constraint.m_Value.Min();
|
||||
}
|
||||
}
|
||||
|
||||
if( isEdge( aA ) || ( aB && isEdge( aB ) ) )
|
||||
{
|
||||
if( QueryConstraint( PNS::CONSTRAINT_TYPE::CT_EDGE_CLEARANCE, aA, aB, layer, &constraint ) )
|
||||
{
|
||||
if( constraint.m_Value.Min() > rv )
|
||||
rv = constraint.m_Value.Min();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,6 +105,22 @@ public:
|
|||
m_end = aOther.m_end;
|
||||
}
|
||||
|
||||
LAYER_RANGE Intersection( const LAYER_RANGE& aOther ) const
|
||||
{
|
||||
LAYER_RANGE overlap;
|
||||
|
||||
overlap.m_start = std::max( m_start, aOther.m_start );
|
||||
|
||||
if( m_end < 0 )
|
||||
overlap.m_end = aOther.m_end;
|
||||
else if( aOther.m_end < 0 )
|
||||
overlap.m_end = m_end;
|
||||
else
|
||||
overlap.m_end = std::min( m_end, aOther.m_end );
|
||||
|
||||
return overlap;
|
||||
}
|
||||
|
||||
///< Shortcut for comparisons/overlap tests
|
||||
static LAYER_RANGE All()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue