From fb3859642f6d44e9933f8d3ec94c7cce734f8d77 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 28 Aug 2018 17:48:13 +0200 Subject: [PATCH] Pcbnew, Plot: fix incorrect plot of custom shapes, when the shape has holes (missing holes). Fixes: lp:1789404 https://bugs.launchpad.net/kicad/+bug/1789404 --- pcbnew/pad_custom_shape_functions.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pcbnew/pad_custom_shape_functions.cpp b/pcbnew/pad_custom_shape_functions.cpp index f4bf5d965d..53d01287ef 100644 --- a/pcbnew/pad_custom_shape_functions.cpp +++ b/pcbnew/pad_custom_shape_functions.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -92,7 +92,12 @@ void D_PAD::AddPrimitive( const SHAPE_POLY_SET& aPoly, int aThickness ) { std::vector points; - for( auto iter = aPoly.CIterate(); iter; iter++ ) + // If aPoly has holes, convert it to a polygon with no holes. + SHAPE_POLY_SET poly_no_hole; + poly_no_hole.Append( aPoly ); + poly_no_hole.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); + + for( auto iter = poly_no_hole.CIterate(); iter; iter++ ) points.push_back( wxPoint( iter->x, iter->y ) ); AddPrimitive( points, aThickness );