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