DRC: test for items located on disabled layers

Fixes: lp:1779281
* https://bugs.launchpad.net/kicad/+bug/1779281
This commit is contained in:
Maciej Suminski 2018-07-04 10:23:40 +02:00
parent 840a8b1d36
commit 0013e0cad1
3 changed files with 53 additions and 0 deletions

View File

@ -514,6 +514,15 @@ void DRC::RunTests( wxTextCtrl* aMessages )
doFootprintOverlappingDrc();
}
// Check if there are items on disabled layers
testDisabledLayers();
if( aMessages )
{
aMessages->AppendText( _( "Items on disabled layers...\n" ) );
aMessages->Refresh();
}
// update the m_drcDialog listboxes
updatePointers();
@ -1014,6 +1023,44 @@ void DRC::testTexts()
}
void DRC::testDisabledLayers()
{
BOARD* board = m_pcbEditorFrame->GetBoard();
wxCHECK( board, /*void*/ );
LSET disabledLayers = board->GetEnabledLayers().flip();
auto createMarker = [&]( BOARD_ITEM* aItem )
{
wxString msg;
msg.Printf( _( "\"%s\" is on a disabled layer" ), aItem->GetSelectMenuText() );
m_currentMarker = fillMarker( aItem->GetPosition(), DRCE_DISABLED_LAYER_ITEM,
msg, m_currentMarker );
addMarkerToPcb( m_currentMarker );
m_currentMarker = nullptr;
};
for( auto track : board->Tracks() )
{
if( disabledLayers.test( track->GetLayer() ) )
createMarker( track );
}
for( auto module : board->Modules() )
{
module->RunOnChildren( [&]( BOARD_ITEM* aItem ) {
if( disabledLayers.test( aItem->GetLayer() ) )
createMarker( aItem );
} );
}
for( auto zone : board->Zones() )
{
if( disabledLayers.test( zone->GetLayer() ) )
createMarker( zone );
}
}
bool DRC::doTrackKeepoutDrc( TRACK* aRefSeg )
{
// Test keepout areas for vias, tracks and pads inside keepout areas

View File

@ -90,6 +90,7 @@
///< (not convertible to a closed polygon with holes)
#define DRCE_MICRO_VIA_NOT_ALLOWED 47 ///< micro vias are not allowed
#define DRCE_BURIED_VIA_NOT_ALLOWED 48 ///< buried vias are not allowed
#define DRCE_DISABLED_LAYER_ITEM 49 ///< item on a disabled layer
class EDA_DRAW_PANEL;
@ -310,6 +311,9 @@ private:
void testTexts();
///> Tests for items placed on disabled layers (causing false connections).
void testDisabledLayers();
//-----<single "item" tests>-----------------------------------------
bool doNetClass( const std::shared_ptr<NETCLASS>& aNetClass, wxString& msg );

View File

@ -75,6 +75,8 @@ wxString DRC_ITEM::GetErrorText() const
return wxString( _( "Micro Via: not allowed" ) );
case DRCE_BURIED_VIA_NOT_ALLOWED:
return wxString( _( "Buried Via: not allowed" ) );
case DRCE_DISABLED_LAYER_ITEM:
return wxString( _( "Item on a disabled layer" ) );
case COPPERAREA_INSIDE_COPPERAREA:
return wxString( _( "Copper area inside copper area" ) );
case COPPERAREA_CLOSE_TO_COPPERAREA: