Add persistence of DRC error severities.

This commit is contained in:
Jeff Young 2020-05-07 14:35:50 +01:00
parent 0f8c7ffd11
commit 8efa8af8cc
16 changed files with 246 additions and 218 deletions

View File

@ -42,6 +42,7 @@ PANEL_COLOR_SETTINGS::PANEL_COLOR_SETTINGS( wxWindow* aParent ) :
m_swatches(),
m_copied( COLOR4D::UNSPECIFIED ),
m_validLayers(),
m_backgroundLayer( LAYER_PCB_BACKGROUND ),
m_colorNamespace()
{
#ifdef __APPLE__

View File

@ -142,7 +142,7 @@ public:
* Function GetErrorText
* returns the string form of a RC error code
*/
virtual wxString GetErrorText( int aCode = -1 ) const = 0;
virtual wxString GetErrorText( int aCode = -1, bool aTranslate = true ) const = 0;
/**
* Function GetErrorMessage

View File

@ -23,64 +23,90 @@
#include <fctsys.h>
#include <common.h>
#include "wx/html/m_templ.h"
#include "wx/html/styleparams.h"
#include <erc.h>
#include <erc_item.h>
#include <i18n_utility.h>
wxString ERC_ITEM::GetErrorText( int aErrorCode ) const
wxString ERC_ITEM::GetErrorText( int aErrorCode, bool aTranslate ) const
{
wxString msg;
if( aErrorCode < 0 )
aErrorCode = m_errorCode;
switch( aErrorCode )
{
case ERCE_UNSPECIFIED:
return wxString( _("ERC err unspecified") );
msg = _HKI("ERC err unspecified" );
break;
case ERCE_DUPLICATE_SHEET_NAME:
return wxString( _("Duplicate sheet names within a given sheet") );
msg = _HKI("Duplicate sheet names within a given sheet" );
break;
case ERCE_PIN_NOT_CONNECTED:
return wxString( _("Pin not connected") );
msg = _HKI("Pin not connected" );
break;
case ERCE_PIN_NOT_DRIVEN:
return wxString( _( "Pin connected to other pins, but not driven by any pin" ) );
msg = _HKI( "Pin connected to other pins, but not driven by any pin" );
break;
case ERCE_PIN_TO_PIN_WARNING:
KI_FALLTHROUGH; // Must share text with ERCE_PIN_TO_PIN_ERROR
case ERCE_PIN_TO_PIN_ERROR:
return wxString( _("Conflict problem between pins") );
msg = _HKI("Conflict problem between pins" );
break;
case ERCE_HIERACHICAL_LABEL:
return wxString( _("Mismatch between hierarchical labels and pins sheets") );
msg = _HKI("Mismatch between hierarchical labels and pins sheets" );
break;
case ERCE_NOCONNECT_CONNECTED:
return wxString( _("A pin with a \"no connection\" flag is connected") );
msg = _HKI("A pin with a \"no connection\" flag is connected" );
break;
case ERCE_NOCONNECT_NOT_CONNECTED:
return wxString( _("Unconnected \"no connection\" flag") );
msg = _HKI("Unconnected \"no connection\" flag" );
break;
case ERCE_LABEL_NOT_CONNECTED:
return wxString( _("Label not connected anywhere else in the schematic") );
msg = _HKI("Label not connected anywhere else in the schematic" );
break;
case ERCE_SIMILAR_LABELS:
return wxString( _("Labels are similar (lower/upper case difference only)" ) );
msg = _HKI("Labels are similar (lower/upper case difference only)" );
break;
case ERCE_DIFFERENT_UNIT_FP:
return wxString( _("Different footprint assigned in another unit of the same component" ) );
msg = _HKI("Different footprint assigned in another unit of the same component" );
break;
case ERCE_DIFFERENT_UNIT_NET:
return wxString( _("Different net assigned to a shared pin in another unit of the same component" ) );
msg = _HKI("Different net assigned to a shared pin in another unit of the same component" );
break;
case ERCE_BUS_ALIAS_CONFLICT:
return wxString( _("Conflict between bus alias definitions across schematic sheets") );
msg = _HKI("Conflict between bus alias definitions across schematic sheets" );
break;
case ERCE_DRIVER_CONFLICT:
return wxString( _( "More than one name given to this bus or net" ) );
msg = _HKI( "More than one name given to this bus or net" );
break;
case ERCE_BUS_ENTRY_CONFLICT:
return wxString( _( "Net is graphically connected to a bus but not a bus member" ) );
msg = _HKI( "Net is graphically connected to a bus but not a bus member" );
break;
case ERCE_BUS_LABEL_ERROR:
return wxString( _( "Label attached to bus item does not describe a bus" ) );
msg = _HKI( "Label attached to bus item does not describe a bus" );
break;
case ERCE_BUS_TO_BUS_CONFLICT:
return wxString( _( "Buses are graphically connected but share no bus members" ) );
msg = _HKI( "Buses are graphically connected but share no bus members" );
break;
case ERCE_BUS_TO_NET_CONFLICT:
return wxString( _( "Invalid connection between bus and net items" ) );
msg = _HKI( "Invalid connection between bus and net items" );
break;
case ERCE_GLOBLABEL:
return wxString( _( "Global label not connected anywhere else in the schematic" ) );
msg = _HKI( "Global label not connected anywhere else in the schematic" );
break;
case ERCE_UNRESOLVED_VARIABLE:
return wxString( _( "Unresolved text variable" ) );
msg = _HKI( "Unresolved text variable" );
break;
default:
wxFAIL_MSG( "Missing ERC error description" );
return wxString( wxT( "Unknown" ) );
msg = _HKI( "Unknown ERC violation" );
break;
}
if( aTranslate )
return wxGetTranslation( msg );
else
return msg;
}

View File

@ -39,7 +39,7 @@ public:
* Function GetErrorText
* returns the string form of an erc error code.
*/
wxString GetErrorText( int aErrorCode = -1 ) const override;
wxString GetErrorText( int aErrorCode = -1, bool aTranslate = true ) const override;
};

View File

@ -84,9 +84,9 @@ public:
if( aConfig->Read( wxT( "RequireCourtyardDefinitions" ), &flag, false ) )
{
if( flag )
bds.m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] = RPT_SEVERITY_ERROR;
bds.m_DRCSeverities[ DRCE_MISSING_COURTYARD ] = RPT_SEVERITY_ERROR;
else
bds.m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] = RPT_SEVERITY_IGNORE;
bds.m_DRCSeverities[ DRCE_MISSING_COURTYARD ] = RPT_SEVERITY_IGNORE;
}
if( aConfig->Read( wxT( "ProhibitOverlappingCourtyards" ), &flag, false ) )
@ -106,7 +106,27 @@ public:
bds.m_DRCSeverities[ DRCE_ZERO_LENGTH_TRACK ] = RPT_SEVERITY_ACTION;
bds.m_DRCSeverities[ DRCE_TRACK_IN_PAD ] = RPT_SEVERITY_ACTION;
// TO DO: figure out what we're going to use as keys here so we can read/write these....
DRC_ITEM drc( 0 );
wxString severity;
auto mapSeverity = []( const wxString& aSeverity )
{
if( aSeverity == wxT( "warning" ) )
return RPT_SEVERITY_WARNING;
else if( aSeverity == wxT( "ignore" ) )
return RPT_SEVERITY_IGNORE;
else
return RPT_SEVERITY_ERROR;
};
for( int i = DRCE_FIRST; i <= DRCE_LAST; ++i )
{
wxString name = drc.GetErrorText( i, false );
name.Replace( wxT( " " ), wxT( "_" ) );
if( aConfig->Read( name, &severity, wxEmptyString ) )
bds.m_DRCSeverities[i] = mapSeverity( severity );
}
aConfig->SetPath( oldPath );
}
@ -119,15 +139,25 @@ public:
BOARD* board = m_Pt_param;
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
wxString oldPath = aConfig->GetPath();
DRC_ITEM drc( 0 );
// TO DO: figure out what we're going to use as keys here so we can read/write these....
auto mapSeverity = []( int aSeverity )
{
if( aSeverity == RPT_SEVERITY_IGNORE )
return wxT( "ignore" );
else if( aSeverity == RPT_SEVERITY_WARNING )
return wxT( "warning" );
else
return wxT( "error" );
};
// TO DO: for now just write out the legacy ones so we don't lose them
// TO DO: remove this once the new scheme is in place
aConfig->Write( wxT( "RequireCourtyardDefinitions" ),
bds.m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] != RPT_SEVERITY_IGNORE );
aConfig->Write( wxT( "ProhibitOverlappingCourtyards" ),
bds.m_DRCSeverities[ DRCE_OVERLAPPING_FOOTPRINTS ] != RPT_SEVERITY_IGNORE );
for( int i = DRCE_FIRST; i <= DRCE_LAST; ++i )
{
wxString name = drc.GetErrorText( i, false );
name.Replace( wxT( " " ), wxT( "_" ) );
aConfig->Write( name, mapSeverity( bds.m_DRCSeverities[i] ) );
}
aConfig->SetPath( oldPath );
}
@ -590,7 +620,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
for( int errorCode = DRCE_FIRST; errorCode <= DRCE_LAST; ++errorCode )
m_DRCSeverities[ errorCode ] = RPT_SEVERITY_ERROR;
m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] = RPT_SEVERITY_IGNORE;
m_DRCSeverities[ DRCE_MISSING_COURTYARD ] = RPT_SEVERITY_IGNORE;
m_DRCSeverities[ DRCE_MISSING_FOOTPRINT ] = RPT_SEVERITY_WARNING;
m_DRCSeverities[ DRCE_DUPLICATE_FOOTPRINT ] = RPT_SEVERITY_WARNING;

View File

@ -63,8 +63,8 @@ MARKER_PCB::~MARKER_PCB()
wxString MARKER_PCB::Serialize() const
{
return wxString::Format( wxT( "%d|%d|%d|%s|%s" ),
m_rcItem->GetErrorCode(),
return wxString::Format( wxT( "%s|%d|%d|%s|%s" ),
m_rcItem->GetErrorText( m_rcItem->GetErrorCode(), false ),
m_Pos.x,
m_Pos.y,
m_rcItem->GetMainItemID().AsString(),
@ -75,11 +75,10 @@ wxString MARKER_PCB::Serialize() const
MARKER_PCB* MARKER_PCB::Deserialize( const wxString& data )
{
wxArrayString props = wxSplit( data, '|' );
int errorCode = (int) strtol( props[0].c_str(), nullptr, 10 );
wxPoint markerPos( (int) strtol( props[1].c_str(), nullptr, 10 ),
(int) strtol( props[2].c_str(), nullptr, 10 ) );
DRC_ITEM* drcItem = new DRC_ITEM( errorCode );
DRC_ITEM* drcItem = new DRC_ITEM( props[0] );
drcItem->SetItems( KIID( props[3] ), KIID( props[4] ) );
return new MARKER_PCB( drcItem, markerPos );

View File

@ -477,8 +477,8 @@ void DRC::RunTests( wxTextCtrl* aMessages )
// test courtyards
if( !m_pcb->GetDesignSettings().Ignore( DRCE_OVERLAPPING_FOOTPRINTS )
|| !m_pcb->GetDesignSettings().Ignore( DRCE_MISSING_COURTYARD_IN_FOOTPRINT )
|| !m_pcb->GetDesignSettings().Ignore( DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT ) )
|| !m_pcb->GetDesignSettings().Ignore( DRCE_MISSING_COURTYARD )
|| !m_pcb->GetDesignSettings().Ignore( DRCE_MALFORMED_COURTYARD ) )
{
if( aMessages )
{
@ -935,7 +935,7 @@ void DRC::testZones()
// In recent Pcbnew versions, the netcode is always >= 0, but an internal net name
// is stored, and initialized from the file or the zone properties editor.
// if it differs from the net name from net code, there is a DRC issue
if( !m_pcb->GetDesignSettings().Ignore( DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE ) )
if( !m_pcb->GetDesignSettings().Ignore( DRCE_ZONE_HAS_EMPTY_NET ) )
{
for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ )
{
@ -952,7 +952,7 @@ void DRC::testZones()
if( ( netcode < 0 ) || pads_in_net == 0 )
{
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE );
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_ZONE_HAS_EMPTY_NET );
drcItem->SetItems( zone );
MARKER_PCB* marker = new MARKER_PCB( drcItem, zone->GetPosition() );
@ -1445,13 +1445,18 @@ void DRC::testCopperTextItem( BOARD_ITEM* aTextItem )
void DRC::testOutline()
{
wxPoint error_loc( m_pcb->GetBoardEdgesBoundingBox().GetPosition() );
wxString msg;
wxPoint error_loc( m_pcb->GetBoardEdgesBoundingBox().GetPosition() );
m_board_outlines.RemoveAllContours();
if( !m_pcb->GetBoardPolygonOutlines( m_board_outlines, nullptr, &error_loc ) )
{
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_INVALID_OUTLINE );
msg.Printf( drcItem->GetErrorText() + _( " (not a closed shape)" ) );
drcItem->SetErrorMessage( msg );
drcItem->SetItems( m_pcb );
MARKER_PCB* marker = new MARKER_PCB( drcItem, error_loc );
@ -1722,7 +1727,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
if( !checkClearancePadToPad( aRefPad, pad, minClearance, &actual ) )
{
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_PAD_NEAR_PAD1 );
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_PAD_NEAR_PAD );
msg.Printf( drcItem->GetErrorText() + _( " (%s %s; actual %s)" ),
source,

View File

@ -39,59 +39,59 @@
enum PCB_DRC_CODE {
DRCE_FIRST = 1,
DRCE_UNCONNECTED_ITEMS = DRCE_FIRST, ///< items are unconnected
DRCE_TRACK_NEAR_THROUGH_HOLE, ///< thru hole is too close to track
DRCE_TRACK_NEAR_HOLE, ///< thru hole is too close to track
DRCE_TRACK_NEAR_PAD, ///< pad too close to track
DRCE_TRACK_NEAR_VIA, ///< track too close to via
DRCE_TRACK_NEAR_ZONE, ///< track & zone collide or are too close together
DRCE_TRACK_NEAR_COPPER, ///< track & copper graphic collide or are too close
DRCE_VIA_NEAR_VIA, ///< via too close to via
DRCE_VIA_NEAR_TRACK, ///< via too close to track
DRCE_VIA_NEAR_COPPER, ///< via and copper graphic collide or are too close
DRCE_TRACK_ENDS, ///< track ends are too close
DRCE_TRACK_SEGMENTS_TOO_CLOSE, ///< 2 parallel track segments too close: segm ends between segref ends
DRCE_TRACKS_CROSSING, ///< tracks are crossing
DRCE_PAD_NEAR_PAD1, ///< pad too close to pad
DRCE_VIA_HOLE_BIGGER, ///< via's hole is bigger than its diameter
DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR, ///< micro via's layer pair incorrect (layers must be adjacent)
DRCE_TRACK_NEAR_EDGE, ///< track too close to board edge
DRCE_PAD_NEAR_PAD, ///< pad too close to pad
DRCE_PAD_NEAR_COPPER, ///< pad and copper graphic collide or are too close
DRCE_ZONES_INTERSECT, ///< copper area outlines intersect
DRCE_ZONES_TOO_CLOSE, ///< copper area outlines are too close
DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE, ///< copper area has a net but no pads in nets, which is suspicious
DRCE_ZONE_HAS_EMPTY_NET, ///< copper area has a net but no pads in nets, which is suspicious
DRCE_HOLE_NEAR_PAD, ///< hole too close to pad
DRCE_HOLE_NEAR_TRACK, ///< hole too close to track
DRCE_DRILLED_HOLES_TOO_CLOSE, ///< overlapping drilled holes break drill bits
DRCE_TOO_SMALL_TRACK_WIDTH, ///< Too small track width
DRCE_TOO_SMALL_VIA, ///< Too small via size
DRCE_TOO_SMALL_MICROVIA, ///< Too small micro via size
DRCE_TOO_SMALL_VIA_DRILL, ///< Too small via drill
DRCE_TOO_SMALL_PAD_DRILL, ///< Too small via drill
DRCE_VIA_HOLE_BIGGER, ///< via's hole is bigger than its diameter
DRCE_MICROVIA_NOT_ALLOWED, ///< micro vias are not allowed
DRCE_MICROVIA_TOO_MANY_LAYERS, ///< micro via's layer pair incorrect (layers must be adjacent)
DRCE_TOO_SMALL_MICROVIA, ///< Too small micro via size
DRCE_TOO_SMALL_MICROVIA_DRILL, ///< Too small micro via drill
DRCE_BURIED_VIA_NOT_ALLOWED, ///< buried vias are not allowed
DRCE_NETCLASS_TRACKWIDTH, ///< netclass has TrackWidth < board.m_designSettings->m_TrackMinWidth
DRCE_NETCLASS_CLEARANCE, ///< netclass has Clearance < board.m_designSettings->m_TrackClearance
DRCE_NETCLASS_VIASIZE, ///< netclass has ViaSize < board.m_designSettings->m_ViasMinSize
DRCE_NETCLASS_VIADRILLSIZE, ///< netclass has ViaDrillSize < board.m_designSettings->m_MinThroughDrill
DRCE_NETCLASS_uVIASIZE, ///< netclass has ViaSize < board.m_designSettings->m_MicroViasMinSize
DRCE_NETCLASS_uVIADRILLSIZE, ///< netclass has ViaSize < board.m_designSettings->m_MicroViasMinDrill
DRCE_VIA_INSIDE_KEEPOUT, ///< Via in inside a keepout area
DRCE_TRACK_INSIDE_KEEPOUT, ///< Track inside a keepout area
DRCE_PAD_INSIDE_KEEPOUT, ///< Pad inside a keepout area
DRCE_TRACK_NEAR_COPPER, ///< track & copper graphic collide or are too close
DRCE_VIA_NEAR_COPPER, ///< via and copper graphic collide or are too close
DRCE_PAD_NEAR_COPPER, ///< pad and copper graphic collide or are too close
DRCE_TRACK_NEAR_ZONE, ///< track & zone collide or are too close together
DRCE_VIA_INSIDE_KEEPOUT,
DRCE_TRACK_INSIDE_KEEPOUT,
DRCE_PAD_INSIDE_KEEPOUT,
DRCE_FOOTPRINT_INSIDE_KEEPOUT,
DRCE_OVERLAPPING_FOOTPRINTS, ///< footprint courtyards overlap
DRCE_MISSING_COURTYARD_IN_FOOTPRINT, ///< footprint has no courtyard defined
DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT, ///< footprint has a courtyard but malformed
///< (not convertible to a closed polygon with holes)
DRCE_MICRO_VIA_NOT_ALLOWED, ///< micro vias are not allowed
DRCE_BURIED_VIA_NOT_ALLOWED, ///< buried vias are not allowed
DRCE_MISSING_COURTYARD, ///< footprint has no courtyard defined
DRCE_MALFORMED_COURTYARD, ///< footprint has a courtyard but malformed
///< (not convertible to a closed polygon with holes)
DRCE_DISABLED_LAYER_ITEM, ///< item on a disabled layer
DRCE_DRILLED_HOLES_TOO_CLOSE, ///< overlapping drilled holes break drill bits
DRCE_TRACK_NEAR_EDGE, ///< track too close to board edge
DRCE_INVALID_OUTLINE, ///< invalid board outline
DRCE_MISSING_FOOTPRINT, ///< footprint not found for netlist item
DRCE_DUPLICATE_FOOTPRINT, ///< more than one footprints found for netlist item
DRCE_EXTRA_FOOTPRINT, ///< netlist item not found for footprint
DRCE_UNRESOLVED_VARIABLE,
DRCE_FOOTPRINT_INSIDE_KEEPOUT, ///< Footprint inside a keepout area
DRCE_LAST = DRCE_FOOTPRINT_INSIDE_KEEPOUT,
DRCE_LAST = DRCE_UNRESOLVED_VARIABLE,
// These are actually Cleanup Tracks and Vias actions, not DRCE errors
DRCE_SHORT,
@ -286,11 +286,6 @@ private:
/**
* Check the distance from a pad to segment. This function uses several
* instance variable not passed in:
* // JEY TODO: nuke these:
* m_segmLength = length of the segment being tested
* m_segmAngle = angle of the segment with the X axis;
* m_segmEnd = end coordinate of the segment
* m_padToTestPos = position of pad relative to the origin of segment
* @param aPad Is the pad involved in the check
* @param aSegmentWidth width of the segment to test
* @param aMinDist Is the minimum clearance needed

View File

@ -213,7 +213,7 @@ void DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
// test if the type of via is allowed due to design rules
if( refvia->GetViaType() == VIATYPE::MICROVIA && !dsnSettings.m_MicroViasAllowed )
{
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_MICRO_VIA_NOT_ALLOWED );
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_MICROVIA_NOT_ALLOWED );
msg.Printf( drcItem->GetErrorText() + _( " (board design rule constraints)" ) );
drcItem->SetErrorMessage( msg );
@ -256,7 +256,7 @@ void DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
if( err )
{
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR );
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_MICROVIA_TOO_MANY_LAYERS );
msg.Printf( drcItem->GetErrorText() + _( " (%s and %s not adjacent)" ),
m_pcb->GetLayerName( layer1 ),
@ -345,7 +345,7 @@ void DRC::doTrackDrc( TRACK* aRefSeg, TRACKS::iterator aStartIt, TRACKS::iterato
if( center2center_squared < SEG::Square( center2centerAllowed ) )
{
int actual = std::max( 0.0, sqrt( center2center_squared ) - widths );
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_TRACK_NEAR_THROUGH_HOLE );
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_TRACK_NEAR_HOLE );
msg.Printf( drcItem->GetErrorText() + _( " (%s %s; actual %s)" ),
clearanceSource,

View File

@ -63,14 +63,14 @@ bool DRC_COURTYARD_TESTER::RunDRC( BOARD& aBoard ) const
{
if( footprint->BuildPolyCourtyard() )
{
if( !aBoard.GetDesignSettings().Ignore( DRCE_MISSING_COURTYARD_IN_FOOTPRINT ) )
if( !aBoard.GetDesignSettings().Ignore( DRCE_MISSING_COURTYARD ) )
{
int outlineCount = footprint->GetPolyCourtyardFront().OutlineCount()
+ footprint->GetPolyCourtyardBack().OutlineCount();
if( outlineCount == 0 )
{
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_MISSING_COURTYARD_IN_FOOTPRINT );
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_MISSING_COURTYARD );
drcItem->SetItems( footprint );
HandleMarker( new MARKER_PCB( drcItem, footprint->GetPosition() ) );
success = false;
@ -79,9 +79,13 @@ bool DRC_COURTYARD_TESTER::RunDRC( BOARD& aBoard ) const
}
else
{
if( !aBoard.GetDesignSettings().Ignore( DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT ) )
if( !aBoard.GetDesignSettings().Ignore( DRCE_MALFORMED_COURTYARD ) )
{
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT );
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_MALFORMED_COURTYARD );
msg.Printf( drcItem->GetErrorText() + _( " (not a closed shape)" ) );
drcItem->SetErrorMessage( msg );
drcItem->SetItems( footprint );
HandleMarker( new MARKER_PCB( drcItem, footprint->GetPosition() ) );
success = false;

View File

@ -32,145 +32,114 @@
#include <class_board.h>
wxString DRC_ITEM::GetErrorText( int aCode ) const
DRC_ITEM::DRC_ITEM( int aErrorCode )
{
m_errorCode = aErrorCode;
}
DRC_ITEM::DRC_ITEM( const wxString& aErrorText )
{
for( int errorCode = DRCE_FIRST; errorCode <= DRCE_LAST; ++errorCode )
{
if( aErrorText == GetErrorText( errorCode, false ) )
{
m_errorCode = errorCode;
break;
}
}
}
wxString DRC_ITEM::GetErrorText( int aCode, bool aTranslate ) const
{
wxString msg;
if( aCode < 0 )
aCode = m_errorCode;
switch( aCode )
{
case DRCE_UNCONNECTED_ITEMS:
return wxString( _( "Unconnected items" ) );
case DRCE_TRACK_NEAR_THROUGH_HOLE:
return wxString( _( "Track too close to thru-hole" ) );
case DRCE_TRACK_NEAR_PAD:
return wxString( _( "Track too close to pad" ) );
case DRCE_TRACK_NEAR_VIA:
return wxString( _( "Track too close to via" ) );
case DRCE_VIA_NEAR_VIA:
return wxString( _( "Via too close to via" ) );
case DRCE_VIA_NEAR_TRACK:
return wxString( _( "Via too close to track" ) );
case DRCE_TRACK_ENDS:
return wxString( _( "Two track ends too close" ) );
case DRCE_TRACK_SEGMENTS_TOO_CLOSE:
return wxString( _( "Two parallel track segments too close" ) );
case DRCE_TRACKS_CROSSING:
return wxString( _( "Tracks crossing" ) );
case DRCE_TRACK_NEAR_ZONE:
return wxString( _( "Track too close to copper area" ) );
case DRCE_PAD_NEAR_PAD1:
return wxString( _( "Pad too close to pad" ) );
case DRCE_VIA_HOLE_BIGGER:
return wxString( _( "Via hole > diameter" ) );
case DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR:
return wxString( _( "Micro via through too many layers" ) );
case DRCE_MICRO_VIA_NOT_ALLOWED:
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 DRCE_ZONES_INTERSECT:
return wxString( _( "Copper areas intersect" ) );
case DRCE_ZONES_TOO_CLOSE:
return wxString( _( "Copper areas too close" ) );
case DRCE_UNCONNECTED_ITEMS: msg = _HKI( "Unconnected items" ); break;
case DRCE_TRACK_NEAR_HOLE: msg = _HKI( "Track too close to hole" ); break;
case DRCE_TRACK_NEAR_PAD: msg = _HKI( "Track too close to pad" ); break;
case DRCE_TRACK_NEAR_VIA: msg = _HKI( "Track too close to via" ); break;
case DRCE_VIA_NEAR_VIA: msg = _HKI( "Vias too close" ); break;
case DRCE_VIA_NEAR_TRACK: msg = _HKI( "Via too close to track" ); break;
case DRCE_TRACK_ENDS: msg = _HKI( "Track ends too close" ); break;
case DRCE_TRACK_SEGMENTS_TOO_CLOSE: msg = _HKI( "Parallel tracks too close" ); break;
case DRCE_TRACKS_CROSSING: msg = _HKI( "Tracks crossing" ); break;
case DRCE_TRACK_NEAR_ZONE: msg = _HKI( "Track too close to copper area" ); break;
case DRCE_PAD_NEAR_PAD: msg = _HKI( "Pads too close" ); break;
case DRCE_VIA_HOLE_BIGGER: msg = _HKI( "Via hole larger than diameter" ); break;
case DRCE_MICROVIA_TOO_MANY_LAYERS: msg = _HKI( "Micro via through too many layers" ); break;
case DRCE_MICROVIA_NOT_ALLOWED: msg = _HKI( "Micro via not allowed" ); break;
case DRCE_BURIED_VIA_NOT_ALLOWED: msg = _HKI( "Buried via not allowed" ); break;
case DRCE_DISABLED_LAYER_ITEM: msg = _HKI( "Item on a disabled layer" ); break;
case DRCE_ZONES_INTERSECT: msg = _HKI( "Copper areas intersect" ); break;
case DRCE_ZONES_TOO_CLOSE: msg = _HKI( "Copper areas too close" ); break;
case DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE:
return wxString( _( "Copper area belongs to a net which has no pads" ) );
case DRCE_ZONE_HAS_EMPTY_NET: msg = _HKI( "Copper zone net has no pads" ); break;
case DRCE_HOLE_NEAR_PAD:
return wxString( _( "Hole too close to pad" ) );
case DRCE_HOLE_NEAR_TRACK:
return wxString( _( "Hole too close to track" ) );
case DRCE_TOO_SMALL_TRACK_WIDTH:
return wxString( _( "Track width too small" ) );
case DRCE_TOO_SMALL_VIA:
return wxString( _( "Via size too small" ) );
case DRCE_TOO_SMALL_MICROVIA:
return wxString( _( "Micro via size too small" ) );
case DRCE_TOO_SMALL_VIA_DRILL:
return wxString( _( "Via drill too small" ) );
case DRCE_TOO_SMALL_PAD_DRILL:
return wxString( _( "Pad drill too small" ) );
case DRCE_TOO_SMALL_MICROVIA_DRILL:
return wxString( _( "Micro via drill too small" ) );
case DRCE_DRILLED_HOLES_TOO_CLOSE:
return wxString( _( "Drilled holes too close together" ) );
case DRCE_TRACK_NEAR_EDGE:
return wxString( _( "Track too close to board edge" ) );
case DRCE_INVALID_OUTLINE:
return wxString( _( "Board outline does not form a closed polygon" ) );
case DRCE_HOLE_NEAR_PAD: msg = _HKI( "Hole too close to pad" ); break;
case DRCE_HOLE_NEAR_TRACK: msg = _HKI( "Hole too close to track" ); break;
case DRCE_TOO_SMALL_TRACK_WIDTH: msg = _HKI( "Track width too small" ); break;
case DRCE_TOO_SMALL_VIA: msg = _HKI( "Via size too small" ); break;
case DRCE_TOO_SMALL_MICROVIA: msg = _HKI( "Micro via size too small" ); break;
case DRCE_TOO_SMALL_VIA_DRILL: msg = _HKI( "Via drill too small" ); break;
case DRCE_TOO_SMALL_PAD_DRILL: msg = _HKI( "Pad drill too small" ); break;
case DRCE_TOO_SMALL_MICROVIA_DRILL: msg = _HKI( "Micro via drill too small" ); break;
case DRCE_DRILLED_HOLES_TOO_CLOSE: msg = _HKI( "Drilled holes too close together" ); break;
case DRCE_TRACK_NEAR_EDGE: msg = _HKI( "Track too close to board edge" ); break;
case DRCE_INVALID_OUTLINE: msg = _HKI( "Board has malformed outline" ); break;
// use &lt; since this is text ultimately embedded in HTML
case DRCE_NETCLASS_TRACKWIDTH:
return wxString( _( "NetClass Track Width too small" ) );
case DRCE_NETCLASS_CLEARANCE:
return wxString( _( "NetClass Clearance too small" ) );
case DRCE_NETCLASS_VIASIZE:
return wxString( _( "NetClass Via Dia too small" ) );
case DRCE_NETCLASS_VIADRILLSIZE:
return wxString( _( "NetClass Via Drill too small" ) );
case DRCE_NETCLASS_uVIASIZE:
return wxString( _( "NetClass uVia Dia too small" ) );
case DRCE_NETCLASS_uVIADRILLSIZE:
return wxString( _( "NetClass uVia Drill too small" ) );
case DRCE_NETCLASS_TRACKWIDTH: msg = _HKI( "NetClass Track Width too small" ); break;
case DRCE_NETCLASS_CLEARANCE: msg = _HKI( "NetClass Clearance too small" ); break;
case DRCE_NETCLASS_VIASIZE: msg = _HKI( "NetClass Via Dia too small" ); break;
case DRCE_NETCLASS_VIADRILLSIZE: msg = _HKI( "NetClass Via Drill too small" ); break;
case DRCE_NETCLASS_uVIASIZE: msg = _HKI( "NetClass uVia Dia too small" ); break;
case DRCE_NETCLASS_uVIADRILLSIZE: msg = _HKI( "NetClass uVia Drill too small" ); break;
case DRCE_VIA_INSIDE_KEEPOUT:
return wxString( _( "Via inside keepout area" ) );
case DRCE_TRACK_INSIDE_KEEPOUT:
return wxString( _( "Track inside keepout area" ) );
case DRCE_PAD_INSIDE_KEEPOUT:
return wxString( _( "Pad inside keepout area" ) );
case DRCE_FOOTPRINT_INSIDE_KEEPOUT:
return wxString( _( "Footprint inside keepout area" ) );
case DRCE_VIA_INSIDE_KEEPOUT: msg = _HKI( "Via inside keepout area" ); break;
case DRCE_TRACK_INSIDE_KEEPOUT: msg = _HKI( "Track inside keepout area" ); break;
case DRCE_PAD_INSIDE_KEEPOUT: msg = _HKI( "Pad inside keepout area" ); break;
case DRCE_FOOTPRINT_INSIDE_KEEPOUT: msg = _HKI( "Footprint inside keepout area" ); break;
case DRCE_VIA_NEAR_COPPER:
return wxString( _( "Via too close to copper item" ) );
case DRCE_TRACK_NEAR_COPPER:
return wxString( _( "Track too close to copper item" ) );
case DRCE_PAD_NEAR_COPPER:
return wxString( _( "Pad too close to copper item" ) );
case DRCE_VIA_NEAR_COPPER: msg = _HKI( "Via too close to copper item" ); break;
case DRCE_TRACK_NEAR_COPPER: msg = _HKI( "Track too close to copper item" ); break;
case DRCE_PAD_NEAR_COPPER: msg = _HKI( "Pad too close to copper item" ); break;
case DRCE_OVERLAPPING_FOOTPRINTS:
return wxString( _( "Courtyards overlap" ) );
case DRCE_OVERLAPPING_FOOTPRINTS: msg = _HKI( "Courtyards overlap" ); break;
case DRCE_MISSING_COURTYARD: msg = _HKI( "Footprint has no courtyard defined" ); break;
case DRCE_MALFORMED_COURTYARD: msg = _HKI( "Footprint has malformed courtyard" ); break;
case DRCE_MISSING_COURTYARD_IN_FOOTPRINT:
return wxString( _( "Footprint has no courtyard defined" ) );
case DRCE_DUPLICATE_FOOTPRINT: msg = _HKI( "Duplicate footprints" ); break;
case DRCE_MISSING_FOOTPRINT: msg = _HKI( "Missing footprint" ); break;
case DRCE_EXTRA_FOOTPRINT: msg = _HKI( "Extra footprint" ); break;
case DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT:
return wxString( _( "Footprint has incorrect courtyard (not a closed shape)" ) );
// For cleanup tracks and vias:
case DRCE_SHORT: msg = _HKI( "Remove track shorting two nets" ); break;
case DRCE_REDUNDANT_VIA: msg = _HKI( "Remove redundant via" ); break;
case DRCE_DUPLICATE_TRACK: msg = _HKI( "Remove duplicate track" ); break;
case DRCE_MERGE_TRACKS: msg = _HKI( "Merge co-linear tracks" ); break;
case DRCE_DANGLING_TRACK: msg = _HKI( "Remove dangling track" ); break;
case DRCE_DANGLING_VIA: msg = _HKI( "Remove dangling via" ); break;
case DRCE_ZERO_LENGTH_TRACK: msg = _HKI( "Remove zero-length track" ); break;
case DRCE_TRACK_IN_PAD: msg = _HKI( "Remove track inside pad" ); break;
case DRCE_DUPLICATE_FOOTPRINT:
return wxString( _( "Duplicate footprints" ) );
case DRCE_MISSING_FOOTPRINT:
return wxString( _( "Missing footprint" ) );
case DRCE_EXTRA_FOOTPRINT:
return wxString( _( "Extra footprint" ) );
case DRCE_SHORT:
return wxString( _( "Remove track shorting two nets" ) );
case DRCE_REDUNDANT_VIA:
return wxString( _( "Remove redundant via" ) );
case DRCE_DUPLICATE_TRACK:
return wxString( _( "Remove duplicate track" ) );
case DRCE_MERGE_TRACKS:
return wxString( _( "Merge co-linear tracks" ) );
case DRCE_DANGLING_TRACK:
return wxString( _( "Remove dangling track" ) );
case DRCE_DANGLING_VIA:
return wxString( _( "Remove dangling via" ) );
case DRCE_ZERO_LENGTH_TRACK:
return wxString( _( "Remove zero-length track" ) );
case DRCE_TRACK_IN_PAD:
return wxString( _( "Remove track inside pad" ) );
case DRCE_UNRESOLVED_VARIABLE:
return wxString( _( "Unresolved text variable" ) );
case DRCE_UNRESOLVED_VARIABLE: msg = _HKI( "Unresolved text variable" ); break;
default:
return wxEmptyString;
wxFAIL_MSG( "Missing DRC error description" );
msg = _HKI( "Unknown DRC violation" );
break;
}
if( aTranslate )
return wxGetTranslation( msg );
else
return msg;
}

View File

@ -31,21 +31,20 @@
#include <marker_base.h>
#include <class_board.h>
#include <pcb_base_frame.h>
#include "drc.h"
class DRC_ITEM : public RC_ITEM
{
public:
DRC_ITEM( int aErrorCode )
{
m_errorCode = aErrorCode;
}
DRC_ITEM( int aErrorCode );
DRC_ITEM( const wxString& aErrorText );
/**
* Function GetErrorText
* returns the string form of a drc error code.
*/
wxString GetErrorText( int aErrorCode = -1 ) const override;
wxString GetErrorText( int aErrorCode = -1, bool aTranslate = true ) const override;
/**
* Function ShowHtml

View File

@ -63,9 +63,9 @@ void PCB_PARSER::init()
m_layerIndices.clear();
m_layerMasks.clear();
// Add untranslated default (i.e. english) layernames.
// Add untranslated default (i.e. English) layernames.
// Some may be overridden later if parsing a board rather than a footprint.
// The english name will survive if parsing only a footprint.
// The English name will survive if parsing only a footprint.
for( LAYER_NUM layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
std::string untranslated = TO_UTF8( wxString( LSET::Name( PCB_LAYER_ID( layer ) ) ) );

View File

@ -102,7 +102,7 @@ static const std::vector<COURTYARD_INVALID_CASE> courtyard_invalid_cases =
{ // one error: the module has no courtyard
{
"U1",
DRCE_MISSING_COURTYARD_IN_FOOTPRINT,
DRCE_MISSING_COURTYARD,
},
},
},
@ -121,7 +121,7 @@ static const std::vector<COURTYARD_INVALID_CASE> courtyard_invalid_cases =
{ // one error: the module has malformed courtyard
{
"U1",
DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT,
DRCE_MALFORMED_COURTYARD,
},
},
},
@ -140,7 +140,7 @@ static const std::vector<COURTYARD_INVALID_CASE> courtyard_invalid_cases =
{ // one error: the module has malformed courtyard
{
"U1",
DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT,
DRCE_MALFORMED_COURTYARD,
},
},
},
@ -179,7 +179,7 @@ static const std::vector<COURTYARD_INVALID_CASE> courtyard_invalid_cases =
{ // one error: the second module has malformed courtyard
{
"U2",
DRCE_MALFORMED_COURTYARD_IN_FOOTPRINT,
DRCE_MALFORMED_COURTYARD,
},
},
},
@ -242,7 +242,7 @@ static BOARD_DESIGN_SETTINGS GetOverlapCheckDesignSettings()
des_settings.m_DRCSeverities[ DRCE_OVERLAPPING_FOOTPRINTS ] = RPT_SEVERITY_ERROR;
// we will also check for missing courtyards here
des_settings.m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] = RPT_SEVERITY_ERROR;
des_settings.m_DRCSeverities[ DRCE_MISSING_COURTYARD ] = RPT_SEVERITY_ERROR;
return des_settings;
}

View File

@ -450,7 +450,7 @@ static BOARD_DESIGN_SETTINGS GetOverlapCheckDesignSettings()
des_settings.m_DRCSeverities[ DRCE_OVERLAPPING_FOOTPRINTS ] = RPT_SEVERITY_ERROR;
// we might not always have courtyards - that's a separate test
des_settings.m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] = RPT_SEVERITY_IGNORE;
des_settings.m_DRCSeverities[ DRCE_MISSING_COURTYARD ] = RPT_SEVERITY_IGNORE;
return des_settings;
}

View File

@ -160,7 +160,7 @@ private:
BOARD_DESIGN_SETTINGS getDesignSettings() const override
{
BOARD_DESIGN_SETTINGS des_settings;
des_settings.m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] = RPT_SEVERITY_IGNORE;
des_settings.m_DRCSeverities[ DRCE_MISSING_COURTYARD ] = RPT_SEVERITY_IGNORE;
des_settings.m_DRCSeverities[ DRCE_OVERLAPPING_FOOTPRINTS ] = RPT_SEVERITY_ERROR;
return des_settings;
@ -197,7 +197,7 @@ private:
BOARD_DESIGN_SETTINGS getDesignSettings() const override
{
BOARD_DESIGN_SETTINGS des_settings;
des_settings.m_DRCSeverities[ DRCE_MISSING_COURTYARD_IN_FOOTPRINT ] = RPT_SEVERITY_ERROR;
des_settings.m_DRCSeverities[ DRCE_MISSING_COURTYARD ] = RPT_SEVERITY_ERROR;
des_settings.m_DRCSeverities[ DRCE_OVERLAPPING_FOOTPRINTS ] = RPT_SEVERITY_IGNORE;
return des_settings;