From a0fec9db577f96157695a070fd6391ee0e4c7ff5 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 25 Aug 2019 12:10:48 +0200 Subject: [PATCH] PCBNew - fix incorrect gerber generation for overlapping zones of the same net and having different draw options. Previously, zones of the same net were merged for plotting, regardless the fact the outline thickness can be different between the zones, creating incorrect solid areas. Fixes: lp:1840695 https://bugs.launchpad.net/kicad/+bug/1840695 --- pcbnew/plot_board_layers.cpp | 15 ++++++++++++++- pcbnew/plot_brditems_plotter.cpp | 9 ++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index a979b97308..bb5df56afe 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -8,7 +8,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2019 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 @@ -582,6 +582,19 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, if( candidate->GetNetCode() != zone->GetNetCode() ) continue; + // Merging zones of the same net can be done only for areas + // having compatible settings for drawings: + // use or not outline thickness, and if using outline thickness, + // having the same thickness + // becuase after merging only one outline thickness is used + if( candidate->GetFilledPolysUseThickness() != zone->GetFilledPolysUseThickness() ) + // Should not happens, because usually the same option is used for filling + continue; + + if( zone->GetFilledPolysUseThickness() && + ( candidate->GetMinThickness() != zone->GetMinThickness() ) ) + continue; + plotted.insert( candidate ); aggregateArea.BooleanAdd( candidate->GetFilledPolysList(), SHAPE_POLY_SET::PM_FAST ); } diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index f6afcd6c83..cf7718ba17 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -659,12 +659,13 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone, SHAPE_POLY_SET& p m_plotter->SetColor( getColor( aZone->GetLayer() ) ); /* Plot all filled areas: filled areas have a filled area and a thick - * outline we must plot the filled area itself ( as a filled polygon - * OR a set of segments ) and plot the thick outline itself, - * if the thickness has meaning (at least is > 1) + * outline (depending on the fill area option we must plot the filled area itself + * and plot the thick outline itself, if the thickness has meaning (at least is > 1) * * in non filled mode the outline is plotted, but not the filling items */ + int outline_thickness = aZone->GetFilledPolysUseThickness() ? aZone->GetMinThickness() : 0; + for( auto ic = polysList.CIterate(); ic; ++ic ) { wxPoint pos( ic->x, ic->y ); @@ -677,8 +678,6 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone, SHAPE_POLY_SET& p cornerList.push_back( cornerList[0] ); // Plot the current filled area and its outline - int outline_thickness = aZone->GetFilledPolysUseThickness() ? aZone->GetMinThickness() : 0; - if( GetPlotMode() == FILLED ) { m_plotter->PlotPoly( cornerList, FILLED_SHAPE, outline_thickness, &gbr_metadata );