diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index ccdf646706..5a689cfe73 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -210,6 +211,43 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self ) } +static void isMicroVia( LIBEVAL::CONTEXT* aCtx, void* self ) +{ + PCB_EXPR_VAR_REF* vref = static_cast( self ); + BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; + LIBEVAL::VALUE* result = aCtx->AllocValue(); + + result->Set( 0.0 ); + aCtx->Push( result ); + + auto via = dyn_cast( item ); + + if( via && via->GetViaType() == VIATYPE::MICROVIA ) + { + result->Set ( 1.0 ); + } +} + + +static void isBlindBuriedVia( LIBEVAL::CONTEXT* aCtx, void* self ) +{ + PCB_EXPR_VAR_REF* vref = static_cast( self ); + BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; + LIBEVAL::VALUE* result = aCtx->AllocValue(); + + result->Set( 0.0 ); + aCtx->Push( result ); + + auto via = dyn_cast( item ); + + if( via && via->GetViaType() == VIATYPE::BLIND_BURIED ) + { + result->Set ( 1.0 ); + } + +} + + PCB_EXPR_BUILTIN_FUNCTIONS::PCB_EXPR_BUILTIN_FUNCTIONS() { auto registerFunc = [&]( const wxString& funcSignature, LIBEVAL::FUNC_CALL_REF funcPtr ) @@ -223,6 +261,8 @@ PCB_EXPR_BUILTIN_FUNCTIONS::PCB_EXPR_BUILTIN_FUNCTIONS() registerFunc( "isPlated()", isPlated ); registerFunc( "insideCourtyard('x')", insideCourtyard ); registerFunc( "insideArea('x')", insideArea ); + registerFunc( "isMicroVia()", isMicroVia ); + registerFunc( "isBlindBuriedVia()", isBlindBuriedVia ); }