Browse Source

pcbnew: Fracture polygons before plotting

While not technically allowed, overlapping polygons can be drawn in
pcbnew.  Gerber polygons are strictly simple, however, so we need to
fracture prior to exporting to avoid invalid gerbers.
pull/13/head
Seth Hillbrand 7 years ago
parent
commit
ec93fb3171
  1. 9
      pcbnew/plot_brditems_plotter.cpp

9
pcbnew/plot_brditems_plotter.cpp

@ -792,9 +792,14 @@ void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg )
// Draw the polygon: only one polygon is expected
// However we provide a multi polygon shape drawing
// ( for the future or to show a non expected shape )
for( int jj = 0; jj < aSeg->GetPolyShape().OutlineCount(); ++jj )
// This must be simplified and fractured to prevent overlapping polygons
// from generating invalid Gerber files
auto tmpPoly = SHAPE_POLY_SET( aSeg->GetPolyShape() );
tmpPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj )
{
SHAPE_LINE_CHAIN& poly = aSeg->GetPolyShape().Outline( jj );
SHAPE_LINE_CHAIN& poly = tmpPoly.Outline( jj );
m_plotter->PlotPoly( poly, FILLED_SHAPE, thickness, &gbr_metadata );
}
}

Loading…
Cancel
Save