KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drc_test_provider_misc.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
26#include <drc/drc_engine.h>
27#include <drc/drc_item.h>
28#include <drc/drc_rule.h>
31#include <collectors.h>
32#include <pcb_shape.h>
33#include <pad.h>
34#include <pcb_track.h>
35
38
39#include <limits>
42
43/*
44 Miscellaneous tests:
45
46 - DRCE_DISABLED_LAYER_ITEM, ///< item on a disabled layer
47 - DRCE_INVALID_OUTLINE, ///< invalid board outline
48 - DRCE_UNRESOLVED_VARIABLE,
49 - DRCE_ASSERTION_FAILURE, ///< user-defined assertions
50 - DRCE_GENERIC_WARNING ///< user-defined warnings
51 - DRCE_GENERIC_ERROR ///< user-defined errors
52 - DRCE_MISSING_TUNING_PROFILES ///< tuning profile for netc lass not defined
53*/
54
55static void findClosestOutlineGap( BOARD* aBoard, PCB_SHAPE*& aItemA, PCB_SHAPE*& aItemB,
56 VECTOR2I& aMidpoint, int& aDistance )
57{
59 items.Collect( aBoard, { PCB_SHAPE_T } );
60
61 std::vector<PCB_SHAPE*> shapes;
62
63 for( int ii = 0; ii < items.GetCount(); ++ii )
64 {
65 PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( items[ii] );
66
67 if( shape->GetLayer() == Edge_Cuts )
68 shapes.push_back( shape );
69 }
70
71 int best = std::numeric_limits<int>::max();
72 VECTOR2I bestA;
73 VECTOR2I bestB;
74
75 for( size_t ii = 0; ii < shapes.size(); ++ii )
76 {
77 std::shared_ptr<SHAPE> shapeA = shapes[ii]->GetEffectiveShape();
78
79 for( size_t jj = ii + 1; jj < shapes.size(); ++jj )
80 {
81 std::shared_ptr<SHAPE> shapeB = shapes[jj]->GetEffectiveShape();
82 VECTOR2I ptA;
83 VECTOR2I ptB;
84
85 if( shapeA && shapeB && shapeA->NearestPoints( shapeB.get(), ptA, ptB ) )
86 {
87 int dist = ( ptA - ptB ).EuclideanNorm();
88
89 if( dist < best )
90 {
91 best = dist;
92 bestA = ptA;
93 bestB = ptB;
94 aItemA = shapes[ii];
95 aItemB = shapes[jj];
96 }
97 }
98 }
99 }
100
101 if( aItemA && aItemB )
102 {
103 aDistance = best;
104 aMidpoint = ( bestA + bestB ) / 2;
105 }
106 else
107 {
108 aDistance = 0;
109 aMidpoint = VECTOR2I();
110 }
111}
112
114{
115public:
117 m_board( nullptr )
118 {
119 m_isRuleDriven = false;
120 }
121
122 virtual ~DRC_TEST_PROVIDER_MISC() = default;
123
124 virtual bool Run() override;
125
126 virtual const wxString GetName() const override { return wxT( "miscellaneous" ); };
127
128private:
129 void testOutline();
130 void testDisabledLayers();
131 void testTextVars();
132 void testAssertions();
134
136};
137
138
140{
141 SHAPE_POLY_SET dummyOutline;
142 bool errorHandled = false;
143
144 OUTLINE_ERROR_HANDLER errorHandler =
145 [&]( const wxString& msg, BOARD_ITEM* itemA, BOARD_ITEM* itemB, const VECTOR2I& pt )
146 {
147 errorHandled = true;
148
149 if( m_drcEngine->IsErrorLimitExceeded( DRCE_INVALID_OUTLINE ) )
150 return;
151
152 if( !itemA )
153 std::swap( itemA, itemB );
154
155 VECTOR2I markerPos = pt;
156 int gap = 0;
157 PCB_SHAPE* shapeA = nullptr;
158 PCB_SHAPE* shapeB = nullptr;
159 bool usedGap = false;
160
161 if( itemA && itemB && itemA->Type() == PCB_SHAPE_T && itemB->Type() == PCB_SHAPE_T )
162 {
163 shapeA = static_cast<PCB_SHAPE*>( itemA );
164 shapeB = static_cast<PCB_SHAPE*>( itemB );
165 }
166 else if( itemA && !itemB && itemA->Type() == PCB_SHAPE_T )
167 {
168 // A single item was flagged (e.g. a degenerate shape). Keep the marker
169 // at that item so the user can locate the bad geometry.
170 shapeA = static_cast<PCB_SHAPE*>( itemA );
171 }
172 else
173 {
174 // No usable item pair identified. Look for the most likely culprits.
175 findClosestOutlineGap( m_board, shapeA, shapeB, markerPos, gap );
176 itemA = shapeA;
177 itemB = shapeB;
178 usedGap = shapeA && shapeB;
179 }
180
181 if( shapeA && shapeB )
182 {
183 std::shared_ptr<SHAPE> effectiveShapeA = shapeA->GetEffectiveShape();
184 std::shared_ptr<SHAPE> effectiveShapeB = shapeB->GetEffectiveShape();
185
186 if( effectiveShapeA && effectiveShapeB )
187 {
188 BOX2I bboxA = effectiveShapeA->BBox();
189 BOX2I bboxB = effectiveShapeB->BBox();
190 BOX2I overlap = bboxA.Intersect( bboxB );
191
192 if( overlap.GetWidth() > 0 && overlap.GetHeight() > 0 )
193 {
194 markerPos = overlap.Centre();
195 usedGap = false;
196 }
197 else
198 {
199 VECTOR2I ptA, ptB;
200
201 if( effectiveShapeA->NearestPoints( effectiveShapeB.get(), ptA, ptB ) )
202 {
203 gap = ( ptA - ptB ).EuclideanNorm();
204 markerPos = ( ptA + ptB ) / 2;
205 usedGap = true;
206 }
207 }
208 }
209 }
210
211 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_INVALID_OUTLINE );
212
213 if( itemA && itemB && usedGap )
214 {
215 drcItem->SetErrorDetail( wxString::Format( _( "%s (gap %s)" ), msg, MessageTextFromValue( gap ) ) );
216 }
217 else
218 {
219 drcItem->SetErrorDetail( msg );
220 }
221
222 drcItem->SetItems( itemA, itemB );
223
224 reportViolation( drcItem, markerPos, Edge_Cuts );
225 };
226
227 // Test for very small graphic items (a few nm size) that can create issues
228 // when trying to build the board outlines, and they are not easy to locate on screen.
229 const int minSizeForValideGraphics = pcbIUScale.mmToIU( 0.001 );
230
231 if( !TestBoardOutlinesGraphicItems(m_board, minSizeForValideGraphics, &errorHandler ) )
232 {
233 if( errorHandled )
234 {
235 // if there are invalid items on Edge.Cuts, they are already reported
236 }
237 else
238 {
239 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_INVALID_OUTLINE );
240 drcItem->SetErrorDetail( _( "(Suspicious items found on Edge.Cuts layer)" ) );
241 drcItem->SetItems( m_board );
242
243 reportViolation( drcItem, m_board->GetBoundingBox().Centre(), Edge_Cuts );
244 }
245 }
246
247
248 // Use the standard chaining epsilon here so that we report errors that might affect
249 // other tools (such as 3D viewer).
250 int chainingEpsilon = m_board->GetOutlinesChainingEpsilon();
251
252 // Arc to segment approximation error (not critical here: we do not use the outline shape):
253 int maxError = pcbIUScale.mmToIU( 0.05 );
254
255 if( !BuildBoardPolygonOutlines( m_board, dummyOutline, maxError, chainingEpsilon, true, &errorHandler ) )
256 {
257 if( errorHandled )
258 {
259 // if there is an invalid outline, then there must be an outline
260 }
261 else
262 {
263 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_INVALID_OUTLINE );
264 drcItem->SetErrorDetail( _( "(no edges found on Edge.Cuts layer)" ) );
265 drcItem->SetItems( m_board );
266
267 reportViolation( drcItem, m_board->GetBoundingBox().Centre(), Edge_Cuts );
268 }
269 }
270}
271
272
274{
275 const int progressDelta = 2000;
276 int ii = 0;
277 int items = 0;
278
279 auto countItems =
280 [&]( BOARD_ITEM* item ) -> bool
281 {
282 ++items;
283 return true;
284 };
285
286 LSET disabledLayers = LSET( m_board->GetEnabledLayers() ).flip();
287
288 // Perform the test only for copper layers
289 disabledLayers &= LSET::AllCuMask();
290
291 auto checkDisabledLayers =
292 [&]( BOARD_ITEM* item ) -> bool
293 {
294 if( m_drcEngine->IsErrorLimitExceeded( DRCE_DISABLED_LAYER_ITEM ) )
295 return false;
296
297 if( !reportProgress( ii++, items, progressDelta ) )
298 return false;
299
300 PCB_LAYER_ID badLayer = UNDEFINED_LAYER;
301
302 if( item->Type() == PCB_PAD_T )
303 {
304 PAD* pad = static_cast<PAD*>( item );
305
306 if( pad->GetAttribute() == PAD_ATTRIB::SMD
307 || pad->GetAttribute() == PAD_ATTRIB::CONN )
308 {
309 if( disabledLayers.test( pad->GetPrincipalLayer() ) )
310 badLayer = item->GetLayer();
311 }
312 else
313 {
314 // Through hole pad pierces all physical layers.
315 }
316 }
317 else if( item->Type() == PCB_VIA_T )
318 {
319 PCB_VIA* via = static_cast<PCB_VIA*>( item );
321 PCB_LAYER_ID bottom;
322
323 via->LayerPair( &top, &bottom );
324
325 if( disabledLayers.test( top ) )
326 badLayer = top;
327 else if( disabledLayers.test( bottom ) )
328 badLayer = bottom;
329 }
330 else if( item->Type() == PCB_ZONE_T )
331 {
332 // Footprint zones just get a top/bottom/inner setting, so they're on
333 // whatever inner layers there are.
334 }
335 else
336 {
337 LSET badLayers = disabledLayers & item->GetLayerSet();
338
339 if( badLayers.any() )
340 badLayer = badLayers.Seq().front();
341 }
342
343 if( badLayer != UNDEFINED_LAYER )
344 {
345 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_DISABLED_LAYER_ITEM );
346 drcItem->SetErrorDetail( wxString::Format( _( "(layer %s)" ), LayerName( badLayer ) ) );
347 drcItem->SetItems( item );
348
349 reportViolation( drcItem, item->GetPosition(), UNDEFINED_LAYER );
350 }
351
352 return true;
353 };
354
357}
358
359
361{
362 const int progressDelta = 2000;
363 int ii = 0;
364 int items = 0;
365
366 auto countItems =
367 [&]( BOARD_ITEM* item ) -> bool
368 {
369 ++items;
370 return true;
371 };
372
373 auto checkAssertions =
374 [&]( BOARD_ITEM* item ) -> bool
375 {
376 if( !reportProgress( ii++, items, progressDelta ) )
377 return false;
378
379 if( !m_drcEngine->IsErrorLimitExceeded( DRCE_ASSERTION_FAILURE ) )
380 {
381 m_drcEngine->ProcessAssertions( item,
382 [&]( const DRC_CONSTRAINT* c )
383 {
384 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_ASSERTION_FAILURE );
385 drcItem->SetErrorDetail( wxString::Format( wxS( "(%s)" ), c->GetName() ) );
386 drcItem->SetItems( item );
387 drcItem->SetViolatingRule( c->GetParentRule() );
388
389 reportViolation( drcItem, item->GetPosition(), item->GetLayer() );
390 } );
391 }
392
393 return true;
394 };
395
396 forEachGeometryItem( {}, LSET::AllLayersMask(), countItems );
397 forEachGeometryItem( {}, LSET::AllLayersMask(), checkAssertions );
398}
399
400
402{
403 const int progressDelta = 2000;
404 int ii = 0;
405 int items = 0;
406
407 static const std::vector<KICAD_T> itemTypes = {
411 };
412
413 auto testAssertion =
414 [&]( BOARD_ITEM* item, const wxString& text, const VECTOR2I& pos, int layer )
415 {
416 static wxRegEx warningExpr( wxS( "^\\$\\{DRC_WARNING\\s*([^}]*)\\}(.*)$" ) );
417 static wxRegEx errorExpr( wxS( "^\\$\\{DRC_ERROR\\s*([^}]*)\\}(.*)$" ) );
418
419 if( warningExpr.Matches( text ) )
420 {
421 if( !m_drcEngine->IsErrorLimitExceeded( DRCE_GENERIC_WARNING ) )
422 {
423 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_GENERIC_WARNING );
424 wxString drcText = warningExpr.GetMatch( text, 1 );
425
426 if( item )
427 drcItem->SetItems( item );
428 else
429 drcText += _( " (in drawing sheet)" );
430
431 drcItem->SetErrorMessage( drcText );
432
433 reportViolation( drcItem, pos, layer );
434 }
435
436 return true;
437 }
438
439 if( errorExpr.Matches( text ) )
440 {
441 if( !m_drcEngine->IsErrorLimitExceeded( DRCE_GENERIC_ERROR ) )
442 {
443 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_GENERIC_ERROR );
444 wxString drcText = errorExpr.GetMatch( text, 1 );
445
446 if( item )
447 drcItem->SetItems( item );
448 else
449 drcText += _( " (in drawing sheet)" );
450
451 drcItem->SetErrorMessage( drcText );
452
453 reportViolation( drcItem, pos, layer );
454 }
455
456 return true;
457 }
458
459 return false;
460 };
461
463 [&]( BOARD_ITEM* item ) -> bool
464 {
465 ++items;
466 return true;
467 } );
468
470 [&]( BOARD_ITEM* item ) -> bool
471 {
472 if( m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) )
473 return false;
474
475 if( !reportProgress( ii++, items, progressDelta ) )
476 return false;
477
478 if( EDA_TEXT* textItem = dynamic_cast<EDA_TEXT*>( item ) )
479 {
480 wxString result = ExpandEnvVarSubstitutions( textItem->GetShownText( true ),
481 nullptr /*project already done*/ );
482
483 if( result.Matches( wxT( "*${*}*" ) ) )
484 {
486 drcItem->SetItems( item );
487
488 reportViolation( drcItem, item->GetPosition(), item->GetLayer() );
489 }
490
491 testAssertion( item, textItem->GetText(), item->GetPosition(), item->GetLayer() );
492 }
493
494 return true;
495 } );
496
497 DS_PROXY_VIEW_ITEM* drawingSheet = m_drcEngine->GetDrawingSheet();
499
500 if( !drawingSheet || m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) )
501 return;
502
503 drawItems.SetPageNumber( wxT( "1" ) );
504 drawItems.SetSheetCount( 1 );
505 drawItems.SetFileName( wxT( "dummyFilename" ) );
506 drawItems.SetSheetName( wxT( "dummySheet" ) );
507 drawItems.SetSheetLayer( wxT( "dummyLayer" ) );
508 drawItems.SetProject( m_board->GetProject() );
509 drawItems.BuildDrawItemsList( drawingSheet->GetPageInfo(), drawingSheet->GetTitleBlock() );
510
511 for( DS_DRAW_ITEM_BASE* item = drawItems.GetFirst(); item; item = drawItems.GetNext() )
512 {
513 if( m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) )
514 break;
515
516 if( m_drcEngine->IsCancelled() )
517 return;
518
519 if( DS_DRAW_ITEM_TEXT* text = dynamic_cast<DS_DRAW_ITEM_TEXT*>( item ) )
520 {
521 if( testAssertion( nullptr, text->GetText(), text->GetPosition(), LAYER_DRAWINGSHEET ) )
522 {
523 // Don't run unresolved test
524 }
525 else if( text->GetShownText( true ).Matches( wxT( "*${*}*" ) ) )
526 {
527 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE );
528 drcItem->SetItems( drawingSheet );
529
530 reportViolation( drcItem, text->GetPosition(), LAYER_DRAWINGSHEET );
531 }
532 }
533 }
534}
535
536
538{
539 if( !m_board->GetProject() )
540 return;
541
542 std::shared_ptr<NET_SETTINGS> netSettings = m_board->GetProject()->GetProjectFile().NetSettings();
543 const std::shared_ptr<TUNING_PROFILES> tuningProfiles =
544 m_board->GetProject()->GetProjectFile().TuningProfileParameters();
545
546 std::set<wxString> profileNames;
547 std::ranges::for_each( tuningProfiles->GetTuningProfiles(),
548 [&profileNames]( const TUNING_PROFILE& tuningProfile )
549 {
550 if( const wxString name = tuningProfile.m_ProfileName; name != wxEmptyString )
551 profileNames.insert( name );
552 } );
553
554 for( const auto& [name, netclass] : netSettings->GetNetclasses() )
555 {
556 if( m_drcEngine->IsErrorLimitExceeded( DRCE_MISSING_TUNING_PROFILE ) )
557 return;
558
559 const wxString profileName = netclass->GetTuningProfile();
560
561 if( netclass->HasTuningProfile() && !profileNames.contains( profileName ) )
562 {
563 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_MISSING_TUNING_PROFILE );
564 drcItem->SetErrorDetail( wxString::Format( "(Net Class: %s, Tuning Profile: %s)",
565 name,
566 profileName ) );
567
569 }
570 }
571}
572
573
575{
576 m_board = m_drcEngine->GetBoard();
577
578 if( !m_drcEngine->IsErrorLimitExceeded( DRCE_INVALID_OUTLINE ) )
579 {
580 if( !reportPhase( _( "Checking board outline..." ) ) )
581 return false; // DRC cancelled
582
583 testOutline();
584 }
585
586 if( !m_drcEngine->IsErrorLimitExceeded( DRCE_DISABLED_LAYER_ITEM ) )
587 {
588 if( !reportPhase( _( "Checking disabled layers..." ) ) )
589 return false; // DRC cancelled
590
592 }
593
594 if( !m_drcEngine->IsErrorLimitExceeded( DRCE_UNRESOLVED_VARIABLE ) )
595 {
596 if( !reportPhase( _( "Checking text variables..." ) ) )
597 return false; // DRC cancelled
598
599 testTextVars();
600 }
601
602 if( !m_drcEngine->IsErrorLimitExceeded( DRCE_ASSERTION_FAILURE )
603 || !m_drcEngine->IsErrorLimitExceeded( DRCE_GENERIC_WARNING )
604 || !m_drcEngine->IsErrorLimitExceeded( DRCE_GENERIC_ERROR ) )
605 {
606 if( !reportPhase( _( "Checking assertions..." ) ) )
607 return false; // DRC cancelled
608
610 }
611
612 if( !m_drcEngine->IsErrorLimitExceeded( DRCE_MISSING_TUNING_PROFILE ) )
613 {
614 if( !reportPhase( _( "Checking for missing tuning profiles..." ) ) )
615 return false; // DRC cancelled
616
618 }
619
620 return !m_drcEngine->IsCancelled();
621}
622
623
624namespace detail
625{
627}
const char * name
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:125
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
BASE_SET & flip(size_t pos)
Definition base_set.h:160
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:84
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition board_item.h:268
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:323
constexpr BOX2< Vec > Intersect(const BOX2< Vec > &aRect)
Definition box2.h:347
constexpr size_type GetWidth() const
Definition box2.h:214
constexpr Vec Centre() const
Definition box2.h:97
constexpr size_type GetHeight() const
Definition box2.h:215
int GetCount() const
Return the number of objects in the list.
Definition collector.h:83
wxString GetName() const
Definition drc_rule.h:208
DRC_RULE * GetParentRule() const
Definition drc_rule.h:204
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition drc_item.cpp:417
virtual const wxString GetName() const override
virtual ~DRC_TEST_PROVIDER_MISC()=default
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
virtual bool reportPhase(const wxString &aStageName)
int forEachGeometryItem(const std::vector< KICAD_T > &aTypes, const LSET &aLayers, const std::function< bool(BOARD_ITEM *)> &aFunc)
void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer, const std::function< void(PCB_MARKER *)> &aPathGenerator=[](PCB_MARKER *){})
static std::vector< KICAD_T > s_allBasicItems
virtual bool reportProgress(size_t aCount, size_t aSize, size_t aDelta=1)
Base class to handle basic graphic items.
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
DS_DRAW_ITEM_BASE * GetFirst()
void BuildDrawItemsList(const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock)
Drawing or plot the drawing sheet.
void SetFileName(const wxString &aFileName)
Set the filename to draw/plot.
void SetSheetName(const wxString &aSheetName)
Set the sheet name to draw/plot.
void SetSheetLayer(const wxString &aSheetLayer)
Set the sheet layer to draw/plot.
void SetSheetCount(int aSheetCount)
Set the value of the count of sheets, for basic inscriptions.
void SetPageNumber(const wxString &aPageNumber)
Set the value of the sheet number.
DS_DRAW_ITEM_BASE * GetNext()
void SetProject(const PROJECT *aProject)
A graphic text.
virtual VECTOR2I GetPosition() const
Definition eda_item.h:286
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:93
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Definition lset.cpp:608
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition lset.cpp:313
static const LSET & AllLayersMask()
Definition lset.cpp:641
Definition pad.h:65
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Make a set of SHAPE objects representing the PCB_SHAPE.
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition pcb_shape.h:71
Collect all BOARD_ITEM objects of a given set of KICAD_T type(s).
Definition collectors.h:521
void Collect(BOARD_ITEM *aBoard, const std::vector< KICAD_T > &aTypes)
Collect BOARD_ITEM objects using this class's Inspector method, which does the collection.
Represent a set of closed polygons.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition common.cpp:708
#define FOR_ERC_DRC
Expand '${var-name}' templates in text.
Definition common.h:99
bool BuildBoardPolygonOutlines(BOARD *aBoard, SHAPE_POLY_SET &aOutlines, int aErrorMax, int aChainingEpsilon, bool aInferOutlineIfNecessary, OUTLINE_ERROR_HANDLER *aErrorHandler, bool aAllowUseArcsInPolygons)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
bool TestBoardOutlinesGraphicItems(BOARD *aBoard, int aMinDist, OUTLINE_ERROR_HANDLER *aErrorHandler)
Test a board graphic items on edge cut layer for validity.
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const VECTOR2I &pt)> OUTLINE_ERROR_HANDLER
@ DRCE_DISABLED_LAYER_ITEM
Definition drc_item.h:72
@ DRCE_INVALID_OUTLINE
Definition drc_item.h:73
@ DRCE_GENERIC_ERROR
Definition drc_item.h:91
@ DRCE_MISSING_TUNING_PROFILE
Definition drc_item.h:115
@ DRCE_UNRESOLVED_VARIABLE
Definition drc_item.h:88
@ DRCE_ASSERTION_FAILURE
Definition drc_item.h:89
@ DRCE_GENERIC_WARNING
Definition drc_item.h:90
static void findClosestOutlineGap(BOARD *aBoard, PCB_SHAPE *&aItemA, PCB_SHAPE *&aItemB, VECTOR2I &aMidpoint, int &aDistance)
#define _(s)
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
Definition layer_id.cpp:31
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
Definition layer_ids.h:278
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:60
@ Edge_Cuts
Definition layer_ids.h:112
@ UNDEFINED_LAYER
Definition layer_ids.h:61
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
@ SMD
Smd pad, appears on the solder paste layer (default)
Definition padstack.h:99
@ CONN
Like smd, does not appear on the solder paste layer (default) Note: also has a special attribute in G...
Definition padstack.h:100
Represents a single line in the tuning profile configuration grid.
KIBIS top(path, &reporter)
wxString result
Test unit parsing edge cases and error handling.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition typeinfo.h:85
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition typeinfo.h:94
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition typeinfo.h:90
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition typeinfo.h:105
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition typeinfo.h:89
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition typeinfo.h:87
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
Definition typeinfo.h:92
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition typeinfo.h:84
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
Definition typeinfo.h:97
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:687