Improve DRC error reporting and fix some bugs.

This commit is contained in:
Jeff Young 2020-04-29 20:17:59 +01:00
parent 068874a626
commit 4a60b8a776
4 changed files with 70 additions and 30 deletions

View File

@ -167,7 +167,8 @@ void RC_TREE_MODEL::rebuildModel( RC_ITEMS_PROVIDER* aProvider, int aSeverities
m_tree.push_back( new RC_TREE_NODE( nullptr, drcItem, RC_TREE_NODE::MARKER ) ); m_tree.push_back( new RC_TREE_NODE( nullptr, drcItem, RC_TREE_NODE::MARKER ) );
RC_TREE_NODE* n = m_tree.back(); RC_TREE_NODE* n = m_tree.back();
n->m_Children.push_back( new RC_TREE_NODE( n, drcItem, RC_TREE_NODE::MAIN_ITEM ) ); if( drcItem->GetMainItemID() != niluuid )
n->m_Children.push_back( new RC_TREE_NODE( n, drcItem, RC_TREE_NODE::MAIN_ITEM ) );
if( drcItem->GetAuxItemID() != niluuid ) if( drcItem->GetAuxItemID() != niluuid )
n->m_Children.push_back( new RC_TREE_NODE( n, drcItem, RC_TREE_NODE::AUX_ITEM ) ); n->m_Children.push_back( new RC_TREE_NODE( n, drcItem, RC_TREE_NODE::AUX_ITEM ) );

View File

@ -312,14 +312,25 @@ int DRC::TestZoneToZoneOutlines()
for( const std::pair<const wxPoint, int>& conflict : conflictPoints ) for( const std::pair<const wxPoint, int>& conflict : conflictPoints )
{ {
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_ZONES_TOO_CLOSE ); int actual = conflict.second;
DRC_ITEM* drcItem;
msg.Printf( drcItem->GetErrorText() + _( "(%s %s; actual %s)" ), if( actual <= 0 )
clearanceSource, {
MessageTextFromValue( userUnits(), zone2zoneClearance ), drcItem = new DRC_ITEM( DRCE_ZONES_INTERSECT );
MessageTextFromValue( userUnits(), conflict.second ) ); }
else
{
drcItem = new DRC_ITEM( DRCE_ZONES_TOO_CLOSE );
msg.Printf( drcItem->GetErrorText() + _( " (%s %s; actual %s)" ),
clearanceSource,
MessageTextFromValue( userUnits(), zone2zoneClearance, true ),
MessageTextFromValue( userUnits(), conflict.second, true ) );
drcItem->SetErrorMessage( msg );
}
drcItem->SetErrorMessage( msg );
drcItem->SetItems( zoneRef, zoneToTest ); drcItem->SetItems( zoneRef, zoneToTest );
MARKER_PCB* marker = new MARKER_PCB( drcItem, conflict.first ); MARKER_PCB* marker = new MARKER_PCB( drcItem, conflict.first );
@ -347,7 +358,12 @@ void DRC::RunTests( wxTextCtrl* aMessages )
testOutline(); testOutline();
// someone should have cleared the two lists before calling this. if( aMessages )
{
aMessages->AppendText( _( "Netclasses...\n" ) );
wxSafeYield();
}
if( !testNetClasses() ) if( !testNetClasses() )
{ {
// testing the netclasses is a special case because if the netclasses // testing the netclasses is a special case because if the netclasses
@ -355,7 +371,7 @@ void DRC::RunTests( wxTextCtrl* aMessages )
// class (a NET) will cause its items such as tracks, vias, and pads // class (a NET) will cause its items such as tracks, vias, and pads
// to also fail. So quit after *all* netclass errors have been reported. // to also fail. So quit after *all* netclass errors have been reported.
if( aMessages ) if( aMessages )
aMessages->AppendText( _( "Aborting\n" ) ); aMessages->AppendText( _( "NETCLASS VIOLATIONS: Aborting DRC\n" ) );
// update the m_drcDialog listboxes // update the m_drcDialog listboxes
updatePointers(); updatePointers();
@ -545,7 +561,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
{ {
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_NETCLASS_CLEARANCE ); DRC_ITEM* drcItem = new DRC_ITEM( DRCE_NETCLASS_CLEARANCE );
msg.Printf( drcItem->GetErrorText() + _( "(board minimum %s; '%s' minimum %s)" ), msg.Printf( drcItem->GetErrorText() + _( " (board minimum %s; %s netclass %s)" ),
MessageTextFromValue( userUnits(), g.m_TrackClearance, true ), MessageTextFromValue( userUnits(), g.m_TrackClearance, true ),
nc->GetName(), nc->GetName(),
MessageTextFromValue( userUnits(), nc->GetClearance(), true ) ); MessageTextFromValue( userUnits(), nc->GetClearance(), true ) );
@ -560,7 +576,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
{ {
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_NETCLASS_TRACKWIDTH ); DRC_ITEM* drcItem = new DRC_ITEM( DRCE_NETCLASS_TRACKWIDTH );
msg.Printf( drcItem->GetErrorText() + _( "(board minimum %s; '%s' minimum %s)" ), msg.Printf( drcItem->GetErrorText() + _( " (board minimum %s; %s netclass %s)" ),
MessageTextFromValue( userUnits(), g.m_TrackMinWidth, true ), MessageTextFromValue( userUnits(), g.m_TrackMinWidth, true ),
nc->GetName(), nc->GetName(),
MessageTextFromValue( userUnits(), nc->GetTrackWidth(), true ) ); MessageTextFromValue( userUnits(), nc->GetTrackWidth(), true ) );
@ -574,7 +590,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
{ {
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_NETCLASS_VIASIZE ); DRC_ITEM* drcItem = new DRC_ITEM( DRCE_NETCLASS_VIASIZE );
msg.Printf( drcItem->GetErrorText() + _( "(board minimum %s; '%s' minimum %s)" ), msg.Printf( drcItem->GetErrorText() + _( " (board minimum %s; %s netclass %s)" ),
MessageTextFromValue( userUnits(), g.m_ViasMinSize, true ), MessageTextFromValue( userUnits(), g.m_ViasMinSize, true ),
nc->GetName(), nc->GetName(),
MessageTextFromValue( userUnits(), nc->GetViaDiameter(), true ) ); MessageTextFromValue( userUnits(), nc->GetViaDiameter(), true ) );
@ -588,7 +604,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
{ {
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_NETCLASS_VIADRILLSIZE ); DRC_ITEM* drcItem = new DRC_ITEM( DRCE_NETCLASS_VIADRILLSIZE );
msg.Printf( drcItem->GetErrorText() + _( "(board minimum %s; '%s' minimum %s)" ), msg.Printf( drcItem->GetErrorText() + _( " (board minimum %s; %s netclass %s)" ),
MessageTextFromValue( userUnits(), g.m_ViasMinDrill, true ), MessageTextFromValue( userUnits(), g.m_ViasMinDrill, true ),
nc->GetName(), nc->GetName(),
MessageTextFromValue( userUnits(), nc->GetViaDrill(), true ) ); MessageTextFromValue( userUnits(), nc->GetViaDrill(), true ) );
@ -602,7 +618,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
{ {
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_NETCLASS_uVIASIZE ); DRC_ITEM* drcItem = new DRC_ITEM( DRCE_NETCLASS_uVIASIZE );
msg.Printf( drcItem->GetErrorText() + _( "(board minimum %s; '%s' minimum %s)" ), msg.Printf( drcItem->GetErrorText() + _( " (board minimum %s; %s netclass %s)" ),
MessageTextFromValue( userUnits(), g.m_MicroViasMinSize, true ), MessageTextFromValue( userUnits(), g.m_MicroViasMinSize, true ),
nc->GetName(), nc->GetName(),
MessageTextFromValue( userUnits(), nc->GetuViaDiameter(), true ) ); MessageTextFromValue( userUnits(), nc->GetuViaDiameter(), true ) );
@ -616,7 +632,7 @@ bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
{ {
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_NETCLASS_uVIADRILLSIZE ); DRC_ITEM* drcItem = new DRC_ITEM( DRCE_NETCLASS_uVIADRILLSIZE );
msg.Printf( drcItem->GetErrorText() + _( "(board minimum %s; '%s' minimum %s)" ), msg.Printf( drcItem->GetErrorText() + _( " (board minimum %s; %s netclass %s)" ),
MessageTextFromValue( userUnits(), g.m_MicroViasMinDrill, true ), MessageTextFromValue( userUnits(), g.m_MicroViasMinDrill, true ),
nc->GetName(), nc->GetName(),
MessageTextFromValue( userUnits(), nc->GetuViaDrill(), true ) ); MessageTextFromValue( userUnits(), nc->GetuViaDrill(), true ) );
@ -1308,9 +1324,11 @@ void DRC::testOutline()
void DRC::testDisabledLayers() void DRC::testDisabledLayers()
{ {
BOARD* board = m_pcbEditorFrame->GetBoard(); BOARD* board = m_pcbEditorFrame->GetBoard();
wxCHECK( board, /*void*/ ); wxCHECK( board, /*void*/ );
LSET disabledLayers = board->GetEnabledLayers().flip();
LSET disabledLayers = board->GetEnabledLayers().flip();
wxString msg;
// Perform the test only for copper layers // Perform the test only for copper layers
disabledLayers &= LSET::AllCuMask(); disabledLayers &= LSET::AllCuMask();
@ -1320,6 +1338,11 @@ void DRC::testDisabledLayers()
if( disabledLayers.test( track->GetLayer() ) ) if( disabledLayers.test( track->GetLayer() ) )
{ {
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_DISABLED_LAYER_ITEM ); DRC_ITEM* drcItem = new DRC_ITEM( DRCE_DISABLED_LAYER_ITEM );
msg.Printf( drcItem->GetErrorText() + _( "layer %s" ),
track->GetLayerName() );
drcItem->SetErrorMessage( msg );
drcItem->SetItems( track ); drcItem->SetItems( track );
MARKER_PCB* marker = new MARKER_PCB( drcItem, track->GetPosition() ); MARKER_PCB* marker = new MARKER_PCB( drcItem, track->GetPosition() );
@ -1335,6 +1358,11 @@ void DRC::testDisabledLayers()
if( disabledLayers.test( child->GetLayer() ) ) if( disabledLayers.test( child->GetLayer() ) )
{ {
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_DISABLED_LAYER_ITEM ); DRC_ITEM* drcItem = new DRC_ITEM( DRCE_DISABLED_LAYER_ITEM );
msg.Printf( drcItem->GetErrorText() + _( "layer %s" ),
child->GetLayerName() );
drcItem->SetErrorMessage( msg );
drcItem->SetItems( child ); drcItem->SetItems( child );
MARKER_PCB* marker = new MARKER_PCB( drcItem, child->GetPosition() ); MARKER_PCB* marker = new MARKER_PCB( drcItem, child->GetPosition() );
@ -1348,6 +1376,11 @@ void DRC::testDisabledLayers()
if( disabledLayers.test( zone->GetLayer() ) ) if( disabledLayers.test( zone->GetLayer() ) )
{ {
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_DISABLED_LAYER_ITEM ); DRC_ITEM* drcItem = new DRC_ITEM( DRCE_DISABLED_LAYER_ITEM );
msg.Printf( drcItem->GetErrorText() + _( "layer %s" ),
zone->GetLayerName() );
drcItem->SetErrorMessage( msg );
drcItem->SetItems( zone ); drcItem->SetItems( zone );
MARKER_PCB* marker = new MARKER_PCB( drcItem, zone->GetPosition() ); MARKER_PCB* marker = new MARKER_PCB( drcItem, zone->GetPosition() );

View File

@ -265,8 +265,8 @@ void DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
// and **only one layer** can be drilled // and **only one layer** can be drilled
if( refvia->GetViaType() == VIATYPE::MICROVIA ) if( refvia->GetViaType() == VIATYPE::MICROVIA )
{ {
PCB_LAYER_ID layer1, layer2; PCB_LAYER_ID layer1, layer2;
bool err = true; bool err = true;
refvia->LayerPair( &layer1, &layer2 ); refvia->LayerPair( &layer1, &layer2 );
@ -281,6 +281,12 @@ void DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
if( err ) if( err )
{ {
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR ); DRC_ITEM* drcItem = new DRC_ITEM( DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR );
msg.Printf( drcItem->GetErrorText() + _( " (%s and %s not adjacent)" ),
m_pcb->GetLayerName( layer1 ),
m_pcb->GetLayerName( layer2 ) );
drcItem->SetErrorMessage( msg );
drcItem->SetItems( refvia ); drcItem->SetItems( refvia );
MARKER_PCB* marker = new MARKER_PCB( drcItem, refvia->GetPosition() ); MARKER_PCB* marker = new MARKER_PCB( drcItem, refvia->GetPosition() );

View File

@ -64,17 +64,17 @@ wxString DRC_ITEM::GetErrorText( int aCode ) const
case DRCE_VIA_HOLE_BIGGER: case DRCE_VIA_HOLE_BIGGER:
return wxString( _( "Via hole > diameter" ) ); return wxString( _( "Via hole > diameter" ) );
case DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR: case DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR:
return wxString( _( "Micro Via: incorrect layer pairs (not adjacent)" ) ); return wxString( _( "Micro Via: incorrect layer pairs" ) );
case DRCE_MICRO_VIA_NOT_ALLOWED: case DRCE_MICRO_VIA_NOT_ALLOWED:
return wxString( _( "Micro Via: not allowed" ) ); return wxString( _( "Micro Via: not allowed (board design rule constraints)" ) );
case DRCE_BURIED_VIA_NOT_ALLOWED: case DRCE_BURIED_VIA_NOT_ALLOWED:
return wxString( _( "Buried Via: not allowed" ) ); return wxString( _( "Buried Via: not allowed (board design rule constraints)" ) );
case DRCE_DISABLED_LAYER_ITEM: case DRCE_DISABLED_LAYER_ITEM:
return wxString( _( "Item on a disabled layer" ) ); return wxString( _( "Item on a disabled layer" ) );
case DRCE_ZONES_INTERSECT: case DRCE_ZONES_INTERSECT:
return wxString( _( "Copper area inside copper area" ) ); return wxString( _( "Copper areas intersect" ) );
case DRCE_ZONES_TOO_CLOSE: case DRCE_ZONES_TOO_CLOSE:
return wxString( _( "Copper areas intersect or are too close" ) ); return wxString( _( "Copper areas too close" ) );
case DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE: case DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE:
return wxString( _( "Copper area belongs to a net which has no pads" ) ); return wxString( _( "Copper area belongs to a net which has no pads" ) );
@ -102,17 +102,17 @@ wxString DRC_ITEM::GetErrorText( int aCode ) const
// use &lt; since this is text ultimately embedded in HTML // use &lt; since this is text ultimately embedded in HTML
case DRCE_NETCLASS_TRACKWIDTH: case DRCE_NETCLASS_TRACKWIDTH:
return wxString( _( "NetClass Track Width < global limit" ) ); return wxString( _( "NetClass Track Width too small" ) );
case DRCE_NETCLASS_CLEARANCE: case DRCE_NETCLASS_CLEARANCE:
return wxString( _( "NetClass Clearance < global limit" ) ); return wxString( _( "NetClass Clearance too small" ) );
case DRCE_NETCLASS_VIASIZE: case DRCE_NETCLASS_VIASIZE:
return wxString( _( "NetClass Via Dia < global limit" ) ); return wxString( _( "NetClass Via Dia too small" ) );
case DRCE_NETCLASS_VIADRILLSIZE: case DRCE_NETCLASS_VIADRILLSIZE:
return wxString( _( "NetClass Via Drill < global limit" ) ); return wxString( _( "NetClass Via Drill too small" ) );
case DRCE_NETCLASS_uVIASIZE: case DRCE_NETCLASS_uVIASIZE:
return wxString( _( "NetClass uVia Dia < global limit" ) ); return wxString( _( "NetClass uVia Dia too small" ) );
case DRCE_NETCLASS_uVIADRILLSIZE: case DRCE_NETCLASS_uVIADRILLSIZE:
return wxString( _( "NetClass uVia Drill < global limit" ) ); return wxString( _( "NetClass uVia Drill too small" ) );
case DRCE_VIA_INSIDE_KEEPOUT: case DRCE_VIA_INSIDE_KEEPOUT:
return wxString( _( "Via inside keepout area" ) ); return wxString( _( "Via inside keepout area" ) );