From 4b2d801fec4b3f503e98723cab5395bcaa1c654b Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 11 Oct 2019 20:59:23 +0200 Subject: [PATCH] Gerber file export: avoid duplicate corner when creating polygons (regions in Gerber dialect) Fixes: lp:1847714 https://bugs.launchpad.net/kicad/+bug/1847714 --- common/plotters/GERBER_plotter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp index ba33b0f1b8..405222e5ad 100644 --- a/common/plotters/GERBER_plotter.cpp +++ b/common/plotters/GERBER_plotter.cpp @@ -561,7 +561,10 @@ void GERBER_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) LineTo( aCornerList[ii] ); - FinishTo( aCornerList[0] ); + // If the polygon is not closed, close it: + if( aCornerList[0] != aCornerList[aCornerList.size()-1] ) + FinishTo( aCornerList[0] ); + fputs( "G37*\n", outputFile ); }