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