From df3924421d0fcf5be6038610ec2b42dee2678955 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 15 Jun 2024 17:51:56 +0100 Subject: [PATCH] enclosedByArea test for zone needs to be outline-based. (Otherwise it's order-specific when filling, which is pretty unpredictable.) Fixes https://gitlab.com/kicad/code/kicad/-/issues/18202 (cherry picked from commit 5ba289696881a7e2102eb79a6aff94c9e3b8b120) --- pcbnew/pcbexpr_functions.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pcbnew/pcbexpr_functions.cpp b/pcbnew/pcbexpr_functions.cpp index 4b638fa0c9..de3792f7f0 100644 --- a/pcbnew/pcbexpr_functions.cpp +++ b/pcbnew/pcbexpr_functions.cpp @@ -772,8 +772,15 @@ static void enclosedByAreaFunc( LIBEVAL::CONTEXT* aCtx, void* self ) SHAPE_POLY_SET itemShape; bool enclosedByArea; - item->TransformShapeToPolygon( itemShape, layer, 0, maxError, - ERROR_OUTSIDE ); + if( item->Type() == PCB_ZONE_T ) + { + itemShape = *static_cast( item )->Outline(); + } + else + { + item->TransformShapeToPolygon( itemShape, layer, 0, maxError, + ERROR_OUTSIDE ); + } if( itemShape.IsEmpty() ) {