2020-08-25 17:42:52 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2022-03-11 21:16:52 +00:00
|
|
|
* Copyright (C) 2004-2022 KiCad Developers.
|
2020-08-25 17:42:52 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <geometry/shape_poly_set.h>
|
2021-06-06 19:03:10 +00:00
|
|
|
#include <drc/drc_engine.h>
|
2020-09-11 15:04:11 +00:00
|
|
|
#include <drc/drc_item.h>
|
|
|
|
#include <drc/drc_rule.h>
|
2021-09-03 23:16:05 +00:00
|
|
|
#include <pad.h>
|
|
|
|
#include <geometry/shape_segment.h>
|
2020-09-11 16:24:27 +00:00
|
|
|
#include <drc/drc_test_provider_clearance_base.h>
|
2021-06-03 18:05:43 +00:00
|
|
|
#include <footprint.h>
|
2020-08-25 17:42:52 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Couartyard clearance. Tests for malformed component courtyards and overlapping footprints.
|
|
|
|
Generated errors:
|
|
|
|
- DRCE_OVERLAPPING_FOOTPRINTS
|
|
|
|
- DRCE_MISSING_COURTYARD
|
|
|
|
- DRCE_MALFORMED_COURTYARD
|
2021-09-03 23:16:05 +00:00
|
|
|
- DRCE_PTH_IN_COURTYARD,
|
|
|
|
- DRCE_NPTH_IN_COURTYARD,
|
2020-08-25 17:42:52 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
class DRC_TEST_PROVIDER_COURTYARD_CLEARANCE : public DRC_TEST_PROVIDER_CLEARANCE_BASE
|
|
|
|
{
|
|
|
|
public:
|
2022-06-17 21:50:59 +00:00
|
|
|
DRC_TEST_PROVIDER_COURTYARD_CLEARANCE () :
|
|
|
|
DRC_TEST_PROVIDER_CLEARANCE_BASE(),
|
|
|
|
m_largestCourtyardClearance( 0 )
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
|
|
|
m_isRuleDriven = false;
|
|
|
|
}
|
|
|
|
|
2021-06-06 19:03:10 +00:00
|
|
|
virtual ~DRC_TEST_PROVIDER_COURTYARD_CLEARANCE ()
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool Run() override;
|
|
|
|
|
2021-06-06 19:03:10 +00:00
|
|
|
virtual const wxString GetName() const override
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2022-03-11 21:16:52 +00:00
|
|
|
return wxT( "courtyard_clearance" );
|
2020-09-11 16:24:27 +00:00
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
|
|
|
|
virtual const wxString GetDescription() const override
|
|
|
|
{
|
2022-03-11 21:16:52 +00:00
|
|
|
return wxT( "Tests footprints' courtyard clearance" );
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2021-02-27 13:43:41 +00:00
|
|
|
bool testFootprintCourtyardDefinitions();
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-02-27 13:43:41 +00:00
|
|
|
bool testCourtyardClearances();
|
2022-06-17 21:50:59 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
int m_largestCourtyardClearance;
|
2020-08-25 17:42:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-02-27 13:43:41 +00:00
|
|
|
bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions()
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2020-09-11 21:50:53 +00:00
|
|
|
// Detects missing (or malformed) footprint courtyards
|
2021-02-27 13:43:41 +00:00
|
|
|
if( !m_drcEngine->IsErrorLimitExceeded( DRCE_MALFORMED_COURTYARD)
|
|
|
|
|| !m_drcEngine->IsErrorLimitExceeded( DRCE_MISSING_COURTYARD) )
|
|
|
|
{
|
|
|
|
if( !reportPhase( _( "Checking footprint courtyard definitions..." ) ) )
|
|
|
|
return false; // DRC cancelled
|
|
|
|
}
|
|
|
|
else if( !m_drcEngine->IsErrorLimitExceeded( DRCE_OVERLAPPING_FOOTPRINTS) )
|
|
|
|
{
|
|
|
|
if( !reportPhase( _( "Gathering footprint courtyards..." ) ) )
|
|
|
|
return false; // DRC cancelled
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-03-11 21:16:52 +00:00
|
|
|
reportAux( wxT( "All courtyard violations ignored. Tests not run." ) );
|
2021-02-27 13:43:41 +00:00
|
|
|
return true; // continue with other tests
|
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-08-03 09:10:23 +00:00
|
|
|
const int progressDelta = 500;
|
|
|
|
int ii = 0;
|
2020-09-16 15:03:55 +00:00
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
for( FOOTPRINT* footprint : m_board->Footprints() )
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2022-08-03 09:10:23 +00:00
|
|
|
if( !reportProgress( ii++, m_board->Footprints().size(), progressDelta ) )
|
2021-02-27 13:43:41 +00:00
|
|
|
return false; // DRC cancelled
|
2020-09-16 15:03:55 +00:00
|
|
|
|
2020-11-20 13:55:10 +00:00
|
|
|
if( ( footprint->GetFlags() & MALFORMED_COURTYARDS ) != 0 )
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2020-09-12 19:28:22 +00:00
|
|
|
if( m_drcEngine->IsErrorLimitExceeded( DRCE_MALFORMED_COURTYARD) )
|
|
|
|
continue;
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2020-11-21 20:42:27 +00:00
|
|
|
OUTLINE_ERROR_HANDLER errorHandler =
|
2022-01-01 06:04:08 +00:00
|
|
|
[&]( const wxString& msg, BOARD_ITEM*, BOARD_ITEM*, const VECTOR2I& pt )
|
2020-11-21 20:42:27 +00:00
|
|
|
{
|
|
|
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_MALFORMED_COURTYARD );
|
|
|
|
drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg );
|
|
|
|
drcItem->SetItems( footprint );
|
2021-12-26 13:47:00 +00:00
|
|
|
reportViolation( drcItem, pt, UNDEFINED_LAYER );
|
2020-11-21 20:42:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Re-run courtyard tests to generate DRC_ITEMs
|
2022-07-31 21:14:24 +00:00
|
|
|
footprint->BuildCourtyardCaches( &errorHandler );
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
2022-07-31 21:14:24 +00:00
|
|
|
else if( footprint->GetCourtyard( F_CrtYd ).OutlineCount() == 0
|
|
|
|
&& footprint->GetCourtyard( B_CrtYd ).OutlineCount() == 0 )
|
2020-10-25 15:02:49 +00:00
|
|
|
{
|
|
|
|
if( m_drcEngine->IsErrorLimitExceeded( DRCE_MISSING_COURTYARD ) )
|
|
|
|
continue;
|
|
|
|
|
2021-12-07 19:24:26 +00:00
|
|
|
if( footprint->GetAttributes() & FP_ALLOW_MISSING_COURTYARD )
|
|
|
|
continue;
|
|
|
|
|
2020-10-25 15:02:49 +00:00
|
|
|
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_MISSING_COURTYARD );
|
|
|
|
drcItem->SetItems( footprint );
|
2021-12-26 13:47:00 +00:00
|
|
|
reportViolation( drcItem, footprint->GetPosition(), UNDEFINED_LAYER );
|
2020-10-25 15:02:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-07-31 21:14:24 +00:00
|
|
|
footprint->GetCourtyard( F_CrtYd ).BuildBBoxCaches();
|
|
|
|
footprint->GetCourtyard( B_CrtYd ).BuildBBoxCaches();
|
2020-10-25 15:02:49 +00:00
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
2021-02-27 13:43:41 +00:00
|
|
|
|
2022-03-11 20:13:47 +00:00
|
|
|
return !m_drcEngine->IsCancelled();
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-02-27 13:43:41 +00:00
|
|
|
bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances()
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2020-10-04 11:44:22 +00:00
|
|
|
if( !reportPhase( _( "Checking footprints for overlapping courtyards..." ) ) )
|
2021-02-27 13:43:41 +00:00
|
|
|
return false; // DRC cancelled
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-08-03 09:10:23 +00:00
|
|
|
const int progressDelta = 100;
|
|
|
|
int ii = 0;
|
2020-09-16 15:03:55 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
for( auto itA = m_board->Footprints().begin(); itA != m_board->Footprints().end(); itA++ )
|
2020-09-11 21:50:53 +00:00
|
|
|
{
|
2022-08-03 09:10:23 +00:00
|
|
|
if( !reportProgress( ii++, m_board->Footprints().size(), progressDelta ) )
|
2021-02-27 13:43:41 +00:00
|
|
|
return false; // DRC cancelled
|
2020-09-16 15:03:55 +00:00
|
|
|
|
2021-09-03 23:16:05 +00:00
|
|
|
if( m_drcEngine->IsErrorLimitExceeded( DRCE_OVERLAPPING_FOOTPRINTS)
|
|
|
|
&& m_drcEngine->IsErrorLimitExceeded( DRCE_PTH_IN_COURTYARD )
|
|
|
|
&& m_drcEngine->IsErrorLimitExceeded( DRCE_NPTH_IN_COURTYARD ) )
|
|
|
|
{
|
|
|
|
return true; // continue with other tests
|
|
|
|
}
|
2020-09-12 19:28:22 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
FOOTPRINT* fpA = *itA;
|
2022-07-31 21:14:24 +00:00
|
|
|
const SHAPE_POLY_SET& frontA = fpA->GetCourtyard( F_CrtYd );
|
|
|
|
const SHAPE_POLY_SET& backA = fpA->GetCourtyard( B_CrtYd );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-09-03 23:16:05 +00:00
|
|
|
if( frontA.OutlineCount() == 0 && backA.OutlineCount() == 0
|
|
|
|
&& m_drcEngine->IsErrorLimitExceeded( DRCE_PTH_IN_COURTYARD )
|
|
|
|
&& m_drcEngine->IsErrorLimitExceeded( DRCE_NPTH_IN_COURTYARD ) )
|
|
|
|
{
|
|
|
|
// No courtyards defined and no hole testing against other footprint's courtyards
|
|
|
|
continue;
|
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-08-26 12:21:52 +00:00
|
|
|
BOX2I frontA_worstCaseBBox = frontA.BBoxFromCaches();
|
|
|
|
BOX2I backA_worstCaseBBox = backA.BBoxFromCaches();
|
2020-12-23 17:33:39 +00:00
|
|
|
|
2022-08-26 12:21:52 +00:00
|
|
|
frontA_worstCaseBBox.Inflate( m_largestCourtyardClearance );
|
|
|
|
backA_worstCaseBBox.Inflate( m_largestCourtyardClearance );
|
2020-12-23 17:33:39 +00:00
|
|
|
|
2022-08-31 09:15:42 +00:00
|
|
|
BOX2I fpA_bbox = fpA->GetBoundingBox();
|
2021-09-03 23:16:05 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
for( auto itB = itA + 1; itB != m_board->Footprints().end(); itB++ )
|
2020-09-11 21:50:53 +00:00
|
|
|
{
|
2021-08-15 17:23:54 +00:00
|
|
|
FOOTPRINT* fpB = *itB;
|
2022-07-31 21:14:24 +00:00
|
|
|
const SHAPE_POLY_SET& frontB = fpB->GetCourtyard( F_CrtYd );
|
|
|
|
const SHAPE_POLY_SET& backB = fpB->GetCourtyard( B_CrtYd );
|
2022-08-26 12:21:52 +00:00
|
|
|
|
|
|
|
if( frontB.OutlineCount() == 0 && backB.OutlineCount() == 0
|
|
|
|
&& m_drcEngine->IsErrorLimitExceeded( DRCE_PTH_IN_COURTYARD )
|
|
|
|
&& m_drcEngine->IsErrorLimitExceeded( DRCE_NPTH_IN_COURTYARD ) )
|
|
|
|
{
|
|
|
|
// No courtyards defined and no hole testing against other footprint's courtyards
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOX2I frontB_worstCaseBBox = frontB.BBoxFromCaches();
|
|
|
|
BOX2I backB_worstCaseBBox = backB.BBoxFromCaches();
|
|
|
|
|
|
|
|
frontB_worstCaseBBox.Inflate( m_largestCourtyardClearance );
|
|
|
|
backB_worstCaseBBox.Inflate( m_largestCourtyardClearance );
|
|
|
|
|
2022-08-31 09:15:42 +00:00
|
|
|
BOX2I fpB_bbox = fpB->GetBoundingBox();
|
2022-08-26 12:21:52 +00:00
|
|
|
DRC_CONSTRAINT constraint;
|
|
|
|
int clearance;
|
|
|
|
int actual;
|
|
|
|
VECTOR2I pos;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Check courtyard-to-courtyard collisions on front of board.
|
|
|
|
//
|
2020-09-11 21:50:53 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
if( frontA.OutlineCount() > 0 && frontB.OutlineCount() > 0
|
2022-08-26 12:21:52 +00:00
|
|
|
&& frontA_worstCaseBBox.Intersects( frontB.BBoxFromCaches() ) )
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2021-09-05 15:06:12 +00:00
|
|
|
constraint = m_drcEngine->EvalRules( COURTYARD_CLEARANCE_CONSTRAINT, fpA, fpB, F_Cu );
|
2020-12-23 17:33:39 +00:00
|
|
|
clearance = constraint.GetValue().Min();
|
2020-09-11 21:50:53 +00:00
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
if( constraint.GetSeverity() != RPT_SEVERITY_IGNORE && clearance >= 0 )
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
2021-09-05 15:06:12 +00:00
|
|
|
if( frontA.Collide( &frontB, clearance, &actual, &pos ) )
|
2020-12-23 17:33:39 +00:00
|
|
|
{
|
2021-09-05 15:06:12 +00:00
|
|
|
auto drce = DRC_ITEM::Create( DRCE_OVERLAPPING_FOOTPRINTS );
|
2020-12-23 17:33:39 +00:00
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
if( clearance > 0 )
|
|
|
|
{
|
2022-10-06 20:52:17 +00:00
|
|
|
wxString msg = formatMsg( _( "(%s clearance %s; actual %s)" ),
|
|
|
|
constraint.GetName(),
|
|
|
|
clearance,
|
|
|
|
actual );
|
2020-12-23 17:33:39 +00:00
|
|
|
|
2022-06-15 23:42:34 +00:00
|
|
|
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
2021-09-05 15:06:12 +00:00
|
|
|
drce->SetViolatingRule( constraint.GetParentRule() );
|
|
|
|
}
|
|
|
|
|
|
|
|
drce->SetItems( fpA, fpB );
|
2022-01-02 02:06:40 +00:00
|
|
|
reportViolation( drce, pos, F_CrtYd );
|
2021-09-05 15:06:12 +00:00
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
2020-09-11 21:50:53 +00:00
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-08-26 12:21:52 +00:00
|
|
|
//
|
|
|
|
// Check courtyard-to-courtyard collisions on back of board.
|
|
|
|
//
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
if( backA.OutlineCount() > 0 && backB.OutlineCount() > 0
|
2022-08-26 12:21:52 +00:00
|
|
|
&& backA_worstCaseBBox.Intersects( backB.BBoxFromCaches() ) )
|
2020-09-11 21:50:53 +00:00
|
|
|
{
|
2021-09-05 15:06:12 +00:00
|
|
|
constraint = m_drcEngine->EvalRules( COURTYARD_CLEARANCE_CONSTRAINT, fpA, fpB, B_Cu );
|
2020-12-23 17:33:39 +00:00
|
|
|
clearance = constraint.GetValue().Min();
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
if( constraint.GetSeverity() != RPT_SEVERITY_IGNORE && clearance >= 0 )
|
2020-09-11 21:50:53 +00:00
|
|
|
{
|
2021-09-05 15:06:12 +00:00
|
|
|
if( backA.Collide( &backB, clearance, &actual, &pos ) )
|
2020-12-23 17:33:39 +00:00
|
|
|
{
|
2021-09-05 15:06:12 +00:00
|
|
|
auto drce = DRC_ITEM::Create( DRCE_OVERLAPPING_FOOTPRINTS );
|
2020-12-23 17:33:39 +00:00
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
if( clearance > 0 )
|
|
|
|
{
|
2022-10-06 20:52:17 +00:00
|
|
|
wxString msg = formatMsg( _( "(%s clearance %s; actual %s)" ),
|
|
|
|
constraint.GetName(),
|
|
|
|
clearance,
|
|
|
|
actual );
|
2021-09-05 15:06:12 +00:00
|
|
|
|
2022-06-15 23:42:34 +00:00
|
|
|
drce->SetErrorMessage( drce->GetErrorText() + wxS( " " ) + msg );
|
2021-09-05 15:06:12 +00:00
|
|
|
drce->SetViolatingRule( constraint.GetParentRule() );
|
|
|
|
}
|
2020-12-23 17:33:39 +00:00
|
|
|
|
2021-09-05 15:06:12 +00:00
|
|
|
drce->SetItems( fpA, fpB );
|
2022-01-02 02:06:40 +00:00
|
|
|
reportViolation( drce, pos, B_CrtYd );
|
2021-09-05 15:06:12 +00:00
|
|
|
}
|
2020-12-23 17:33:39 +00:00
|
|
|
}
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
2021-09-03 23:16:05 +00:00
|
|
|
|
2022-08-26 12:21:52 +00:00
|
|
|
//
|
|
|
|
// Check pad-hole-to-courtyard collisions on front and back of board.
|
|
|
|
//
|
|
|
|
// NB: via holes are not checked. There is a presumption that a physical object goes
|
|
|
|
// through a pad hole, which is not the case for via holes.
|
|
|
|
//
|
|
|
|
|
2021-09-03 23:16:05 +00:00
|
|
|
auto testPadAgainstCourtyards =
|
2022-07-22 22:05:25 +00:00
|
|
|
[&]( const PAD* pad, const FOOTPRINT* fp )
|
2021-09-03 23:16:05 +00:00
|
|
|
{
|
|
|
|
int errorCode = 0;
|
|
|
|
|
|
|
|
if( pad->GetAttribute() == PAD_ATTRIB::PTH )
|
|
|
|
errorCode = DRCE_PTH_IN_COURTYARD;
|
|
|
|
else if( pad->GetAttribute() == PAD_ATTRIB::NPTH )
|
|
|
|
errorCode = DRCE_NPTH_IN_COURTYARD;
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( m_drcEngine->IsErrorLimitExceeded( errorCode ) )
|
|
|
|
return;
|
|
|
|
|
2022-07-22 22:05:25 +00:00
|
|
|
if( pad->HasHole() )
|
2021-12-26 13:47:00 +00:00
|
|
|
{
|
2022-07-22 22:05:25 +00:00
|
|
|
std::shared_ptr<SHAPE_SEGMENT> hole = pad->GetEffectiveHoleShape();
|
2022-07-31 21:14:24 +00:00
|
|
|
const SHAPE_POLY_SET& front = fp->GetCourtyard( F_CrtYd );
|
|
|
|
const SHAPE_POLY_SET& back = fp->GetCourtyard( B_CrtYd );
|
2022-07-22 22:05:25 +00:00
|
|
|
|
|
|
|
if( front.OutlineCount() > 0 && front.Collide( hole.get(), 0 ) )
|
|
|
|
{
|
|
|
|
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( errorCode );
|
|
|
|
drce->SetItems( pad, fp );
|
|
|
|
reportViolation( drce, pad->GetPosition(), F_CrtYd );
|
|
|
|
}
|
|
|
|
else if( back.OutlineCount() > 0 && back.Collide( hole.get(), 0 ) )
|
|
|
|
{
|
|
|
|
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( errorCode );
|
|
|
|
drce->SetItems( pad, fp );
|
|
|
|
reportViolation( drce, pad->GetPosition(), B_CrtYd );
|
|
|
|
}
|
2021-09-03 23:16:05 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-08-26 12:21:52 +00:00
|
|
|
if( ( frontA.OutlineCount() > 0 && frontA_worstCaseBBox.Intersects( fpB_bbox ) )
|
|
|
|
|| ( backA.OutlineCount() > 0 && backA_worstCaseBBox.Intersects( fpB_bbox ) ) )
|
2021-09-03 23:16:05 +00:00
|
|
|
{
|
|
|
|
for( const PAD* padB : fpB->Pads() )
|
|
|
|
testPadAgainstCourtyards( padB, fpA );
|
|
|
|
}
|
|
|
|
|
2022-08-26 12:21:52 +00:00
|
|
|
if( ( frontB.OutlineCount() > 0 && frontB.BBoxFromCaches().Intersects( fpA_bbox ) )
|
|
|
|
|| ( backB.OutlineCount() > 0 && backB.BBoxFromCaches().Intersects( fpA_bbox ) ) )
|
2021-09-03 23:16:05 +00:00
|
|
|
{
|
|
|
|
for( const PAD* padA : fpA->Pads() )
|
|
|
|
testPadAgainstCourtyards( padA, fpB );
|
|
|
|
}
|
2022-03-11 20:13:47 +00:00
|
|
|
|
|
|
|
if( m_drcEngine->IsCancelled() )
|
|
|
|
return false;
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
2020-09-11 21:50:53 +00:00
|
|
|
}
|
2021-02-27 13:43:41 +00:00
|
|
|
|
2022-03-11 20:13:47 +00:00
|
|
|
return !m_drcEngine->IsCancelled();
|
2020-08-25 17:42:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-11 16:24:27 +00:00
|
|
|
bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::Run()
|
2020-08-25 17:42:52 +00:00
|
|
|
{
|
|
|
|
m_board = m_drcEngine->GetBoard();
|
2020-12-23 17:33:39 +00:00
|
|
|
DRC_CONSTRAINT constraint;
|
|
|
|
|
|
|
|
if( m_drcEngine->QueryWorstConstraint( COURTYARD_CLEARANCE_CONSTRAINT, constraint ) )
|
2022-06-17 21:50:59 +00:00
|
|
|
m_largestCourtyardClearance = constraint.GetValue().Min();
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2022-06-17 21:50:59 +00:00
|
|
|
reportAux( wxT( "Worst courtyard clearance : %d nm" ), m_largestCourtyardClearance );
|
2020-08-25 17:42:52 +00:00
|
|
|
|
2021-02-27 13:43:41 +00:00
|
|
|
if( !testFootprintCourtyardDefinitions() )
|
|
|
|
return false;
|
2020-09-11 16:24:27 +00:00
|
|
|
|
2021-02-27 13:43:41 +00:00
|
|
|
if( !testCourtyardClearances() )
|
|
|
|
return false;
|
2020-08-25 17:42:52 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace detail
|
|
|
|
{
|
2020-09-11 16:24:27 +00:00
|
|
|
static DRC_REGISTER_TEST_PROVIDER<DRC_TEST_PROVIDER_COURTYARD_CLEARANCE> dummy;
|
2021-06-03 18:05:43 +00:00
|
|
|
}
|