54 virtual bool Run()
override;
56 virtual const wxString
GetName()
const override {
return wxT(
"courtyard_clearance" ); }
74 if( !
reportPhase(
_(
"Checking footprint courtyard definitions..." ) ) )
79 if( !
reportPhase(
_(
"Gathering footprint courtyards..." ) ) )
84 REPORT_AUX( wxT(
"All courtyard violations ignored. Tests not run." ) );
88 const int progressDelta = 500;
105 drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS(
" " ) + msg );
106 drcItem->SetItems( footprint );
111 footprint->BuildCourtyardCaches( &errorHandler );
113 else if( footprint->GetCourtyard(
F_CrtYd ).OutlineCount() == 0
114 && footprint->GetCourtyard(
B_CrtYd ).OutlineCount() == 0 )
119 if( footprint->AllowMissingCourtyard() )
123 drcItem->SetItems( footprint );
128 footprint->GetCourtyard(
F_CrtYd ).BuildBBoxCaches();
129 footprint->GetCourtyard(
B_CrtYd ).BuildBBoxCaches();
139 if( !
reportPhase(
_(
"Checking footprints for overlapping courtyards..." ) ) )
142 const int progressDelta = 100;
147 std::vector<FOOTPRINT*> footprints;
149 footprints.insert( footprints.begin(),
m_board->Footprints().begin(),
152 std::sort( footprints.begin(), footprints.end(),
155 return a->m_Uuid < b->m_Uuid;
158 for(
auto itA = footprints.begin(); itA != footprints.end(); itA++ )
191 for(
auto itB = itA + 1; itB != footprints.end(); itB++ )
234 wxString msg =
formatMsg(
_(
"(%s clearance %s; actual %s)" ),
239 drce->SetErrorMessage( drce->GetErrorText() + wxS(
" " ) + msg );
243 drce->SetItems( fpA, fpB );
266 wxString msg =
formatMsg(
_(
"(%s clearance %s; actual %s)" ),
271 drce->SetErrorMessage( drce->GetErrorText() + wxS(
" " ) + msg );
275 drce->SetItems( fpA, fpB );
287 bool checkFront =
false;
288 bool checkBack =
false;
314 auto testPadAgainstCourtyards =
328 if(
m_drcEngine->IsErrorLimitExceeded( errorCode ) )
333 std::shared_ptr<SHAPE_SEGMENT> hole =
pad->GetEffectiveHoleShape();
340 drce->SetItems(
pad, fp );
346 drce->SetItems(
pad, fp );
355 for(
const PAD* padB : fpB->
Pads() )
356 testPadAgainstCourtyards( padB, fpA );
362 for(
const PAD* padA : fpA->
Pads() )
363 testPadAgainstCourtyards( padA, fpB );
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr bool Intersects(const BOX2< Vec > &aRect) const
SEVERITY GetSeverity() const
const MINOPTMAX< int > & GetValue() const
DRC_RULE * GetParentRule() const
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
DRC_TEST_PROVIDER_CLEARANCE_BASE()
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
DRC_TEST_PROVIDER_COURTYARD_CLEARANCE()
bool testFootprintCourtyardDefinitions()
int m_largestCourtyardClearance
virtual ~DRC_TEST_PROVIDER_COURTYARD_CLEARANCE()=default
virtual const wxString GetName() const override
bool testCourtyardClearances()
virtual bool reportPhase(const wxString &aStageName)
virtual void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer, const std::vector< PCB_SHAPE > &aShapes={})
wxString formatMsg(const wxString &aFormatString, const wxString &aSource, double aConstraint, double aActual, EDA_DATA_TYPE aDataType=EDA_DATA_TYPE::DISTANCE)
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
Represent a set of closed polygons.
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
int OutlineCount() const
Return the number of outlines in the set.
const BOX2I BBoxFromCaches() const
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const VECTOR2I &pt)> OUTLINE_ERROR_HANDLER
@ DRCE_OVERLAPPING_FOOTPRINTS
@ DRCE_MALFORMED_COURTYARD
@ COURTYARD_CLEARANCE_CONSTRAINT
#define MALFORMED_COURTYARDS
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
@ PTH
Plated through hole pad.
@ HEATSINK
a pad used as heat sink, usually in SMD footprints
VECTOR2< int32_t > VECTOR2I