DRC checks for keepout zones work on all layers
This commit is contained in:
parent
2895030cfa
commit
7e0fa329d0
|
@ -195,6 +195,14 @@ bool ZONE_CONTAINER::IsOnCopperLayer() const
|
|||
}
|
||||
|
||||
|
||||
bool ZONE_CONTAINER::CommonLayerExists( const LSET aLayerSet ) const
|
||||
{
|
||||
auto common = GetLayerSet() & aLayerSet;
|
||||
|
||||
return common.size() > 0;
|
||||
}
|
||||
|
||||
|
||||
void ZONE_CONTAINER::SetLayer( PCB_LAYER_ID aLayer )
|
||||
{
|
||||
SetLayerSet( LSET( aLayer ) );
|
||||
|
|
|
@ -182,6 +182,12 @@ public:
|
|||
*/
|
||||
bool IsOnCopperLayer() const;
|
||||
|
||||
/**
|
||||
* Function CommonLayerExist
|
||||
* Test if this zone shares a common layer with the given layer set
|
||||
*/
|
||||
bool CommonLayerExists( const LSET aLayerSet ) const;
|
||||
|
||||
virtual void SetLayer( PCB_LAYER_ID aLayer ) override;
|
||||
|
||||
virtual PCB_LAYER_ID GetLayer() const override;
|
||||
|
|
|
@ -621,7 +621,9 @@ void DRC::testKeepoutAreas()
|
|||
ZONE_CONTAINER* area = m_pcb->GetArea( ii );
|
||||
|
||||
if( !area->GetIsKeepout() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for( TRACK* segm = m_pcb->m_Track; segm != NULL; segm = segm->Next() )
|
||||
{
|
||||
|
@ -630,7 +632,8 @@ void DRC::testKeepoutAreas()
|
|||
if( ! area->GetDoNotAllowTracks() )
|
||||
continue;
|
||||
|
||||
if( segm->GetLayer() != area->GetLayer() )
|
||||
// Ignore if the keepout zone is not on the same layer
|
||||
if( !area->IsOnLayer( segm->GetLayer() ) )
|
||||
continue;
|
||||
|
||||
if( area->Outline()->Distance( SEG( segm->GetStart(), segm->GetEnd() ),
|
||||
|
@ -646,7 +649,9 @@ void DRC::testKeepoutAreas()
|
|||
if( ! area->GetDoNotAllowVias() )
|
||||
continue;
|
||||
|
||||
if( ! ((VIA*)segm)->IsOnLayer( area->GetLayer() ) )
|
||||
auto viaLayers = segm->GetLayerSet();
|
||||
|
||||
if( !area->CommonLayerExists( viaLayers ) )
|
||||
continue;
|
||||
|
||||
if( area->Outline()->Distance( segm->GetPosition() ) < segm->GetWidth()/2 )
|
||||
|
@ -801,7 +806,7 @@ bool DRC::doTrackKeepoutDrc( TRACK* aRefSeg )
|
|||
if( ! area->GetDoNotAllowTracks() )
|
||||
continue;
|
||||
|
||||
if( aRefSeg->GetLayer() != area->GetLayer() )
|
||||
if( !area->IsOnLayer( aRefSeg->GetLayer() ) )
|
||||
continue;
|
||||
|
||||
if( area->Outline()->Distance( SEG( aRefSeg->GetStart(), aRefSeg->GetEnd() ),
|
||||
|
@ -817,7 +822,9 @@ bool DRC::doTrackKeepoutDrc( TRACK* aRefSeg )
|
|||
if( ! area->GetDoNotAllowVias() )
|
||||
continue;
|
||||
|
||||
if( ! ((VIA*)aRefSeg)->IsOnLayer( area->GetLayer() ) )
|
||||
auto viaLayers = aRefSeg->GetLayerSet();
|
||||
|
||||
if( !area->CommonLayerExists( viaLayers ) )
|
||||
continue;
|
||||
|
||||
if( area->Outline()->Distance( aRefSeg->GetPosition() ) < aRefSeg->GetWidth()/2 )
|
||||
|
|
|
@ -127,12 +127,21 @@ void PCB_EDIT_FRAME::duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone )
|
|||
|
||||
// If the new zone is on the same layer as the the initial zone,
|
||||
// do nothing
|
||||
if( success && ( aZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) )
|
||||
if( success )
|
||||
{
|
||||
DisplayErrorMessage( this,
|
||||
_( "The duplicated zone cannot be on the same layer as the original zone." ) );
|
||||
if( aZone->GetIsKeepout() && ( aZone->GetLayerSet() == zoneSettings.m_Layers ) )
|
||||
{
|
||||
DisplayErrorMessage(
|
||||
this, _( "The duplicated zone cannot be on the same layers as the original zone." ) );
|
||||
success = false;
|
||||
}
|
||||
else if( !aZone->GetIsKeepout() && ( aZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) )
|
||||
{
|
||||
DisplayErrorMessage(
|
||||
this, _( "The duplicated zone cannot be on the same layer as the original zone." ) );
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( success )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue