From cd476e1728799e0f8045e59fa48edf85bb6dcc41 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 6 Jul 2021 13:57:47 +0200 Subject: [PATCH] Gerber plotter: ensure filled areas using thick outlines have a closed outline. Fixes #8735 https://gitlab.com/kicad/code/kicad/issues/8735 --- pcbnew/plot_brditems_plotter.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 864325f58a..c5e118f00f 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -805,6 +805,17 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET& { m_plotter->PlotPoly( outline, FILL_TYPE::NO_FILL, outline_thickness, &gbr_metadata ); + + // Ensure the outline is closed: + int last_idx = outline.PointCount() - 1; + + if( outline.CPoint( 0 ) != outline.CPoint( last_idx ) ) + { + m_plotter->ThickSegment( wxPoint( outline.CPoint( 0 ) ), + wxPoint( outline.CPoint( last_idx ) ), + outline_thickness, + GetPlotMode(), &gbr_metadata ); + } } static_cast( m_plotter )->PlotGerberRegion( @@ -820,13 +831,24 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET& { if( outline_thickness ) { - for( int jj = 1; jj < outline.PointCount(); jj++ ) + int last_idx = outline.PointCount() - 1; + + for( int jj = 1; jj <= last_idx; jj++ ) { m_plotter->ThickSegment( wxPoint( outline.CPoint( jj - 1) ), wxPoint( outline.CPoint( jj ) ), outline_thickness, GetPlotMode(), &gbr_metadata ); } + + // Ensure the outline is closed: + if( outline.CPoint( 0 ) != outline.CPoint( last_idx ) ) + { + m_plotter->ThickSegment( wxPoint( outline.CPoint( 0 ) ), + wxPoint( outline.CPoint( last_idx ) ), + outline_thickness, + GetPlotMode(), &gbr_metadata ); + } } m_plotter->SetCurrentLineWidth( -1 );