Separate Compare Footprints from DRC.

(We want to ignore some of the flags for DRC.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17819

(cherry picked from commit 43e6006306)
This commit is contained in:
Jeff Young 2024-04-28 23:05:14 +01:00
parent 743759578d
commit 2ee2d7d5d9
4 changed files with 29 additions and 27 deletions

View File

@ -371,6 +371,11 @@ public:
int aClearance, int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth = false ) const;
enum COMPARE_FLAGS : int
{
DRC = 0x01
};
struct ptr_cmp
{
bool operator() ( const BOARD_ITEM* a, const BOARD_ITEM* b ) const;

View File

@ -506,7 +506,8 @@ bool zoneNeedsUpdate( const ZONE* a, const ZONE* b, REPORTER* aReporter )
}
bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFP, REPORTER* aReporter )
bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFP, int aCompareFlags,
REPORTER* aReporter )
{
UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::MILLIMETRES );
@ -553,34 +554,29 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFP, REPORTER* aReport
wxString::Format( _( "'%s' settings differ." ),
_( "Allow bridged solder mask apertures between pads" ) ) );
TEST_ATTR( GetAttributes(), aLibFP->GetAttributes(), FP_BOARD_ONLY,
wxString::Format( _( "'%s' settings differ." ),
_( "Not in schematic" ) ) );
TEST_ATTR( GetAttributes(), aLibFP->GetAttributes(), FP_EXCLUDE_FROM_POS_FILES,
wxString::Format( _( "'%s' settings differ." ),
_( "Exclude from position files" ) ) );
// this test is skipped: EXCLUDE_FROM_BOM attribute is related to a given design,
// not to a lib footprint. EXCLUDE_FROM_BOM must be tested only in Schematic Parity
#if 0
TEST_ATTR( GetAttributes(), aLibFP->GetAttributes(), FP_EXCLUDE_FROM_BOM,
wxString::Format( _( "'%s' settings differ." ),
_( "Exclude from bill of materials" ) ) );
#endif
TEST_ATTR( GetAttributes(), aLibFP->GetAttributes(), FP_ALLOW_MISSING_COURTYARD,
wxString::Format( _( "'%s' settings differ." ),
_( "Exempt From Courtyard Requirement" ) ) );
// this test is skipped: Do No Place attribute is related to a given design,
// not to a lib footprint. DNP must be tested only in Schematic Parity
#if 0
TEST_ATTR( GetAttributes(), aLibFP->GetAttributes(), FP_DNP,
wxString::Format( _( "'%s' settings differ." ),
_( "Do not populate" ) ) );
#endif
if( !( aCompareFlags & COMPARE_FLAGS::DRC ) )
{
// These tests are skipped for DRC: they are presumed to relate to a given design.
TEST_ATTR( GetAttributes(), aLibFP->GetAttributes(), FP_BOARD_ONLY,
wxString::Format( _( "'%s' settings differ." ),
_( "Not in schematic" ) ) );
TEST_ATTR( GetAttributes(), aLibFP->GetAttributes(), FP_EXCLUDE_FROM_POS_FILES,
wxString::Format( _( "'%s' settings differ." ),
_( "Exclude from position files" ) ) );
TEST_ATTR( GetAttributes(), aLibFP->GetAttributes(), FP_EXCLUDE_FROM_BOM,
wxString::Format( _( "'%s' settings differ." ),
_( "Exclude from bill of materials" ) ) );
TEST_ATTR( GetAttributes(), aLibFP->GetAttributes(), FP_DNP,
wxString::Format( _( "'%s' settings differ." ),
_( "Do not populate" ) ) );
}
// Clearance and zone connection overrides are as likely to be set at the board level as in
// the library.
@ -840,7 +836,7 @@ bool DRC_TEST_PROVIDER_LIBRARY_PARITY::Run()
reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
}
}
else if( footprint->FootprintNeedsUpdate( libFootprint.get() ) )
else if( footprint->FootprintNeedsUpdate( libFootprint.get(), BOARD_ITEM::COMPARE_FLAGS::DRC ) )
{
if( !m_drcEngine->IsErrorLimitExceeded( DRCE_LIB_FOOTPRINT_MISMATCH ) )
{

View File

@ -879,7 +879,8 @@ public:
/**
* Return true if a board footprint differs from the library version.
*/
bool FootprintNeedsUpdate( const FOOTPRINT* aLibFP, REPORTER* aReporter = nullptr );
bool FootprintNeedsUpdate( const FOOTPRINT* aLibFP, int aCompareFlags = 0,
REPORTER* aReporter = nullptr );
/**
* Take ownership of caller's heap allocated aInitialComments block.

View File

@ -1542,7 +1542,7 @@ void BOARD_INSPECTION_TOOL::DiffFootprint( FOOTPRINT* aFootprint )
}
else
{
if( !aFootprint->FootprintNeedsUpdate( libFootprint.get(), r ) )
if( !aFootprint->FootprintNeedsUpdate( libFootprint.get(), 0, r ) )
r->Report( _( "No relevant differences detected." ) );
wxPanel* panel = dialog->AddBlankPage( _( "Visual" ) );