KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbexpr_functions.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) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
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
25#include <cstdio>
26#include <memory>
27#include <wx/log.h>
28#include <board.h>
30#include <drc/drc_rtree.h>
31#include <drc/drc_engine.h>
32#include <pcb_track.h>
33#include <pcb_group.h>
35#include <pcbexpr_evaluator.h>
39
40
41bool fromToFunc( LIBEVAL::CONTEXT* aCtx, void* self )
42{
43 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
44 BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
45 LIBEVAL::VALUE* result = aCtx->AllocValue();
46
47 LIBEVAL::VALUE* argTo = aCtx->Pop();
48 LIBEVAL::VALUE* argFrom = aCtx->Pop();
49
50 result->Set(0.0);
51 aCtx->Push( result );
52
53 if(!item)
54 return false;
55
56 auto ftCache = item->GetBoard()->GetConnectivity()->GetFromToCache();
57
58 if( !ftCache )
59 {
60 wxLogWarning( wxT( "Attempting to call fromTo() with non-existent from-to cache." ) );
61 return true;
62 }
63
64 if( ftCache->IsOnFromToPath( static_cast<BOARD_CONNECTED_ITEM*>( item ),
65 argFrom->AsString(), argTo->AsString() ) )
66 {
67 result->Set(1.0);
68 }
69
70 return true;
71}
72
73
74#define MISSING_LAYER_ARG( f ) wxString::Format( _( "Missing layer name argument to %s." ), f )
75
76static void existsOnLayerFunc( LIBEVAL::CONTEXT* aCtx, void *self )
77{
78 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
79 BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
80
81 LIBEVAL::VALUE* arg = aCtx->Pop();
82 LIBEVAL::VALUE* result = aCtx->AllocValue();
83
84 result->Set( 0.0 );
85 aCtx->Push( result );
86
87 if( !item )
88 return;
89
90 if( !arg || arg->AsString().IsEmpty() )
91 {
92 if( aCtx->HasErrorCallback() )
93 aCtx->ReportError( MISSING_LAYER_ARG( wxT( "existsOnLayer()" ) ) );
94
95 return;
96 }
97
98 result->SetDeferredEval(
99 [item, arg, aCtx]() -> double
100 {
101 const wxString& layerName = arg->AsString();
102 wxPGChoices& layerMap = ENUM_MAP<PCB_LAYER_ID>::Instance().Choices();
103
104 if( aCtx->HasErrorCallback())
105 {
106 /*
107 * Interpreted version
108 */
109
110 bool anyMatch = false;
111
112 for( unsigned ii = 0; ii < layerMap.GetCount(); ++ii )
113 {
114 wxPGChoiceEntry& entry = layerMap[ ii ];
115
116 if( entry.GetText().Matches( layerName ))
117 {
118 anyMatch = true;
119
120 if( item->IsOnLayer( ToLAYER_ID( entry.GetValue() ) ) )
121 return 1.0;
122 }
123 }
124
125 if( !anyMatch )
126 {
127 aCtx->ReportError( wxString::Format( _( "Unrecognized layer '%s'" ),
128 layerName ) );
129 }
130 }
131 else
132 {
133 /*
134 * Compiled version
135 */
136
137 BOARD* board = item->GetBoard();
138 std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
139 auto i = board->m_LayerExpressionCache.find( layerName );
140 LSET mask;
141
142 if( i == board->m_LayerExpressionCache.end() )
143 {
144 for( unsigned ii = 0; ii < layerMap.GetCount(); ++ii )
145 {
146 wxPGChoiceEntry& entry = layerMap[ ii ];
147
148 if( entry.GetText().Matches( layerName ) )
149 mask.set( ToLAYER_ID( entry.GetValue() ) );
150 }
151
152 board->m_LayerExpressionCache[ layerName ] = mask;
153 }
154 else
155 {
156 mask = i->second;
157 }
158
159 if( ( item->GetLayerSet() & mask ).any() )
160 return 1.0;
161 }
162
163 return 0.0;
164 } );
165}
166
167
168static void isPlatedFunc( LIBEVAL::CONTEXT* aCtx, void* self )
169{
170 LIBEVAL::VALUE* result = aCtx->AllocValue();
171
172 result->Set( 0.0 );
173 aCtx->Push( result );
174
175 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
176 BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
177
178 if( !item )
179 return;
180
181 if( item->Type() == PCB_PAD_T && static_cast<PAD*>( item )->GetAttribute() == PAD_ATTRIB::PTH )
182 result->Set( 1.0 );
183 else if( item->Type() == PCB_VIA_T )
184 result->Set( 1.0 );
185}
186
187
188bool collidesWithCourtyard( BOARD_ITEM* aItem, std::shared_ptr<SHAPE>& aItemShape,
189 PCBEXPR_CONTEXT* aCtx, FOOTPRINT* aFootprint, PCB_LAYER_ID aSide )
190{
191 SHAPE_POLY_SET footprintCourtyard;
192
193 footprintCourtyard = aFootprint->GetCourtyard( aSide );
194
195 if( !aItemShape )
196 {
197 // Since rules are used for zone filling we can't rely on the filled shapes.
198 // Use the zone outline instead.
199 if( ZONE* zone = dynamic_cast<ZONE*>( aItem ) )
200 aItemShape.reset( zone->Outline()->Clone() );
201 else
202 aItemShape = aItem->GetEffectiveShape( aCtx->GetLayer() );
203 }
204
205 return footprintCourtyard.Collide( aItemShape.get() );
206};
207
208
209static bool searchFootprints( BOARD* aBoard, const wxString& aArg, PCBEXPR_CONTEXT* aCtx,
210 const std::function<bool( FOOTPRINT* )>& aFunc )
211{
212 if( aArg == wxT( "A" ) )
213 {
214 FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( aCtx->GetItem( 0 ) );
215
216 if( fp && aFunc( fp ) )
217 return true;
218 }
219 else if( aArg == wxT( "B" ) )
220 {
221 FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( aCtx->GetItem( 1 ) );
222
223 if( fp && aFunc( fp ) )
224 return true;
225 }
226 else for( FOOTPRINT* fp : aBoard->Footprints() )
227 {
228 if( fp->GetReference().Matches( aArg ) )
229 {
230 if( aFunc( fp ) )
231 return true;
232 }
233 }
234
235 return false;
236}
237
238
239#define MISSING_FP_ARG( f ) \
240 wxString::Format( _( "Missing footprint argument (A, B, or reference designator) to %s." ), f )
241
242static void intersectsCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self )
243{
244 PCBEXPR_CONTEXT* context = static_cast<PCBEXPR_CONTEXT*>( aCtx );
245 LIBEVAL::VALUE* arg = context->Pop();
246 LIBEVAL::VALUE* result = context->AllocValue();
247
248 result->Set( 0.0 );
249 context->Push( result );
250
251 if( !arg || arg->AsString().IsEmpty() )
252 {
253 if( context->HasErrorCallback() )
254 context->ReportError( MISSING_FP_ARG( wxT( "intersectsCourtyard()" ) ) );
255
256 return;
257 }
258
259 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
260 BOARD_ITEM* item = vref ? vref->GetObject( context ) : nullptr;
261
262 if( !item )
263 return;
264
265 result->SetDeferredEval(
266 [item, arg, context]() -> double
267 {
268 BOARD* board = item->GetBoard();
269 std::shared_ptr<SHAPE> itemShape;
270
271 if( searchFootprints( board, arg->AsString(), context,
272 [&]( FOOTPRINT* fp )
273 {
274 PTR_PTR_CACHE_KEY key = { fp, item };
275 std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
276
277 if( ( item->GetFlags() & ROUTER_TRANSIENT ) == 0 )
278 {
279 auto i = board->m_IntersectsCourtyardCache.find( key );
280
281 if( i != board->m_IntersectsCourtyardCache.end() )
282 return i->second;
283 }
284
285 bool res = collidesWithCourtyard( item, itemShape, context, fp, F_Cu )
286 || collidesWithCourtyard( item, itemShape, context, fp, B_Cu );
287
288 if( ( item->GetFlags() & ROUTER_TRANSIENT ) == 0 )
289 board->m_IntersectsCourtyardCache[ key ] = res;
290
291 return res;
292 } ) )
293 {
294 return 1.0;
295 }
296
297 return 0.0;
298 } );
299}
300
301
302static void intersectsFrontCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self )
303{
304 PCBEXPR_CONTEXT* context = static_cast<PCBEXPR_CONTEXT*>( aCtx );
305 LIBEVAL::VALUE* arg = context->Pop();
306 LIBEVAL::VALUE* result = context->AllocValue();
307
308 result->Set( 0.0 );
309 context->Push( result );
310
311 if( !arg || arg->AsString().IsEmpty() )
312 {
313 if( context->HasErrorCallback() )
314 context->ReportError( MISSING_FP_ARG( wxT( "intersectsFrontCourtyard()" ) ) );
315
316 return;
317 }
318
319 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
320 BOARD_ITEM* item = vref ? vref->GetObject( context ) : nullptr;
321
322 if( !item )
323 return;
324
325 result->SetDeferredEval(
326 [item, arg, context]() -> double
327 {
328 BOARD* board = item->GetBoard();
329 std::shared_ptr<SHAPE> itemShape;
330
331 if( searchFootprints( board, arg->AsString(), context,
332 [&]( FOOTPRINT* fp )
333 {
334 PTR_PTR_CACHE_KEY key = { fp, item };
335 std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
336
337 if( ( item->GetFlags() & ROUTER_TRANSIENT ) == 0 )
338 {
339 auto i = board->m_IntersectsFCourtyardCache.find( key );
340
341 if( i != board->m_IntersectsFCourtyardCache.end() )
342 return i->second;
343 }
344
345 bool res = collidesWithCourtyard( item, itemShape, context, fp, F_Cu );
346
347 if( ( item->GetFlags() & ROUTER_TRANSIENT ) == 0 )
348 board->m_IntersectsFCourtyardCache[ key ] = res;
349
350 return res;
351 } ) )
352 {
353 return 1.0;
354 }
355
356 return 0.0;
357 } );
358}
359
360
361static void intersectsBackCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self )
362{
363 PCBEXPR_CONTEXT* context = static_cast<PCBEXPR_CONTEXT*>( aCtx );
364 LIBEVAL::VALUE* arg = context->Pop();
365 LIBEVAL::VALUE* result = context->AllocValue();
366
367 result->Set( 0.0 );
368 context->Push( result );
369
370 if( !arg || arg->AsString().IsEmpty() )
371 {
372 if( context->HasErrorCallback() )
373 context->ReportError( MISSING_FP_ARG( wxT( "intersectsBackCourtyard()" ) ) );
374
375 return;
376 }
377
378 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
379 BOARD_ITEM* item = vref ? vref->GetObject( context ) : nullptr;
380
381 if( !item )
382 return;
383
384 result->SetDeferredEval(
385 [item, arg, context]() -> double
386 {
387 BOARD* board = item->GetBoard();
388 std::shared_ptr<SHAPE> itemShape;
389
390 if( searchFootprints( board, arg->AsString(), context,
391 [&]( FOOTPRINT* fp )
392 {
393 PTR_PTR_CACHE_KEY key = { fp, item };
394 std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
395
396 if( ( item->GetFlags() & ROUTER_TRANSIENT ) == 0 )
397 {
398 auto i = board->m_IntersectsBCourtyardCache.find( key );
399
400 if( i != board->m_IntersectsBCourtyardCache.end() )
401 return i->second;
402 }
403
404 bool res = collidesWithCourtyard( item, itemShape, context, fp, B_Cu );
405
406 if( ( item->GetFlags() & ROUTER_TRANSIENT ) == 0 )
407 board->m_IntersectsBCourtyardCache[ key ] = res;
408
409 return res;
410 } ) )
411 {
412 return 1.0;
413 }
414
415 return 0.0;
416 } );
417}
418
419
420bool collidesWithArea( BOARD_ITEM* aItem, PCBEXPR_CONTEXT* aCtx, ZONE* aArea )
421{
422 BOARD* board = aArea->GetBoard();
423 BOX2I areaBBox = aArea->GetBoundingBox();
424 std::shared_ptr<SHAPE> shape;
425
426 // Collisions include touching, so we need to deflate outline by enough to exclude it.
427 // This is particularly important for detecting copper fills as they will be exactly
428 // touching along the entire exclusion border.
429 SHAPE_POLY_SET areaOutline = aArea->Outline()->CloneDropTriangulation();
430 areaOutline.ClearArcs();
431 areaOutline.Deflate( board->GetDesignSettings().GetDRCEpsilon(),
433
434 if( aItem->GetFlags() & HOLE_PROXY )
435 {
436 if( aItem->Type() == PCB_PAD_T )
437 {
438 return areaOutline.Collide( aItem->GetEffectiveHoleShape().get() );
439 }
440 else if( aItem->Type() == PCB_VIA_T )
441 {
442 LSET overlap = aItem->GetLayerSet() & aArea->GetLayerSet();
443
445 if( overlap.any() )
446 {
447 if( aCtx->GetLayer() == UNDEFINED_LAYER || overlap.Contains( aCtx->GetLayer() ) )
448 return areaOutline.Collide( aItem->GetEffectiveHoleShape().get() );
449 }
450 }
451
452 return false;
453 }
454
455 if( aItem->Type() == PCB_FOOTPRINT_T )
456 {
457 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aItem );
458
459 if( ( footprint->GetFlags() & MALFORMED_COURTYARDS ) != 0 )
460 {
461 if( aCtx->HasErrorCallback() )
462 aCtx->ReportError( _( "Footprint's courtyard is not a single, closed shape." ) );
463
464 return false;
465 }
466
467 if( ( aArea->GetLayerSet() & LSET::FrontMask() ).any() )
468 {
469 const SHAPE_POLY_SET& courtyard = footprint->GetCourtyard( F_CrtYd );
470
471 if( courtyard.OutlineCount() == 0 )
472 {
473 if( aCtx->HasErrorCallback() )
474 aCtx->ReportError( _( "Footprint has no front courtyard." ) );
475 }
476 else if( areaOutline.Collide( &courtyard.Outline( 0 ) ) )
477 {
478 return true;
479 }
480 }
481
482 if( ( aArea->GetLayerSet() & LSET::BackMask() ).any() )
483 {
484 const SHAPE_POLY_SET& courtyard = footprint->GetCourtyard( B_CrtYd );
485
486 if( courtyard.OutlineCount() == 0 )
487 {
488 if( aCtx->HasErrorCallback() )
489 aCtx->ReportError( _( "Footprint has no back courtyard." ) );
490 }
491 else if( areaOutline.Collide( &courtyard.Outline( 0 ) ) )
492 {
493 return true;
494 }
495 }
496
497 return false;
498 }
499
500 if( aItem->Type() == PCB_ZONE_T )
501 {
502 ZONE* zone = static_cast<ZONE*>( aItem );
503
504 if( !zone->IsFilled() )
505 return false;
506
507 DRC_RTREE* zoneRTree = board->m_CopperZoneRTreeCache[ zone ].get();
508
509 if( zoneRTree )
510 {
511 for( PCB_LAYER_ID layer : aArea->GetLayerSet().Seq() )
512 {
513 if( aCtx->GetLayer() == layer || aCtx->GetLayer() == UNDEFINED_LAYER )
514 {
515 if( zoneRTree->QueryColliding( areaBBox, &areaOutline, layer ) )
516 return true;
517 }
518 }
519 }
520
521 return false;
522 }
523 else
524 {
525 PCB_LAYER_ID layer = aCtx->GetLayer();
526
527 if( layer != UNDEFINED_LAYER && !( aArea->GetLayerSet().Contains( layer ) ) )
528 return false;
529
530 if( !shape )
531 shape = aItem->GetEffectiveShape( layer );
532
533 return areaOutline.Collide( shape.get() );
534 }
535}
536
537
538bool searchAreas( BOARD* aBoard, const wxString& aArg, PCBEXPR_CONTEXT* aCtx,
539 const std::function<bool( ZONE* )>& aFunc )
540{
541 if( aArg == wxT( "A" ) )
542 {
543 return aFunc( dynamic_cast<ZONE*>( aCtx->GetItem( 0 ) ) );
544 }
545 else if( aArg == wxT( "B" ) )
546 {
547 return aFunc( dynamic_cast<ZONE*>( aCtx->GetItem( 1 ) ) );
548 }
549 else if( KIID::SniffTest( aArg ) )
550 {
551 KIID target( aArg );
552
553 for( ZONE* area : aBoard->Zones() )
554 {
555 // Only a single zone can match the UUID; exit once we find a match whether
556 // "inside" or not
557 if( area->m_Uuid == target )
558 return aFunc( area );
559 }
560
561 for( FOOTPRINT* footprint : aBoard->Footprints() )
562 {
563 for( ZONE* area : footprint->Zones() )
564 {
565 // Only a single zone can match the UUID; exit once we find a match
566 // whether "inside" or not
567 if( area->m_Uuid == target )
568 return aFunc( area );
569 }
570 }
571
572 return false;
573 }
574 else // Match on zone name
575 {
576 for( ZONE* area : aBoard->Zones() )
577 {
578 if( area->GetZoneName().Matches( aArg ) )
579 {
580 // Many zones can match the name; exit only when we find an "inside"
581 if( aFunc( area ) )
582 return true;
583 }
584 }
585
586 for( FOOTPRINT* footprint : aBoard->Footprints() )
587 {
588 for( ZONE* area : footprint->Zones() )
589 {
590 // Many zones can match the name; exit only when we find an "inside"
591 if( area->GetZoneName().Matches( aArg ) )
592 {
593 if( aFunc( area ) )
594 return true;
595 }
596 }
597 }
598
599 return false;
600 }
601}
602
603
604#define MISSING_AREA_ARG( f ) \
605 wxString::Format( _( "Missing rule-area argument (A, B, or rule-area name) to %s." ), f )
606
607static void intersectsAreaFunc( LIBEVAL::CONTEXT* aCtx, void* self )
608{
609 PCBEXPR_CONTEXT* context = static_cast<PCBEXPR_CONTEXT*>( aCtx );
610 LIBEVAL::VALUE* arg = aCtx->Pop();
611 LIBEVAL::VALUE* result = aCtx->AllocValue();
612
613 result->Set( 0.0 );
614 aCtx->Push( result );
615
616 if( !arg || arg->AsString().IsEmpty() )
617 {
618 if( aCtx->HasErrorCallback() )
619 aCtx->ReportError( MISSING_AREA_ARG( wxT( "intersectsArea()" ) ) );
620
621 return;
622 }
623
624 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
625 BOARD_ITEM* item = vref ? vref->GetObject( context ) : nullptr;
626
627 if( !item )
628 return;
629
630 result->SetDeferredEval(
631 [item, arg, context]() -> double
632 {
633 BOARD* board = item->GetBoard();
634 PCB_LAYER_ID aLayer = context->GetLayer();
635 BOX2I itemBBox = item->GetBoundingBox();
636
637 if( searchAreas( board, arg->AsString(), context,
638 [&]( ZONE* aArea )
639 {
640 if( !aArea || aArea == item || aArea->GetParent() == item )
641 return false;
642
643 LSET commonLayers = aArea->GetLayerSet() & item->GetLayerSet();
644
645 if( !commonLayers.any() )
646 return false;
647
648 if( !aArea->GetBoundingBox().Intersects( itemBBox ) )
649 return false;
650
651 std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
652 LSET testLayers;
653 PTR_PTR_LAYER_CACHE_KEY key;
654
655 if( aLayer != UNDEFINED_LAYER )
656 testLayers.set( aLayer );
657 else
658 testLayers = commonLayers;
659
660 for( PCB_LAYER_ID layer : testLayers.UIOrder() )
661 {
662 if( ( item->GetFlags() & ROUTER_TRANSIENT ) == 0 )
663 {
664 key = { aArea, item, layer };
665
666 auto i = board->m_IntersectsAreaCache.find( key );
667
668 if( i != board->m_IntersectsAreaCache.end() && i->second )
669 return true;
670 }
671
672 bool collides = collidesWithArea( item, context, aArea );
673
674 if( ( item->GetFlags() & ROUTER_TRANSIENT ) == 0 )
675 board->m_IntersectsAreaCache[ key ] = collides;
676
677 if( collides )
678 return true;
679 }
680
681 return false;
682 } ) )
683 {
684 return 1.0;
685 }
686
687 return 0.0;
688 } );
689}
690
691
692static void enclosedByAreaFunc( LIBEVAL::CONTEXT* aCtx, void* self )
693{
694 PCBEXPR_CONTEXT* context = static_cast<PCBEXPR_CONTEXT*>( aCtx );
695 LIBEVAL::VALUE* arg = aCtx->Pop();
696 LIBEVAL::VALUE* result = aCtx->AllocValue();
697
698 result->Set( 0.0 );
699 aCtx->Push( result );
700
701 if( !arg || arg->AsString().IsEmpty() )
702 {
703 if( aCtx->HasErrorCallback() )
704 aCtx->ReportError( MISSING_AREA_ARG( wxT( "enclosedByArea()" ) ) );
705
706 return;
707 }
708
709 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
710 BOARD_ITEM* item = vref ? vref->GetObject( context ) : nullptr;
711
712 if( !item )
713 return;
714
715 result->SetDeferredEval(
716 [item, arg, context]() -> double
717 {
718 BOARD* board = item->GetBoard();
719 int maxError = board->GetDesignSettings().m_MaxError;
720 PCB_LAYER_ID layer = context->GetLayer();
721 BOX2I itemBBox = item->GetBoundingBox();
722
723 if( searchAreas( board, arg->AsString(), context,
724 [&]( ZONE* aArea )
725 {
726 if( !aArea || aArea == item || aArea->GetParent() == item )
727 return false;
728
729 if( !( aArea->GetLayerSet() & item->GetLayerSet() ).any() )
730 return false;
731
732 if( !aArea->GetBoundingBox().Intersects( itemBBox ) )
733 return false;
734
735 std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
736 PTR_PTR_LAYER_CACHE_KEY key = { aArea, item, layer };
737
738 if( ( item->GetFlags() & ROUTER_TRANSIENT ) == 0 )
739 {
740 auto i = board->m_EnclosedByAreaCache.find( key );
741
742 if( i != board->m_EnclosedByAreaCache.end() )
743 return i->second;
744 }
745
746 SHAPE_POLY_SET itemShape;
747 bool enclosedByArea;
748
749 item->TransformShapeToPolygon( itemShape, layer, 0, maxError,
751
752 if( itemShape.IsEmpty() )
753 {
754 // If it's already empty then our test will have no meaning.
755 enclosedByArea = false;
756 }
757 else
758 {
759 itemShape.BooleanSubtract( *aArea->Outline(),
760 SHAPE_POLY_SET::PM_FAST );
761
762 enclosedByArea = itemShape.IsEmpty();
763 }
764
765 if( ( item->GetFlags() & ROUTER_TRANSIENT ) == 0 )
766 board->m_EnclosedByAreaCache[ key ] = enclosedByArea;
767
768 return enclosedByArea;
769 } ) )
770 {
771 return 1.0;
772 }
773
774 return 0.0;
775 } );
776}
777
778
779#define MISSING_GROUP_ARG( f ) \
780 wxString::Format( _( "Missing group name argument to %s." ), f )
781
782static void memberOfGroupFunc( LIBEVAL::CONTEXT* aCtx, void* self )
783{
784 LIBEVAL::VALUE* arg = aCtx->Pop();
785 LIBEVAL::VALUE* result = aCtx->AllocValue();
786
787 result->Set( 0.0 );
788 aCtx->Push( result );
789
790 if( !arg || arg->AsString().IsEmpty() )
791 {
792 if( aCtx->HasErrorCallback() )
793 aCtx->ReportError( MISSING_GROUP_ARG( wxT( "memberOfGroup()" ) ) );
794
795 return;
796 }
797
798 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
799 BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
800
801 if( !item )
802 return;
803
804 result->SetDeferredEval(
805 [item, arg]() -> double
806 {
807 PCB_GROUP* group = item->GetParentGroup();
808
809 if( !group && item->GetParent() && item->GetParent()->Type() == PCB_FOOTPRINT_T )
810 group = item->GetParent()->GetParentGroup();
811
812 while( group )
813 {
814 if( group->GetName().Matches( arg->AsString() ) )
815 return 1.0;
816
817 group = group->GetParentGroup();
818 }
819
820 return 0.0;
821 } );
822}
823
824
825#define MISSING_SHEET_ARG( f ) \
826 wxString::Format( _( "Missing sheet name argument to %s." ), f )
827
828static void memberOfSheetFunc( LIBEVAL::CONTEXT* aCtx, void* self )
829{
830 LIBEVAL::VALUE* arg = aCtx->Pop();
831 LIBEVAL::VALUE* result = aCtx->AllocValue();
832
833 result->Set( 0.0 );
834 aCtx->Push( result );
835
836 if( !arg || arg->AsString().IsEmpty() )
837 {
838 if( aCtx->HasErrorCallback() )
839 aCtx->ReportError( MISSING_SHEET_ARG( wxT( "memberOfSheet()" ) ) );
840
841 return;
842 }
843
844 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
845 BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
846
847 if( !item )
848 return;
849
850 result->SetDeferredEval(
851 [item, arg]() -> double
852 {
853 FOOTPRINT* fp = item->GetParentFootprint();
854
855 if( !fp )
856 return 0.0;
857
858 if( fp->GetSheetname().Matches( arg->AsString() ) )
859 return 1.0;
860
861 if( ( arg->AsString().Matches( wxT( "/" ) ) || arg->AsString().IsEmpty() )
862 && fp->GetSheetname().IsEmpty() )
863 {
864 return 1.0;
865 }
866
867 return 0.0;
868 } );
869}
870
871
872#define MISSING_REF_ARG( f ) \
873 wxString::Format( _( "Missing footprint argument (reference designator) to %s." ), f )
874
875static void memberOfFootprintFunc( LIBEVAL::CONTEXT* aCtx, void* self )
876{
877 LIBEVAL::VALUE* arg = aCtx->Pop();
878 LIBEVAL::VALUE* result = aCtx->AllocValue();
879
880 result->Set( 0.0 );
881 aCtx->Push( result );
882
883 if( !arg || arg->AsString().IsEmpty() )
884 {
885 if( aCtx->HasErrorCallback() )
886 aCtx->ReportError( MISSING_REF_ARG( wxT( "memberOfFootprint()" ) ) );
887
888 return;
889 }
890
891 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
892 BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
893
894 if( !item )
895 return;
896
897 result->SetDeferredEval(
898 [item, arg]() -> double
899 {
900 ;
901
902 if( FOOTPRINT* parentFP = item->GetParentFootprint() )
903 {
904 if( parentFP->GetReference().Matches( arg->AsString() ) )
905 return 1.0;
906 }
907
908 return 0.0;
909 } );
910}
911
912
913static void isMicroVia( LIBEVAL::CONTEXT* aCtx, void* self )
914{
915 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
916 BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
917 LIBEVAL::VALUE* result = aCtx->AllocValue();
918
919 result->Set( 0.0 );
920 aCtx->Push( result );
921
922 if( item && item->Type() == PCB_VIA_T
923 && static_cast<PCB_VIA*>( item )->GetViaType() == VIATYPE::MICROVIA )
924 {
925 result->Set ( 1.0 );
926 }
927}
928
929
930static void isBlindBuriedViaFunc( LIBEVAL::CONTEXT* aCtx, void* self )
931{
932 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
933 BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
934 LIBEVAL::VALUE* result = aCtx->AllocValue();
935
936 result->Set( 0.0 );
937 aCtx->Push( result );
938
939 if( item && item->Type() == PCB_VIA_T
940 && static_cast<PCB_VIA*>( item )->GetViaType() == VIATYPE::MICROVIA )
941 {
942 result->Set ( 1.0 );
943 }
944}
945
946
947static void isCoupledDiffPairFunc( LIBEVAL::CONTEXT* aCtx, void* self )
948{
949 PCBEXPR_CONTEXT* context = static_cast<PCBEXPR_CONTEXT*>( aCtx );
950 BOARD_CONNECTED_ITEM* a = dynamic_cast<BOARD_CONNECTED_ITEM*>( context->GetItem( 0 ) );
951 BOARD_CONNECTED_ITEM* b = dynamic_cast<BOARD_CONNECTED_ITEM*>( context->GetItem( 1 ) );
952 LIBEVAL::VALUE* result = aCtx->AllocValue();
953
954 result->Set( 0.0 );
955 aCtx->Push( result );
956
957 result->SetDeferredEval(
958 [a, b, context]() -> double
959 {
960 NETINFO_ITEM* netinfo = a ? a->GetNet() : nullptr;
961
962 if( !netinfo )
963 return 0.0;
964
965 wxString coupledNet;
966 wxString dummy;
967
968 if( !DRC_ENGINE::MatchDpSuffix( netinfo->GetNetname(), coupledNet, dummy ) )
969 return 0.0;
970
973 {
974 // DRC engine evaluates these singly, so we won't have a B item
975 return 1.0;
976 }
977
978 return b && b->GetNetname() == coupledNet;
979 } );
980}
981
982
983#define MISSING_DP_ARG( f ) \
984 wxString::Format( _( "Missing diff-pair name argument to %s." ), f )
985
986static void inDiffPairFunc( LIBEVAL::CONTEXT* aCtx, void* self )
987{
988 LIBEVAL::VALUE* argv = aCtx->Pop();
989 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
990 BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
991 LIBEVAL::VALUE* result = aCtx->AllocValue();
992
993 result->Set( 0.0 );
994 aCtx->Push( result );
995
996 if( !argv || argv->AsString().IsEmpty() )
997 {
998 if( aCtx->HasErrorCallback() )
999 aCtx->ReportError( MISSING_DP_ARG( wxT( "inDiffPair()" ) ) );
1000
1001 return;
1002 }
1003
1004 if( !item || !item->GetBoard() )
1005 return;
1006
1007 result->SetDeferredEval(
1008 [item, argv]() -> double
1009 {
1010 if( item && item->IsConnected() )
1011 {
1012 NETINFO_ITEM* netinfo = static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNet();
1013
1014 if( !netinfo )
1015 return 0.0;
1016
1017 wxString refName = netinfo->GetNetname();
1018 wxString arg = argv->AsString();
1019 wxString baseName, coupledNet;
1020 int polarity = DRC_ENGINE::MatchDpSuffix( refName, coupledNet, baseName );
1021
1022 if( polarity != 0 && item->GetBoard()->FindNet( coupledNet ) )
1023 {
1024 if( baseName.Matches( arg ) )
1025 return 1.0;
1026
1027 if( baseName.EndsWith( "_" ) && baseName.BeforeLast( '_' ).Matches( arg ) )
1028 return 1.0;
1029 }
1030 }
1031
1032 return 0.0;
1033 } );
1034}
1035
1036
1037static void getFieldFunc( LIBEVAL::CONTEXT* aCtx, void* self )
1038{
1039 LIBEVAL::VALUE* arg = aCtx->Pop();
1040 PCBEXPR_VAR_REF* vref = static_cast<PCBEXPR_VAR_REF*>( self );
1041 BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
1042 LIBEVAL::VALUE* result = aCtx->AllocValue();
1043
1044 result->Set( "" );
1045 aCtx->Push( result );
1046
1047 if( !arg )
1048 {
1049 if( aCtx->HasErrorCallback() )
1050 {
1051 aCtx->ReportError( wxString::Format( _( "Missing field name argument to %s." ),
1052 wxT( "getField()" ) ) );
1053 }
1054
1055 return;
1056 }
1057
1058 if( !item || !item->GetBoard() )
1059 return;
1060
1061 result->SetDeferredEval(
1062 [item, arg]() -> wxString
1063 {
1064 if( item && item->Type() == PCB_FOOTPRINT_T )
1065 {
1066 FOOTPRINT* fp = static_cast<FOOTPRINT*>( item );
1067
1068 PCB_FIELD* field = fp->GetFieldByName( arg->AsString() );
1069
1070 if( field )
1071 return field->GetText();
1072 }
1073
1074 return "";
1075 } );
1076}
1077
1078
1080{
1082}
1083
1084
1086{
1087 m_funcs.clear();
1088
1089 RegisterFunc( wxT( "existsOnLayer('x')" ), existsOnLayerFunc );
1090
1091 RegisterFunc( wxT( "isPlated()" ), isPlatedFunc );
1092
1093 RegisterFunc( wxT( "insideCourtyard('x') DEPRECATED" ), intersectsCourtyardFunc );
1094 RegisterFunc( wxT( "insideFrontCourtyard('x') DEPRECATED" ), intersectsFrontCourtyardFunc );
1095 RegisterFunc( wxT( "insideBackCourtyard('x') DEPRECATED" ), intersectsBackCourtyardFunc );
1096 RegisterFunc( wxT( "intersectsCourtyard('x')" ), intersectsCourtyardFunc );
1097 RegisterFunc( wxT( "intersectsFrontCourtyard('x')" ), intersectsFrontCourtyardFunc );
1098 RegisterFunc( wxT( "intersectsBackCourtyard('x')" ), intersectsBackCourtyardFunc );
1099
1100 RegisterFunc( wxT( "insideArea('x') DEPRECATED" ), intersectsAreaFunc );
1101 RegisterFunc( wxT( "intersectsArea('x')" ), intersectsAreaFunc );
1102 RegisterFunc( wxT( "enclosedByArea('x')" ), enclosedByAreaFunc );
1103
1104 RegisterFunc( wxT( "isMicroVia()" ), isMicroVia );
1105 RegisterFunc( wxT( "isBlindBuriedVia()" ), isBlindBuriedViaFunc );
1106
1107 RegisterFunc( wxT( "memberOf('x') DEPRECATED" ), memberOfGroupFunc );
1108 RegisterFunc( wxT( "memberOfGroup('x')" ), memberOfGroupFunc );
1109 RegisterFunc( wxT( "memberOfFootprint('x')" ), memberOfFootprintFunc );
1110 RegisterFunc( wxT( "memberOfSheet('x')" ), memberOfSheetFunc );
1111
1112 RegisterFunc( wxT( "fromTo('x','y')" ), fromToFunc );
1113 RegisterFunc( wxT( "isCoupledDiffPair()" ), isCoupledDiffPairFunc );
1114 RegisterFunc( wxT( "inDiffPair('x')" ), inDiffPairFunc );
1115
1116 RegisterFunc( wxT( "getField('x')" ), getFieldFunc );
1117}
1118
1119
constexpr int ARC_LOW_DEF
Definition: base_units.h:120
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
NETINFO_ITEM * GetNet() const
Return #NET_INFO object for a given item.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:77
virtual bool IsConnected() const
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
Definition: board_item.h:134
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:91
virtual void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
Convert the item shape to a closed polygon.
Definition: board_item.cpp:204
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
Definition: board_item.h:290
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: board_item.cpp:227
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:45
FOOTPRINT * GetParentFootprint() const
Definition: board_item.cpp:247
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:230
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:203
virtual std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const
Definition: board_item.cpp:237
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:276
std::unordered_map< PTR_PTR_LAYER_CACHE_KEY, bool > m_EnclosedByAreaCache
Definition: board.h:1230
ZONES & Zones()
Definition: board.h:324
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1621
FOOTPRINTS & Footprints()
Definition: board.h:318
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsCourtyardCache
Definition: board.h:1226
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsFCourtyardCache
Definition: board.h:1227
std::unordered_map< wxString, LSET > m_LayerExpressionCache
Definition: board.h:1231
std::unordered_map< PTR_PTR_CACHE_KEY, bool > m_IntersectsBCourtyardCache
Definition: board.h:1228
std::unordered_map< ZONE *, std::unique_ptr< DRC_RTREE > > m_CopperZoneRTreeCache
Definition: board.h:1232
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:745
std::mutex m_CachesMutex
Definition: board.h:1225
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:441
static int MatchDpSuffix(const wxString &aNetName, wxString &aComplementNet, wxString &aBaseDpName)
Check if the given net is a diff pair, returning its polarity and complement if so.
Implement an R-tree for fast spatial and layer indexing of connectable items.
Definition: drc_rtree.h:48
int QueryColliding(BOARD_ITEM *aRefItem, PCB_LAYER_ID aRefLayer, PCB_LAYER_ID aTargetLayer, std::function< bool(BOARD_ITEM *)> aFilter=nullptr, std::function< bool(BOARD_ITEM *)> aVisitor=nullptr, int aClearance=0) const
This is a fast test which essentially does bounding-box overlap given a worst-case clearance.
Definition: drc_rtree.h:214
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:74
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:126
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:95
static ENUM_MAP< T > & Instance()
Definition: property.h:640
PCB_FIELD * GetFieldByName(const wxString &aFieldName)
Return a field in this symbol.
Definition: footprint.cpp:294
wxString GetSheetname() const
Definition: footprint.h:245
const SHAPE_POLY_SET & GetCourtyard(PCB_LAYER_ID aLayer) const
Used in DRC to test the courtyard area (a complex polygon).
Definition: footprint.cpp:2480
Definition: kiid.h:49
static bool SniffTest(const wxString &aCandidate)
Returns true if a string has the correct formatting to be a KIID.
Definition: kiid.cpp:179
void ReportError(const wxString &aErrorMsg)
void Push(VALUE *v)
void Set(double aValue)
virtual const wxString & AsString() const
void SetDeferredEval(std::function< double()> aLambda)
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:556
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:418
bool Contains(PCB_LAYER_ID aLayer)
See if the layer set contains a PCB layer.
Definition: layer_ids.h:628
static LSET FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
Definition: lset.cpp:904
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
Definition: lset.cpp:911
Handle the data for a net.
Definition: netinfo.h:56
const wxString & GetNetname() const
Definition: netinfo.h:114
Definition: pad.h:58
void RegisterFunc(const wxString &funcSignature, LIBEVAL::FUNC_CALL_REF funcPtr)
std::map< wxString, LIBEVAL::FUNC_CALL_REF > m_funcs
int GetConstraint() const
PCB_LAYER_ID GetLayer() const
BOARD_ITEM * GetItem(int index) const
BOARD_ITEM * GetObject(const LIBEVAL::CONTEXT *aCtx) const
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
Represent a set of closed polygons.
void ClearArcs()
Removes all arc references from all the outlines and holes in the polyset.
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,...
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
void Deflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError)
int OutlineCount() const
Return the number of outlines in the set.
SHAPE_POLY_SET CloneDropTriangulation() const
Handle a list of polygons defining a copper zone.
Definition: zone.h:72
const BOX2I GetBoundingBox() const override
Definition: zone.cpp:354
bool IsFilled() const
Definition: zone.h:249
SHAPE_POLY_SET * Outline()
Definition: zone.h:325
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.h:129
@ ALLOW_ACUTE_CORNERS
just inflate the polygon. Acute angles create spikes
@ LENGTH_CONSTRAINT
Definition: drc_rule.h:64
@ SKEW_CONSTRAINT
Definition: drc_rule.h:65
#define _(s)
#define ROUTER_TRANSIENT
transient items that should NOT be cached
#define HOLE_PROXY
Indicates the BOARD_ITEM is a proxy for its hole.
#define MALFORMED_COURTYARDS
@ ERROR_OUTSIDE
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ F_CrtYd
Definition: layer_ids.h:118
@ B_Cu
Definition: layer_ids.h:96
@ B_CrtYd
Definition: layer_ids.h:117
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
@ F_Cu
Definition: layer_ids.h:65
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:941
@ PTH
Plated through hole pad.
Class to handle a set of BOARD_ITEMs.
static void intersectsFrontCourtyardFunc(LIBEVAL::CONTEXT *aCtx, void *self)
#define MISSING_SHEET_ARG(f)
bool collidesWithCourtyard(BOARD_ITEM *aItem, std::shared_ptr< SHAPE > &aItemShape, PCBEXPR_CONTEXT *aCtx, FOOTPRINT *aFootprint, PCB_LAYER_ID aSide)
#define MISSING_LAYER_ARG(f)
static void intersectsBackCourtyardFunc(LIBEVAL::CONTEXT *aCtx, void *self)
bool collidesWithArea(BOARD_ITEM *aItem, PCBEXPR_CONTEXT *aCtx, ZONE *aArea)
static void memberOfGroupFunc(LIBEVAL::CONTEXT *aCtx, void *self)
#define MISSING_AREA_ARG(f)
static void isCoupledDiffPairFunc(LIBEVAL::CONTEXT *aCtx, void *self)
static void isPlatedFunc(LIBEVAL::CONTEXT *aCtx, void *self)
bool searchAreas(BOARD *aBoard, const wxString &aArg, PCBEXPR_CONTEXT *aCtx, const std::function< bool(ZONE *)> &aFunc)
static void existsOnLayerFunc(LIBEVAL::CONTEXT *aCtx, void *self)
#define MISSING_GROUP_ARG(f)
static void isBlindBuriedViaFunc(LIBEVAL::CONTEXT *aCtx, void *self)
static void memberOfSheetFunc(LIBEVAL::CONTEXT *aCtx, void *self)
#define MISSING_REF_ARG(f)
#define MISSING_DP_ARG(f)
static void enclosedByAreaFunc(LIBEVAL::CONTEXT *aCtx, void *self)
static void memberOfFootprintFunc(LIBEVAL::CONTEXT *aCtx, void *self)
static void isMicroVia(LIBEVAL::CONTEXT *aCtx, void *self)
static void getFieldFunc(LIBEVAL::CONTEXT *aCtx, void *self)
bool fromToFunc(LIBEVAL::CONTEXT *aCtx, void *self)
static void intersectsCourtyardFunc(LIBEVAL::CONTEXT *aCtx, void *self)
static bool searchFootprints(BOARD *aBoard, const wxString &aArg, PCBEXPR_CONTEXT *aCtx, const std::function< bool(FOOTPRINT *)> &aFunc)
static void inDiffPairFunc(LIBEVAL::CONTEXT *aCtx, void *self)
static void intersectsAreaFunc(LIBEVAL::CONTEXT *aCtx, void *self)
#define MISSING_FP_ARG(f)
std::vector< FAB_LAYER_COLOR > dummy
VECTOR3I res
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:95
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:105
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87