From 7ceff4cf5df0a77ba03604f18ac8459d1de12898 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 8 Apr 2019 13:10:08 +0100 Subject: [PATCH] Trim zone fills to board outline. Fixes: lp:1820306 * https://bugs.launchpad.net/kicad/+bug/1820306 (cherry picked from commit 52e3a1d7c40d27ab855cf8b7ed46af3345e0ca58) --- pcbnew/zone_filler.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 457b0d0e86..e648ced775 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -190,7 +190,7 @@ bool ZONE_FILLER::Fill( std::vector aZones, bool aCheck ) connectivity->SetProgressReporter( m_progressReporter ); connectivity->FindIsolatedCopperIslands( toFill ); - // Now remove insulated copper islands + // Now remove insulated copper islands and islands outside the board edge bool outOfDate = false; for( auto& zone : toFill ) @@ -198,7 +198,7 @@ bool ZONE_FILLER::Fill( std::vector aZones, bool aCheck ) std::sort( zone.m_islands.begin(), zone.m_islands.end(), std::greater() ); SHAPE_POLY_SET poly = zone.m_zone->GetFilledPolysList(); - // only zones with net code > 0 can have islands to remove by definition + // only zones with net code > 0 can have insulated islands by definition if( zone.m_zone->GetNetCode() > 0 ) { for( auto idx : zone.m_islands ) @@ -207,6 +207,11 @@ bool ZONE_FILLER::Fill( std::vector aZones, bool aCheck ) } } + SHAPE_POLY_SET boardOutline; + + if( m_board->GetBoardPolygonOutlines( boardOutline ) ) + poly.BooleanIntersection( boardOutline, SHAPE_POLY_SET::PM_FAST ); + zone.m_zone->SetFilledPolysList( poly ); if( aCheck && zone.m_zone->GetHashValue() != poly.GetHash() )