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 )
|
void ZONE_CONTAINER::SetLayer( PCB_LAYER_ID aLayer )
|
||||||
{
|
{
|
||||||
SetLayerSet( LSET( aLayer ) );
|
SetLayerSet( LSET( aLayer ) );
|
||||||
|
|
|
@ -182,6 +182,12 @@ public:
|
||||||
*/
|
*/
|
||||||
bool IsOnCopperLayer() const;
|
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 void SetLayer( PCB_LAYER_ID aLayer ) override;
|
||||||
|
|
||||||
virtual PCB_LAYER_ID GetLayer() const override;
|
virtual PCB_LAYER_ID GetLayer() const override;
|
||||||
|
|
|
@ -621,7 +621,9 @@ void DRC::testKeepoutAreas()
|
||||||
ZONE_CONTAINER* area = m_pcb->GetArea( ii );
|
ZONE_CONTAINER* area = m_pcb->GetArea( ii );
|
||||||
|
|
||||||
if( !area->GetIsKeepout() )
|
if( !area->GetIsKeepout() )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for( TRACK* segm = m_pcb->m_Track; segm != NULL; segm = segm->Next() )
|
for( TRACK* segm = m_pcb->m_Track; segm != NULL; segm = segm->Next() )
|
||||||
{
|
{
|
||||||
|
@ -630,7 +632,8 @@ void DRC::testKeepoutAreas()
|
||||||
if( ! area->GetDoNotAllowTracks() )
|
if( ! area->GetDoNotAllowTracks() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( segm->GetLayer() != area->GetLayer() )
|
// Ignore if the keepout zone is not on the same layer
|
||||||
|
if( !area->IsOnLayer( segm->GetLayer() ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( area->Outline()->Distance( SEG( segm->GetStart(), segm->GetEnd() ),
|
if( area->Outline()->Distance( SEG( segm->GetStart(), segm->GetEnd() ),
|
||||||
|
@ -646,7 +649,9 @@ void DRC::testKeepoutAreas()
|
||||||
if( ! area->GetDoNotAllowVias() )
|
if( ! area->GetDoNotAllowVias() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( ! ((VIA*)segm)->IsOnLayer( area->GetLayer() ) )
|
auto viaLayers = segm->GetLayerSet();
|
||||||
|
|
||||||
|
if( !area->CommonLayerExists( viaLayers ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( area->Outline()->Distance( segm->GetPosition() ) < segm->GetWidth()/2 )
|
if( area->Outline()->Distance( segm->GetPosition() ) < segm->GetWidth()/2 )
|
||||||
|
@ -801,7 +806,7 @@ bool DRC::doTrackKeepoutDrc( TRACK* aRefSeg )
|
||||||
if( ! area->GetDoNotAllowTracks() )
|
if( ! area->GetDoNotAllowTracks() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( aRefSeg->GetLayer() != area->GetLayer() )
|
if( !area->IsOnLayer( aRefSeg->GetLayer() ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( area->Outline()->Distance( SEG( aRefSeg->GetStart(), aRefSeg->GetEnd() ),
|
if( area->Outline()->Distance( SEG( aRefSeg->GetStart(), aRefSeg->GetEnd() ),
|
||||||
|
@ -817,7 +822,9 @@ bool DRC::doTrackKeepoutDrc( TRACK* aRefSeg )
|
||||||
if( ! area->GetDoNotAllowVias() )
|
if( ! area->GetDoNotAllowVias() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( ! ((VIA*)aRefSeg)->IsOnLayer( area->GetLayer() ) )
|
auto viaLayers = aRefSeg->GetLayerSet();
|
||||||
|
|
||||||
|
if( !area->CommonLayerExists( viaLayers ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( area->Outline()->Distance( aRefSeg->GetPosition() ) < aRefSeg->GetWidth()/2 )
|
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,
|
// If the new zone is on the same layer as the the initial zone,
|
||||||
// do nothing
|
// do nothing
|
||||||
if( success && ( aZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) )
|
if( success )
|
||||||
{
|
{
|
||||||
DisplayErrorMessage( this,
|
if( aZone->GetIsKeepout() && ( aZone->GetLayerSet() == zoneSettings.m_Layers ) )
|
||||||
_( "The duplicated zone cannot be on the same layer as the original zone." ) );
|
{
|
||||||
|
DisplayErrorMessage(
|
||||||
|
this, _( "The duplicated zone cannot be on the same layers as the original zone." ) );
|
||||||
success = false;
|
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 )
|
if( success )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue