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
148 // Trim layersets to the current board before comparing
149 LSET enabledLayers = a->GetBoard()->GetEnabledLayers();
150 LSET aLayers = a->GetLayerSet() & enabledLayers;
151 LSET bLayers = b->GetLayerSet() & enabledLayers;
152 TEST( aLayers, bLayers );
153
154 TEST( a->GetAttribute(), b->GetAttribute() );
155 TEST( a->GetProperty(), b->GetProperty() );
156
157 // The pad orientation, for historical reasons is the pad rotation + parent rotation.
158 TEST_D(( a->GetOrientation() - a->GetParent()->GetOrientation() ).Normalize().AsDegrees(),
159 ( b->GetOrientation() - b->GetParent()->GetOrientation() ).Normalize().AsDegrees() );
160
161 TEST( a->GetSize(), b->GetSize() );
162 TEST( a->GetDelta(), b->GetDelta() );
167 TEST( a->GetOffset(), b->GetOffset() );
168
169 TEST( a->GetDrillShape(), b->GetDrillShape() );
170 TEST( a->GetDrillSize(), b->GetDrillSize() );
171
172 // Clearance and zone connection overrides are as likely to be set at the board level as in
173 // the library.
174 //
175 // If we ignore them and someone *does* change one of them in the library, then stale
176 // footprints won't be caught.
177 //
178 // On the other hand, if we report them then boards that override at the board level are
179 // going to be VERY noisy.
180#if 0
185
187 TEST( a->GetThermalGap(), b->GetThermalGap() );
191#endif
192
193 TEST( a->GetPrimitives().size(), b->GetPrimitives().size() );
194
195 for( size_t ii = 0; ii < a->GetPrimitives().size(); ++ii )
196 TEST_PRIMITIVES( a->GetPrimitives()[ii], b->GetPrimitives()[ii] );
197
198 return false;
199}
200
201
202bool shapesNeedUpdate( const FP_SHAPE* a, const FP_SHAPE* b )
203{
204 TEST( a->GetShape(), b->GetShape() );
205
206 switch( a->GetShape() )
207 {
208 case SHAPE_T::SEGMENT:
209 case SHAPE_T::RECT:
210 case SHAPE_T::CIRCLE:
211 TEST( a->GetStart0(), b->GetStart0() );
212 TEST( a->GetEnd0(), b->GetEnd0() );
213 break;
214
215 case SHAPE_T::ARC:
216 TEST( a->GetStart0(), b->GetStart0() );
217 TEST( a->GetEnd0(), b->GetEnd0() );
218
219 // Arc center is calculated and so may have round-off errors when parents are
220 // differentially rotated.
221 if( ( a->GetCenter0() - b->GetCenter0() ).EuclideanNorm() > pcbIUScale.mmToIU( 0.0001 ) )
222 return true;
223
224 break;
225
226 case SHAPE_T::BEZIER:
227 TEST( a->GetStart0(), b->GetStart0() );
228 TEST( a->GetEnd0(), b->GetEnd0() );
229 TEST( a->GetBezierC1_0(), b->GetBezierC1_0() );
230 TEST( a->GetBezierC2_0(), b->GetBezierC2_0() );
231 break;
232
233 case SHAPE_T::POLY:
235
236 for( int ii = 0; ii < a->GetPolyShape().TotalVertices(); ++ii )
237 TEST( a->GetPolyShape().CVertex( ii ), b->GetPolyShape().CVertex( ii ) );
238
239 break;
240
241 default:
243 }
244
245 TEST( a->GetStroke(), b->GetStroke() );
246 TEST( a->IsFilled(), b->IsFilled() );
247
248 TEST( a->GetLayer(), b->GetLayer() );
249
250 return false;
251}
252
253
254bool textsNeedUpdate( const FP_TEXT* a, const FP_TEXT* b )
255{
256 TEST( a->GetLayer(), b->GetLayer() );
257 TEST( a->IsKeepUpright(), b->IsKeepUpright() );
258
259 TEST( a->GetText(), b->GetText() );
260
262 TEST( a->GetTextAngle(), b->GetTextAngle() );
263 TEST( a->IsItalic(), b->IsItalic() );
264 TEST( a->IsBold(), b->IsBold() );
265 TEST( a->IsVisible(), b->IsVisible() );
266 TEST( a->IsMirrored(), b->IsMirrored() );
267
269 TEST( a->GetVertJustify(), b->GetVertJustify() );
270
271 TEST( a->GetTextSize(), b->GetTextSize() );
272 TEST( a->GetPos0(), b->GetPos0() );
273
274 return false;
275}
276
277
278bool zonesNeedUpdate( const FP_ZONE* a, const FP_ZONE* b )
279{
282 TEST( a->GetZoneName(), b->GetZoneName() );
284
285 TEST( a->GetIsRuleArea(), b->GetIsRuleArea() );
291
292 TEST( a->GetLayerSet(), b->GetLayerSet() );
293
298
300
303
304 TEST( a->GetFillMode(), b->GetFillMode() );
306 TEST( a->GetHatchGap(), b->GetHatchGap() );
311
312 // This is just a display property
313 // TEST( a->GetHatchBorderAlgorithm(), b->GetHatchBorderAlgorithm() );
314
315 TEST( a->Outline()->TotalVertices(), b->Outline()->TotalVertices() );
316
317 // The footprint's zone will be in board position, so we must translate & rotate the library
318 // footprint's zone to match.
319 FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( a->GetParentFootprint() );
320 const SHAPE_POLY_SET& aPoly = *a->Outline();
322
323 bPoly.Rotate( parentFootprint->GetOrientation() );
324 bPoly.Move( parentFootprint->GetPosition() );
325
326 for( int ii = 0; ii < a->Outline()->TotalVertices(); ++ii )
327 TEST( aPoly.CVertex( ii ), bPoly.CVertex( ii ) );
328
329 return false;
330}
331
332
333bool modelsNeedUpdate( const FP_3DMODEL& a, const FP_3DMODEL& b )
334{
335#define TEST_V3D( a, b ) { TEST_D( a.x, b.x ); TEST_D( a.y, b.y ); TEST_D( a.z, b.z ); }
336
337 TEST_V3D( a.m_Scale, b.m_Scale );
339 TEST_V3D( a.m_Offset, b.m_Offset );
340 TEST( a.m_Opacity, b.m_Opacity );
341 TEST( a.m_Filename, b.m_Filename );
342 TEST( a.m_Show, b.m_Show );
343
344 return false;
345}
346
347
348bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint )
349{
350#define TEST_ATTR( a, b, attr ) TEST( ( a & attr ), ( b & attr ) );
351 wxASSERT( aLibFootprint );
352
353 if( IsFlipped() )
354 {
355 std::unique_ptr<FOOTPRINT> temp( static_cast<FOOTPRINT*>( Clone() ) );
356 temp->Flip( {0,0}, false );
357 temp->SetParentGroup( nullptr );
358 return temp->FootprintNeedsUpdate( aLibFootprint );
359 }
360
361 TEST( GetDescription(), aLibFootprint->GetDescription() );
362 TEST( GetKeywords(), aLibFootprint->GetKeywords() );
363
365 TEST_ATTR( GetAttributes(), aLibFootprint->GetAttributes(), FP_SMD );
368
369 // Clearance and zone connection overrides are as likely to be set at the board level as in
370 // the library.
371 //
372 // If we ignore them and someone *does* change one of them in the library, then stale
373 // footprints won't be caught.
374 //
375 // On the other hand, if we report them then boards that override at the board level are
376 // going to be VERY noisy.
377#if 0
378 TEST( GetLocalClearance(), aLibFootprint->GetLocalClearance() );
382
383 TEST( GetZoneConnection(), aLibFootprint->GetZoneConnection() );
384#endif
385
386 TEST( GetNetTiePadGroups().size(), aLibFootprint->GetNetTiePadGroups().size() );
387
388 for( size_t ii = 0; ii < GetNetTiePadGroups().size(); ++ii )
389 TEST( GetNetTiePadGroups()[ii], aLibFootprint->GetNetTiePadGroups()[ii] );
390
391 // Text items are really problematic. We don't want to test the reference, but after that
392 // it gets messy.
393 //
394 // What about the value? Depends on whether or not it's a singleton part.
395 //
396 // And what about other texts? They might be added only to instances on the board, or even
397 // changed for instances on the board. Or they might want to be tested for equality.
398 //
399 // Currently we punt and ignore all the text items.
400
401 // Drawings and pads are also somewhat problematic as there's no guarantee that they'll be
402 // in the same order in the two footprints. Rather than building some sophisticated hashing
403 // algorithm we use the footprint sorting functions to attempt to sort them in the same
404 // order.
405
406 std::set<BOARD_ITEM*, FOOTPRINT::cmp_drawings> aShapes;
407 std::copy_if( GraphicalItems().begin(), GraphicalItems().end(),
408 std::inserter( aShapes, aShapes.begin() ),
409 []( BOARD_ITEM* item )
410 {
411 return item->Type() == PCB_FP_SHAPE_T;
412 } );
413 std::set<BOARD_ITEM*, FOOTPRINT::cmp_drawings> bShapes;
414 std::copy_if( aLibFootprint->GraphicalItems().begin(), aLibFootprint->GraphicalItems().end(),
415 std::inserter( bShapes, bShapes.begin() ),
416 []( BOARD_ITEM* item )
417 {
418 return item->Type() == PCB_FP_SHAPE_T;
419 } );
420
421 std::set<PAD*, FOOTPRINT::cmp_pads> aPads( Pads().begin(), Pads().end() );
422 std::set<PAD*, FOOTPRINT::cmp_pads> bPads( aLibFootprint->Pads().begin(), aLibFootprint->Pads().end() );
423
424 std::set<FP_ZONE*, FOOTPRINT::cmp_zones> aZones( Zones().begin(), Zones().end() );
425 std::set<FP_ZONE*, FOOTPRINT::cmp_zones> bZones( aLibFootprint->Zones().begin(), aLibFootprint->Zones().end() );
426
427 TEST( aPads.size(), bPads.size() );
428 TEST( aZones.size(), bZones.size() );
429 TEST( aShapes.size(), bShapes.size() );
430
431 for( auto aIt = aPads.begin(), bIt = bPads.begin(); aIt != aPads.end(); aIt++, bIt++ )
432 TEST_PADS( *aIt, *bIt );
433
434 for( auto aIt = aShapes.begin(), bIt = bShapes.begin(); aIt != aShapes.end(); aIt++, bIt++ )
435 {
436 if( ( *aIt )->Type() == PCB_FP_SHAPE_T )
437 TEST_SHAPES( static_cast<FP_SHAPE*>( *aIt ), static_cast<FP_SHAPE*>( *bIt ) );
438 }
439
440 for( auto aIt = aZones.begin(), bIt = bZones.begin(); aIt != aZones.end(); aIt++, bIt++ )
441 TEST_ZONES( *aIt, *bIt );
442
443 TEST( Models().size(), aLibFootprint->Models().size() );
444
445 for( size_t ii = 0; ii < Models().size(); ++ii )
446 TEST_MODELS( Models()[ii], aLibFootprint->Models()[ii] );
447
448 return false;
449}
450
451
453{
454 BOARD* board = m_drcEngine->GetBoard();
455 PROJECT* project = board->GetProject();
456
457 if( !project )
458 {
459 reportAux( _( "No project loaded, skipping library parity tests." ) );
460 return true; // Continue with other tests
461 }
462
463 if( !reportPhase( _( "Loading footprint library table..." ) ) )
464 return false; // DRC cancelled
465
466 std::map<LIB_ID, std::shared_ptr<FOOTPRINT>> libFootprintCache;
467
468 FP_LIB_TABLE* libTable = project->PcbFootprintLibs();
469 wxString msg;
470 int ii = 0;
471 const int progressDelta = 250;
472
473 if( !reportPhase( _( "Checking board footprints against library..." ) ) )
474 return false;
475
476 for( FOOTPRINT* footprint : board->Footprints() )
477 {
480 {
481 return true; // Continue with other tests
482 }
483
484 if( !reportProgress( ii++, board->Footprints().size(), progressDelta ) )
485 return false; // DRC cancelled
486
487 LIB_ID fpID = footprint->GetFPID();
488 wxString libName = fpID.GetLibNickname();
489 wxString fpName = fpID.GetLibItemName();
490 const LIB_TABLE_ROW* libTableRow = nullptr;
491
492 try
493 {
494 libTableRow = libTable->FindRow( libName );
495 }
496 catch( const IO_ERROR& )
497 {
498 }
499
500 if( !libTableRow )
501 {
503 {
504 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES );
505 msg.Printf( _( "The current configuration does not include the library '%s'." ),
506 libName );
507 drcItem->SetErrorMessage( msg );
508 drcItem->SetItems( footprint );
509 reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
510 }
511
512 continue;
513 }
514 else if( !libTable->HasLibrary( libName, true ) )
515 {
517 {
518 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES );
519 msg.Printf( _( "The library '%s' is not enabled in the current configuration." ),
520 libName );
521 drcItem->SetErrorMessage( msg );
522 drcItem->SetItems( footprint );
523 reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
524 }
525
526 continue;
527 }
528
529 auto cacheIt = libFootprintCache.find( fpID );
530 std::shared_ptr<FOOTPRINT> libFootprint;
531
532 if( cacheIt != libFootprintCache.end() )
533 {
534 libFootprint = cacheIt->second;
535 }
536 else
537 {
538 try
539 {
540 libFootprint.reset( libTable->FootprintLoad( libName, fpName, true ) );
541
542 if( libFootprint )
543 libFootprintCache[ fpID ] = libFootprint;
544 }
545 catch( const IO_ERROR& )
546 {
547 }
548 }
549
550 if( !libFootprint )
551 {
553 {
554 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_ISSUES );
555 msg.Printf( _( "Footprint '%s' not found in library '%s'." ),
556 fpName,
557 libName );
558 drcItem->SetErrorMessage( msg );
559 drcItem->SetItems( footprint );
560 reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
561 }
562 }
563 else if( footprint->FootprintNeedsUpdate( libFootprint.get() ) )
564 {
566 {
567 std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_LIB_FOOTPRINT_MISMATCH );
568 msg.Printf( _( "Footprint '%s' does not match copy in library '%s'." ),
569 fpName,
570 libName );
571 drcItem->SetErrorMessage( msg );
572 drcItem->SetItems( footprint );
573 reportViolation( drcItem, footprint->GetCenter(), UNDEFINED_LAYER );
574 }
575 }
576 }
577
578 return true;
579}
580
581
582namespace detail
583{
585}
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:58
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:180
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:43
BOARD_ITEM_CONTAINER * GetParentFootprint() const
Definition: board_item.cpp:239
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:569
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:247
bool IsFilled() const
Definition: eda_shape.h:90
SHAPE_T GetShape() const
Definition: eda_shape.h:113
wxString SHAPE_T_asString() const
Definition: eda_shape.cpp:75
bool IsItalic() const
Definition: eda_text.h:130
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:120
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:155
virtual bool IsVisible() const
Definition: eda_text.h:136
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition: eda_text.h:149
bool IsMirrored() const
Definition: eda_text.h:139
bool IsBold() const
Definition: eda_text.h:133
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition: eda_text.h:152
int GetTextThickness() const
Definition: eda_text.h:112
VECTOR2I GetTextSize() const
Definition: eda_text.h:196
EDA_ANGLE GetOrientation() const
Definition: footprint.h:191
int GetLocalClearance() const
Definition: footprint.h:230
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1374
wxString GetDescription() const
Definition: footprint.h:218
double GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:244
int GetAttributes() const
Definition: footprint.h:250
bool FootprintNeedsUpdate(const FOOTPRINT *aLibFootprint)
Return true if a board footprint differs from the library version.
bool IsFlipped() const
Definition: footprint.h:324
PADS & Pads()
Definition: footprint.h:170
int GetLocalSolderPasteMargin() const
Definition: footprint.h:241
const std::vector< wxString > & GetNetTiePadGroups() const
Definition: footprint.h:272
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:184
ZONE_CONNECTION GetZoneConnection() const
Definition: footprint.h:248
FP_ZONES & Zones()
Definition: footprint.h:176
wxString GetKeywords() const
Definition: footprint.h:221
VECTOR2I GetPosition() const override
Definition: footprint.h:188
DRAWINGS & GraphicalItems()
Definition: footprint.h:173
int GetLocalSolderMaskMargin() const
Definition: footprint.h:227
VECTOR3D m_Offset
3D model offset (mm)
Definition: footprint.h:93
double m_Opacity
Definition: footprint.h:94
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:92
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:91
wxString m_Filename
The 3D shape filename in 3D library.
Definition: footprint.h:95
bool m_Show
Include model in rendering.
Definition: footprint.h:96
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:910
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:102
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.
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
Definition: pad.h:59
int GetLocalClearance(wxString *aSource) const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
Definition: pad.cpp:814
PAD_PROP GetProperty() const
Definition: pad.h:403
bool GetRemoveUnconnected() const
Definition: pad.h:609
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:383
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pad.h:397
const VECTOR2I & GetDrillSize() const
Definition: pad.h:267
PAD_ATTRIB GetAttribute() const
Definition: pad.h:400
ZONE_CONNECTION GetZoneConnection() const
Definition: pad.h:522
const wxString & GetNumber() const
Definition: pad.h:135
double GetLocalSolderPasteMarginRatio() const
Definition: pad.h:425
int GetRoundRectCornerRadius() const
Definition: pad.cpp:345
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives() const
Accessor to the basic shape list for custom-shaped pads.
Definition: pad.h:330
EDA_ANGLE GetThermalSpokeAngle() const
Definition: pad.h:541
const VECTOR2I & GetOffset() const
Definition: pad.h:274
int GetLocalSolderMaskMargin() const
Definition: pad.h:415
bool GetKeepTopBottom() const
Definition: pad.h:615
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: pad.h:212
FOOTPRINT * GetParent() const
Definition: pad.cpp:1486
const VECTOR2I & GetDelta() const
Definition: pad.h:264
PAD_SHAPE GetShape() const
Definition: pad.h:194
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
Definition: pad.h:370
int GetThermalSpokeWidth() const
Definition: pad.h:531
int GetLocalSolderPasteMargin() const
Definition: pad.h:422
int GetChamferPositions() const
Definition: pad.h:594
double GetRoundRectRadiusRatio() const
Definition: pad.h:575
int GetThermalGap() const
Definition: pad.h:554
const VECTOR2I & GetPos0() const
Definition: pad.h:251
const VECTOR2I & GetSize() const
Definition: pad.h:257
double GetChamferRectRatio() const
Definition: pad.h:584
int GetPadToDieLength() const
Definition: pad.h:413
STROKE_PARAMS GetStroke() const override
Definition: pcb_shape.h:71
Container for project specific data.
Definition: project.h:64
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:697
bool GetDoNotAllowVias() const
Definition: zone.h:699
const ISLAND_REMOVAL_MODE GetIslandRemovalMode() const
Definition: zone.h:711
bool GetDoNotAllowPads() const
Definition: zone.h:701
bool GetDoNotAllowTracks() const
Definition: zone.h:700
SHAPE_POLY_SET * Outline()
Definition: zone.h:312
long long int GetMinIslandArea() const
Definition: zone.h:714
wxString GetZoneName() const
Definition: zone.h:124
int GetLocalClearance(wxString *aSource) const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
Definition: zone.cpp:470
int GetMinThickness() const
Definition: zone.h:251
ZONE_CONNECTION GetPadConnection() const
Definition: zone.h:248
int GetHatchThickness() const
Definition: zone.h:260
double GetHatchHoleMinArea() const
Definition: zone.h:275
int GetThermalReliefSpokeWidth() const
Definition: zone.h:195
EDA_ANGLE GetHatchOrientation() const
Definition: zone.h:266
bool GetDoNotAllowFootprints() const
Definition: zone.h:702
ZONE_FILL_MODE GetFillMode() const
Definition: zone.h:174
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.h:122
bool GetDoNotAllowCopperPour() const
Definition: zone.h:698
int GetHatchGap() const
Definition: zone.h:263
double GetHatchSmoothingValue() const
Definition: zone.h:272
int GetHatchSmoothingLevel() const
Definition: zone.h:269
unsigned int GetCornerRadius() const
Definition: zone.h:652
int GetCornerSmoothingType() const
Definition: zone.h:648
int GetThermalReliefGap() const
Definition: zone.h:184
unsigned GetAssignedPriority() const
Definition: zone.h:112
@ 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:69
@ FP_ALLOW_MISSING_COURTYARD
Definition: footprint.h:75
@ FP_THROUGH_HOLE
Definition: footprint.h:68
@ FP_ALLOW_SOLDERMASK_BRIDGES
Definition: footprint.h:74
@ 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