From b3ce23f0e22efa71ddabe57b5c76ab4fa012238d Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Fri, 19 Jun 2020 23:33:29 +0200 Subject: [PATCH] PCB_EXPR_EVALUATOR: implement isPlated virtual property --- pcbnew/pcb_expr_evaluator.cpp | 16 ++++++++++++++++ ...pp => drc_test_provider_copper_clearance.cpp} | 0 2 files changed, 16 insertions(+) rename qa/drc_proto/{drc_clearance_test.cpp => drc_test_provider_copper_clearance.cpp} (100%) diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index ad35488e1d..848356f322 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -55,11 +55,27 @@ class PCB_EXPR_BUILTIN_FUNCTIONS rv->Set( value ? 1.0 : 0.0 ); aCtx->Push( rv ); } + + static void isPlated( LIBEVAL::UCODE* aUcode, LIBEVAL::UCODE::CONTEXT* aCtx, void *self ) + { + auto vref = static_cast( self ); + auto item = vref->GetObject(aUcode); + bool result = false; + if( item->Type() == PCB_PAD_T ) + { + auto pad = static_cast( item ); + result = pad->GetAttribute() == PAD_ATTRIB_STANDARD; + } + auto rv = aCtx->AllocValue(); + rv->Set( result ? 1.0 : 0.0 ); + aCtx->Push( rv ); + } }; PCB_EXPR_BUILTIN_FUNCTIONS::PCB_EXPR_BUILTIN_FUNCTIONS() { m_funcs[ "onlayer" ] = onLayer; + m_funcs[ "isplated" ] = isPlated; } BOARD_ITEM* PCB_EXPR_VAR_REF::GetObject( LIBEVAL::UCODE* aUcode ) const diff --git a/qa/drc_proto/drc_clearance_test.cpp b/qa/drc_proto/drc_test_provider_copper_clearance.cpp similarity index 100% rename from qa/drc_proto/drc_clearance_test.cpp rename to qa/drc_proto/drc_test_provider_copper_clearance.cpp