Separate Compare Footprints from DRC.
(We want to ignore some of the flags for DRC.) Fixes https://gitlab.com/kicad/code/kicad/-/issues/17819
This commit is contained in:
parent
b5fb7b7ace
commit
43e6006306
|
@ -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;
|
||||
|
|
|
@ -547,7 +547,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 );
|
||||
|
||||
|
@ -594,34 +595,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.
|
||||
|
@ -904,7 +900,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 ) )
|
||||
{
|
||||
|
|
|
@ -901,7 +901,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.
|
||||
|
|
|
@ -1611,7 +1611,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" ) );
|
||||
|
|
Loading…
Reference in New Issue