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
|
@ -388,18 +388,27 @@ int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* a
|
|||
|
||||
PNS::CONSTRAINT constraint;
|
||||
int rv = 0;
|
||||
int layer;
|
||||
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() );
|
||||
|
||||
for( int layer = layers.Start(); layer <= layers.End(); ++layer )
|
||||
{
|
||||
if( isCopper( aA ) && ( !aB || isCopper( aB ) ) )
|
||||
{
|
||||
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 ) ) )
|
||||
{
|
||||
|
@ -409,6 +418,7 @@ int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* a
|
|||
rv = constraint.m_Value.Min();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( aUseClearanceEpsilon )
|
||||
rv -= m_clearanceEpsilon;
|
||||
|
|
|
@ -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