KiCad PCB EDA Suite
drc_test_provider_library_parity.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 (C) 2021-2022 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
24#include <kiway.h>
25#include <macros.h>
27#include <fp_lib_table.h>
28#include <board.h>
29#include <fp_shape.h>
30#include <fp_text.h>
31#include <zone.h>
32#include <footprint.h>
33#include <pad.h>
34#include <drc/drc_engine.h>
35#include <drc/drc_item.h>
37
38/*
39 Library parity test.
40
41 Errors generated:
42 - DRCE_LIB_FOOTPRINT_ISSUES
43 - DRCE_LIB_FOOTPRINT_MISMATCH
44*/
45
47{
48public:
50 {
51 m_isRuleDriven = false;
52 }
53
55 {
56 }
57
58 virtual bool Run() override;
59
60 virtual const wxString GetName() const override
61 {
62 return wxT( "library_parity" );
63 };
64
65 virtual const wxString GetDescription() const override
66 {
67 return wxT( "Performs board footprint vs library integity checks" );
68 }
69};
70
71
72#define TEST( a, b ) { if( a != b ) return true; }
73#define TEST_PADS( a, b ) { if( padsNeedUpdate( a, b ) ) return true; }
74#define TEST_SHAPES( a, b ) { if( shapesNeedUpdate( a, b ) ) return true; }
75#define TEST_PRIMITIVES( a, b ) { if( primitivesNeedUpdate( a, b ) ) return true; }
76#define TEST_ZONES( a, b ) { if( zonesNeedUpdate( a, b ) ) return true; }
77#define TEST_MODELS( a, b ) { if( modelsNeedUpdate( a, b ) ) return true; }
78
79#define EPSILON 0.000001
80#define TEST_D( a, b ) { if( abs( a - b ) > EPSILON ) return true; }
81
82bool primitivesNeedUpdate( const std::shared_ptr<PCB_SHAPE>& a,
83 const std::shared_ptr<PCB_SHAPE>& b )
84{
85 TEST( a->GetShape(), b->GetShape() );
86
87 switch( a->GetShape() )
88 {
90 case SHAPE_T::RECT:
91 case SHAPE_T::CIRCLE:
92 TEST( a->GetStart(), b->GetStart() );
93 TEST( a->GetEnd(), b->GetEnd() );
94 break;
95
96 case SHAPE_T::ARC:
97 TEST( a->GetStart(), b->GetStart() );
98 TEST( a->GetEnd(), b->GetEnd() );
99 TEST( a->GetCenter(), b->GetCenter() );
100 TEST_D( a->GetArcAngle().AsDegrees(), b->GetArcAngle().AsDegrees() );
101 break;
102
103 case SHAPE_T::BEZIER:
104 TEST( a->GetStart(), b->GetStart() );
105 TEST( a->GetEnd(), b->GetEnd() );
106 TEST( a->GetBezierC1(), b->GetBezierC1() );
107 TEST( a->GetBezierC2(), b->GetBezierC2() );
108 break;
109
110 case SHAPE_T::POLY:
111 TEST( a->GetPolyShape().TotalVertices(), b->GetPolyShape().TotalVertices() );
112
113 for( int ii = 0; ii < a->GetPolyShape().TotalVertices(); ++ii )
114 TEST( a->GetPolyShape().CVertex( ii ), b->GetPolyShape().CVertex( ii ) );
115
116 break;
117
118 default:
119 UNIMPLEMENTED_FOR( a->SHAPE_T_asString() );
120 }
121
122 TEST( a->GetStroke(), b->GetStroke() );
123 TEST( a->IsFilled(), b->IsFilled() );
124
125 return false;
126}
127
128
129bool padsNeedUpdate( const PAD* a, const PAD* b )
130{
132 TEST( a->GetPos0(), b->GetPos0() );
133
134 TEST( a->GetNumber(), b->GetNumber() );
135
136 // These are assigned from the schematic and not from the library
137 // TEST( a->GetPinFunction(), b->GetPinFunction() );
138 // TEST( a->GetPinType(), b->GetPinType() );
139
141
142 // NB: KeepTopBottom is undefined if RemoveUnconnected is NOT set.
143 if( a->GetRemoveUnconnected() )
145
146 TEST( a->GetShape(), b->GetShape() );
147 TEST( a->GetLayerSet(), b->GetLayerSet() );
148 TEST( a->GetAttribute(), b->GetAttribute() );
149 TEST( a->GetProperty(), b->GetProperty() );
150
151 // The pad orientation, for historical reasons is the pad rotation + parent rotation.
152 TEST_D(( a->GetOrientation() - a->GetParent()->GetOrientation() ).Normalize().AsDegrees(),
153 ( b->GetOrientation() - b->GetParent()->GetOrientation() ).Normalize().AsDegrees() );
154
155 TEST( a->GetSize(), b->GetSize() );
156 TEST( a->GetDelta(), b->GetDelta() );
161 TEST( a->GetOffset(), b->GetOffset() );
162
163 TEST( a->GetDrillShape(), b->GetDrillShape() );
164 TEST( a->GetDrillSize(), b->GetDrillSize() );
165
166 // Clearance and zone connection overrides are as likely to be set at the board level as in
167 // the library.
168 //
169 // If we ignore them and someone *does* change one of them in the library, then stale
170 // footprints won't be caught.
171 //
172 // On the other hand, if we report them then boards that override at the board level are
173 // going to be VERY noisy.
174#if 0
179
181 TEST( a->GetThermalGap(), b->GetThermalGap() );
185#endif
186
187 TEST( a->GetPrimitives().size(), b->GetPrimitives().size() );
188
189 for( size_t ii = 0; ii < a->GetPrimitives().size(); ++ii )
190 TEST_PRIMITIVES( a->GetPrimitives()[ii], b->GetPrimitives()[ii] );
191
192 return false;
193}
194
195
196bool shapesNeedUpdate( const FP_SHAPE* a, const FP_SHAPE* b )
197{
198 TEST( a->GetShape(), b->GetShape() );
199
200 switch( a->GetShape() )
201 {
202 case SHAPE_T::SEGMENT:
203 case SHAPE_T::RECT:
204 case SHAPE_T::CIRCLE:
205 TEST( a->GetStart0(), b->GetStart0() );
206 TEST( a->GetEnd0(), b->GetEnd0() );
207 break;
208
209 case SHAPE_T::ARC:
210 TEST( a->GetStart0(), b->GetStart0() );
211 TEST( a->GetEnd0(), b->GetEnd0() );
212
213 // Arc center is calculated and so may have round-off errors when parents are
214 // differentially rotated.
215 if( ( a->GetCenter0() - b->GetCenter0() ).EuclideanNorm() > pcbIUScale.mmToIU( 0.0001 ) )
216 return true;
217
218 break;
219
220 case SHAPE_T::BEZIER:
221 TEST( a->GetStart0(), b->GetStart0() );
222 TEST( a->GetEnd0(), b->GetEnd0() );
223 TEST( a->GetBezierC1_0(), b->GetBezierC1_0() );
224 TEST( a->GetBezierC2_0(), b->GetBezierC2_0() );
225 break;
226
227 case SHAPE_T::POLY:
229
230 for( int ii = 0; ii < a->GetPolyShape().TotalVertices(); ++ii )
231 TEST( a->GetPolyShape().CVertex( ii ), b->GetPolyShape().CVertex( ii ) );
232
233 break;
234
235 default:
237 }
238
239 TEST( a->GetStroke(), b->GetStroke() );
240 TEST( a->IsFilled(), b->IsFilled() );
241
242 TEST( a->GetLayer(), b->GetLayer() );
243
244 return false;
245}
246
247
248bool textsNeedUpdate( const FP_TEXT* a, const FP_TEXT* b )
249{
250 TEST( a->GetLayer(), b->GetLayer() );
251 TEST( a->IsKeepUpright(), b->IsKeepUpright() );
252
253 TEST( a->GetText(), b->GetText() );
254
256 TEST( a->GetTextAngle(), b->GetTextAngle() );
257 TEST( a->IsItalic(), b->IsItalic() );
258 TEST( a->IsBold(), b->IsBold() );
259 TEST( a->IsVisible(), b->IsVisible() );
260 TEST( a->IsMirrored(), b->IsMirrored() );
261
263 TEST( a->GetVertJustify(), b->GetVertJustify() );
264
265 TEST( a->GetTextSize(), b->GetTextSize() );
266 TEST( a->GetPos0(), b->GetPos0() );
267
268 return false;
269}
270
271
272bool zonesNeedUpdate( const FP_ZONE* a, const FP_ZONE* b )
273{
276 TEST( a->GetZoneName(), b->GetZoneName() );
278
279 TEST( a->GetIsRuleArea(), b->GetIsRuleArea() );
285
286 TEST( a->GetLayerSet(), b->GetLayerSet() );
287
292
294
297
298 TEST( a->GetFillMode(), b->GetFillMode() );
300 TEST( a->GetHatchGap(), b->GetHatchGap() );
305
306 // This is just a display property
307 // TEST( a->GetHatchBorderAlgorithm(), b->GetHatchBorderAlgorithm() );
308
309 TEST( a->Outline()->TotalVertices(), b->Outline()->TotalVertices() );
310
311 // The footprint's zone will be in board position, so we must translate & rotate the library
312 // footprint's zone to match.
313 FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( a->GetParentFootprint() );
314 const SHAPE_POLY_SET& aPoly = *a->Outline();
316
317 bPoly.Rotate( parentFootprint->GetOrientation() );
318 bPoly.Move( parentFootprint->GetPosition() );
319
320 for( int ii = 0; ii < a->Outline()->TotalVertices(); ++ii )
321 TEST( aPoly.CVertex( ii ), bPoly.CVertex( ii ) );
322
323 return false;
324}
325
326
327bool modelsNeedUpdate( const FP_3DMODEL& a, const FP_3DMODEL& b )
328{
329#define TEST_V3D( a, b ) { TEST_D( a.x, b.x ); TEST_D( a.y, b.y ); TEST_D( a.z, b.z ); }
330
331 TEST_V3D( a.m_Scale, b.m_Scale );
333 TEST_V3D( a.m_Offset, b.m_Offset );
334 TEST( a.m_Opacity, b.m_Opacity );
335 TEST( a.m_Filename, b.m_Filename );
336 TEST( a.m_Show, b.m_Show );
337
338 return false;
339}
340
341
342bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint )
343{
344#define TEST_ATTR( a, b, attr ) TEST( ( a & attr ), ( b & attr ) );
345 wxASSERT( aLibFootprint );
346
347 if( IsFlipped() )
348 {
349 std::unique_ptr<FOOTPRINT> temp( static_cast<FOOTPRINT*>( Clone() ) );
350 temp->Flip( {0,0}, false );
351 return temp->FootprintNeedsUpdate( aLibFootprint );
352 }
353
354 TEST( GetDescription(), aLibFootprint->GetDescription() );
355 TEST( GetKeywords(), aLibFootprint->GetKeywords() );
356
358 TEST_ATTR( GetAttributes(), aLibFootprint->GetAttributes(), FP_SMD );
361
362 // Clearance and zone connection overrides are as likely to be set at the board level as in
363 // the library.
364 //
365 // If we ignore them and someone *does* change one of them in the library, then stale
366 // footprints won't be caught.
367 //
368 // On the other hand, if we report them then boards that override at the board level are
369 // going to be VERY noisy.
370#if 0
371 TEST( GetLocalClearance(), aLibFootprint->GetLocalClearance() );
375
376 TEST( GetZoneConnection(), aLibFootprint->GetZoneConnection() );
377#endif
378
379 TEST( GetNetTiePadGroups().size(), aLibFootprint->GetNetTiePadGroups().size() );
380
381 for( size_t ii = 0; ii < GetNetTiePadGroups().size(); ++ii )
382 TEST( GetNetTiePadGroups()[ii], aLibFootprint->GetNetTiePadGroups()[ii] );
383
384 // Text items are really problematic. We don't want to test the reference, but after that
385 // it gets messy.
386 //
387 // What about the value? Depends on whether or not it's a singleton part.
388 //
389 // And what about other texts? They might be added only to instances on the board, or even
390 // changed for instances on the board. Or they might want to be tested for equality.
391 //
392 // Currently we punt and ignore all the text items.
393
394 // Drawings and pads are also somewhat problematic as there's no guarantee that they'll be
395 // in the same order in the two footprints. Rather than building some sophisticated hashing
396 // algorithm we use the footprint sorting functions to attempt to sort them in the same
397 // order.
398
399 std::set<BOARD_ITEM*, FOOTPRINT::cmp_drawings> aShapes;
400 std::copy_if( GraphicalItems().begin(), GraphicalItems().end(),
401 std::inserter( aShapes, aShapes.begin() ),
402 []( BOARD_ITEM* item )
403 {
404 return item->Type() == PCB_FP_SHAPE_T;
405 } );
406 std::set<BOARD_ITEM*, FOOTPRINT::cmp_drawings> bShapes;
407 std::copy_if( aLibFootprint->GraphicalItems().begin(), aLibFootprint->GraphicalItems().end(),
408 std::inserter( bShapes, bShapes.begin() ),
409 []( BOARD_ITEM* item )
410 {
411 return item->Type() == PCB_FP_SHAPE_T;
412 } );
413
414 std::set<PAD*, FOOTPRINT::cmp_pads> aPads( Pads().begin(), Pads().end() );
415 std::set<PAD*, FOOTPRINT::cmp_pads> bPads( aLibFootprint->Pads().begin(), aLibFootprint->Pads().end() );
416
417 std::set<FP_ZONE*, FOOTPRINT::cmp_zones> aZones( Zones().begin(), Zones().end() );
418 std::set<FP_ZONE*, FOOTPRINT::cmp_zones> bZones( aLibFootprint->Zones().begin(), aLibFootprint->Zones().end() );
419
420 TEST( aPads.size(), bPads.size() );
421 TEST( aZones.size(), bZones.size() );
422 TEST( aShapes.size(), bShapes.size() );
423
424 for( auto aIt = aPads.begin(), bIt = bPads.begin(); aIt != aPads.end(); aIt++, bIt++ )
425 TEST_PADS( *aIt, *bIt );
426
427 for( auto aIt = aShapes.begin(), bIt = bShapes.begin(); aIt != aShapes.end(); aIt++, bIt++ )
428 {
429 if( ( *aIt )->Type() == PCB_FP_SHAPE_T )
430 TEST_SHAPES( static_cast<FP_SHAPE*>( *aIt ), static_cast<FP_SHAPE*>( *bIt ) );
431 }
432
433 for( auto aIt = aZones.begin(), bIt = bZones.begin(); aIt != aZones.end(); aIt++, bIt++ )
434 TEST_ZONES( *aIt, *bIt );
435
436 TEST( Models().size(), aLibFootprint->Models().size() );
437
438 for( size_t ii = 0; ii < Models().size(); ++ii )
439 TEST_MODELS( Models()[ii], aLibFootprint->Models()[ii] );
440
441 return false;
442}
443
444
446{
447 BOARD* board = m_drcEngine->GetBoard();
448 PROJECT* project = board->GetProject();
449
450 if( !project )
451 {
452 reportAux( _( "No project loaded, skipping library parity tests." ) );
453 return true; // Continue with other tests
454 }
455
456 if( !reportPhase( _( "Loading footprint library table..." ) ) )
457 return false; // DRC cancelled
458
459 std::map<LIB_ID, std::shared_ptr<FOOTPRINT>> libFootprintCache;
460
461 FP_LIB_TABLE* libTable = project->PcbFootprintLibs();
462 wxString msg;
463 int ii = 0;
464 const int progressDelta = 250;
465
466 if( !reportPhase( _( "Checking board footprints against library..." ) ) )
467 return false;
468
469 for( FOOTPRINT* footprint : board->Footprints() )
470 {
473 {
474 return true; // Continue with other tests
475 }
476
477 if( !reportProgress( ii++, board->Footprints().size(), progressDelta ) )
478 return false; // DRC cancelled
479
480 LIB_ID fpID = footprint->GetFPID();
481 wxString libName = fpID.GetLibNickname();
482 wxString fpName = fpID.GetLibItemName();
483 const LIB_TABLE_ROW* libTableRow = nullptr;
484
485 try
486 {
487 libTableRow = libTable->FindRow( libName );
488 }
489 catch( const IO_ERROR& )
490 {
491 }
492
493 if( !libTableRow )
494 {
496 {
497 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES );
498 msg.Printf( _( "The current configuration does not include the library '%s'." ),
499 libName );
500 drcItem->SetErrorMessage( msg );
501 drcItem->SetItems( footprint );
502 reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
503 }
504
505 continue;
506 }
507 else if( !libTable->HasLibrary( libName, true ) )
508 {
510 {
511 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES );
512 msg.Printf( _( "The library '%s' is not enabled in the current configuration." ),
513 libName );
514 drcItem->SetErrorMessage( msg );
515 drcItem->SetItems( footprint );
516 reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
517 }
518
519 continue;
520 }
521
522 auto cacheIt = libFootprintCache.find( fpID );
523 std::shared_ptr<FOOTPRINT> libFootprint;
524
525 if( cacheIt != libFootprintCache.end() )
526 {
527 libFootprint = cacheIt->second;
528 }
529 else
530 {
531 try
532 {
533 libFootprint.reset( libTable->FootprintLoad( libName, fpName, true ) );
534
535 if( libFootprint )
536 libFootprintCache[ fpID ] = libFootprint;
537 }
538 catch( const IO_ERROR& )
539 {
540 }
541 }
542
543 if( !libFootprint )
544 {
546 {
547 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES );
548 msg.Printf( _( "Footprint '%s' not found in library '%s'." ),
549 fpName,
550 libName );
551 drcItem->SetErrorMessage( msg );
552 drcItem->SetItems( footprint );
553 reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
554 }
555 }
556 else if( footprint->FootprintNeedsUpdate( libFootprint.get() ) )
557 {
559 {
560 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_MISMATCH );
561 msg.Printf( _( "Footprint '%s' does not match copy in library '%s'." ),
562 fpName,
563 libName );
564 drcItem->SetErrorMessage( msg );
565 drcItem->SetItems( footprint );
566 reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
567 }
568 }
569 }
570
571 return true;
572}
573
574
575namespace detail
576{
578}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:50
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:167
BOARD_ITEM_CONTAINER * GetParentFootprint() const
Definition: board_item.cpp:217
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
FOOTPRINTS & Footprints()
Definition: board.h:307
PROJECT * GetProject() const
Definition: board.h:440
BOARD * GetBoard() const
Definition: drc_engine.h:89
bool IsErrorLimitExceeded(int error_code)
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
Definition: drc_item.cpp:325
virtual const wxString GetDescription() const override
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
virtual const wxString GetName() const override
Represent a DRC "provider" which runs some DRC functions over a BOARD and spits out #DRC_ITEMs and po...
virtual bool reportPhase(const wxString &aStageName)
virtual bool reportProgress(int aCount, int aSize, int aDelta)
virtual void reportViolation(std::shared_ptr< DRC_ITEM > &item, const VECTOR2I &aMarkerPos, int aMarkerLayer)
virtual void reportAux(wxString fmt,...)
DRC_ENGINE * m_drcEngine
double AsDegrees() const
Definition: eda_angle.h:149
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:243
bool IsFilled() const
Definition: eda_shape.h:90
SHAPE_T GetShape() const
Definition: eda_shape.h:111
wxString SHAPE_T_asString() const
Definition: eda_shape.cpp:75
bool IsItalic() const
Definition: eda_text.h:120
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:117
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
bool IsKeepUpright() const
Definition: eda_text.h:145
virtual bool IsVisible() const
Definition: eda_text.h:126
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:139
bool IsMirrored() const
Definition: eda_text.h:129
bool IsBold() const
Definition: eda_text.h:123
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:142
int GetTextThickness() const
Definition: eda_text.h:109
VECTOR2I GetTextSize() const
Definition: eda_text.h:186
EDA_ANGLE GetOrientation() const
Definition: footprint.h:195
int GetLocalClearance() const
Definition: footprint.h:225
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1350
double GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:239
const wxString & GetKeywords() const
Definition: footprint.h:216
int GetAttributes() const
Definition: footprint.h:245
bool FootprintNeedsUpdate(const FOOTPRINT *aLibFootprint)
Return true if a board footprint differs from the library version.
bool IsFlipped() const
Definition: footprint.h:319
PADS & Pads()
Definition: footprint.h:174
int GetLocalSolderPasteMargin() const
Definition: footprint.h:236
const std::vector< wxString > & GetNetTiePadGroups() const
Definition: footprint.h:267
const wxString & GetDescription() const
Definition: footprint.h:213
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:188
ZONE_CONNECTION GetZoneConnection() const
Definition: footprint.h:243
FP_ZONES & Zones()
Definition: footprint.h:180
VECTOR2I GetPosition() const override
Definition: footprint.h:192
DRAWINGS & GraphicalItems()
Definition: footprint.h:177
int GetLocalSolderMaskMargin() const
Definition: footprint.h:222
VECTOR3D m_Offset
3D model offset (mm)
Definition: footprint.h:97
double m_Opacity
Definition: footprint.h:98
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:96
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:95
wxString m_Filename
The 3D shape filename in 3D library.
Definition: footprint.h:99
bool m_Show
Include model in rendering.
Definition: footprint.h:100
const FP_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an FP_LIB_TABLE_ROW if aNickName is found in this table or in any chained fall back table frag...
FOOTPRINT * FootprintLoad(const wxString &aNickname, const wxString &aFootprintName, bool aKeepUUID=false)
Load a footprint having aFootprintName from the library given by aNickname.
const VECTOR2I & GetBezierC1_0() const
Definition: fp_shape.h:98
const VECTOR2I & GetEnd0() const
Definition: fp_shape.h:95
const VECTOR2I & GetBezierC2_0() const
Definition: fp_shape.h:101
VECTOR2I GetCenter0() const
Definition: fp_shape.cpp:144
const VECTOR2I & GetStart0() const
Definition: fp_shape.h:92
const VECTOR2I & GetPos0() const
Definition: fp_text.h:124
A specialization of ZONE for use in footprints.
Definition: zone.h:897
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
const UTF8 & GetLibItemName() const
Definition: lib_id.h:101
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
Definition: pad.h:58
int GetLocalClearance(wxString *aSource) const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
Definition: pad.cpp:777
PAD_PROP GetProperty() const
Definition: pad.h:397
bool GetRemoveUnconnected() const
Definition: pad.h:590
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:377
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:391
const VECTOR2I & GetDrillSize() const
Definition: pad.h:261
PAD_ATTRIB GetAttribute() const
Definition: pad.h:394
ZONE_CONNECTION GetZoneConnection() const
Definition: pad.h:503
const wxString & GetNumber() const
Definition: pad.h:134
double GetLocalSolderPasteMarginRatio() const
Definition: pad.h:419
int GetRoundRectCornerRadius() const
Definition: pad.cpp:307
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives() const
Accessor to the basic shape list for custom-shaped pads.
Definition: pad.h:324
EDA_ANGLE GetThermalSpokeAngle() const
Definition: pad.h:522
const VECTOR2I & GetOffset() const
Definition: pad.h:268
int GetLocalSolderMaskMargin() const
Definition: pad.h:409
bool GetKeepTopBottom() const
Definition: pad.h:596
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: pad.h:206
FOOTPRINT * GetParent() const
Definition: pad.cpp:1464
const VECTOR2I & GetDelta() const
Definition: pad.h:258
PAD_SHAPE GetShape() const
Definition: pad.h:188
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
Definition: pad.h:364
int GetThermalSpokeWidth() const
Definition: pad.h:512
int GetLocalSolderPasteMargin() const
Definition: pad.h:416
int GetChamferPositions() const
Definition: pad.h:575
double GetRoundRectRadiusRatio() const
Definition: pad.h:556
int GetThermalGap() const
Definition: pad.h:535
const VECTOR2I & GetPos0() const
Definition: pad.h:245
const VECTOR2I & GetSize() const
Definition: pad.h:251
double GetChamferRectRatio() const
Definition: pad.h:565
int GetPadToDieLength() const
Definition: pad.h:407
STROKE_PARAMS GetStroke() const override
Definition: pcb_shape.h:69
Container for project specific data.
Definition: project.h:63
Represent a set of closed polygons.
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
int TotalVertices() const
Delete aIdx-th polygon from the set.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
void Move(const VECTOR2I &aVector) override
SHAPE_POLY_SET CloneDropTriangulation() const
Creates a new empty polygon in the set and returns its index.
bool GetIsRuleArea() const
Accessors to parameters used in Rule Area zones:
Definition: zone.h:691
bool GetDoNotAllowVias() const
Definition: zone.h:693
const ISLAND_REMOVAL_MODE GetIslandRemovalMode() const
Definition: zone.h:705
bool GetDoNotAllowPads() const
Definition: zone.h:695
bool GetDoNotAllowTracks() const
Definition: zone.h:694
SHAPE_POLY_SET * Outline()
Definition: zone.h:305
long long int GetMinIslandArea() const
Definition: zone.h:708
wxString GetZoneName() const
Definition: zone.h:117
int GetLocalClearance(wxString *aSource) const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
Definition: zone.cpp:425
int GetMinThickness() const
Definition: zone.h:244
ZONE_CONNECTION GetPadConnection() const
Definition: zone.h:241
int GetHatchThickness() const
Definition: zone.h:253
double GetHatchHoleMinArea() const
Definition: zone.h:268
int GetThermalReliefSpokeWidth() const
Definition: zone.h:188
EDA_ANGLE GetHatchOrientation() const
Definition: zone.h:259
bool GetDoNotAllowFootprints() const
Definition: zone.h:696
ZONE_FILL_MODE GetFillMode() const
Definition: zone.h:167
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.h:115
bool GetDoNotAllowCopperPour() const
Definition: zone.h:692
int GetHatchGap() const
Definition: zone.h:256
double GetHatchSmoothingValue() const
Definition: zone.h:265
int GetHatchSmoothingLevel() const
Definition: zone.h:262
unsigned int GetCornerRadius() const
Definition: zone.h:646
int GetCornerSmoothingType() const
Definition: zone.h:642
int GetThermalReliefGap() const
Definition: zone.h:177
unsigned GetAssignedPriority() const
Definition: zone.h:106
@ DRCE_LIB_FOOTPRINT_ISSUES
Definition: drc_item.h:76
@ DRCE_LIB_FOOTPRINT_MISMATCH
Definition: drc_item.h:77
#define TEST_PRIMITIVES(a, b)
#define TEST_ATTR(a, b, attr)
#define TEST_ZONES(a, b)
bool shapesNeedUpdate(const FP_SHAPE *a, const FP_SHAPE *b)
#define TEST_V3D(a, b)
#define TEST(a, b)
bool primitivesNeedUpdate(const std::shared_ptr< PCB_SHAPE > &a, const std::shared_ptr< PCB_SHAPE > &b)
bool textsNeedUpdate(const FP_TEXT *a, const FP_TEXT *b)
#define TEST_MODELS(a, b)
#define TEST_SHAPES(a, b)
#define TEST_PADS(a, b)
bool zonesNeedUpdate(const FP_ZONE *a, const FP_ZONE *b)
bool modelsNeedUpdate(const FP_3DMODEL &a, const FP_3DMODEL &b)
bool padsNeedUpdate(const PAD *a, const PAD *b)
#define TEST_D(a, b)
#define _(s)
@ FP_SMD
Definition: footprint.h:68
@ FP_ALLOW_MISSING_COURTYARD
Definition: footprint.h:74
@ FP_THROUGH_HOLE
Definition: footprint.h:67
@ FP_ALLOW_SOLDERMASK_BRIDGES
Definition: footprint.h:73
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
Definition: macros.h:120
static DRC_REGISTER_TEST_PROVIDER< DRC_TEST_PROVIDER_ANNULAR_WIDTH > dummy
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
@ PCB_FP_SHAPE_T
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:94