From 203c860f015eac3c2118c72d4aff47ad2cc12854 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 19 Nov 2020 18:34:30 +0000 Subject: [PATCH] Ensure better smoothing for zones clipped by board edges. --- pcbnew/zone.cpp | 10 ++++++++-- pcbnew/zone_filler.cpp | 4 ---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index 9eb09403e8..101790dd4d 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -1177,11 +1177,13 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer } BOARD* board = GetBoard(); + int edgeClearance = 0; int maxError = ARC_HIGH_DEF; bool keepExternalFillets = false; if( board ) { + edgeClearance = board->GetDesignSettings().m_CopperEdgeClearance; maxError = board->GetDesignSettings().m_MaxError; keepExternalFillets = board->GetDesignSettings().m_ZoneKeepExternalFillets; } @@ -1228,14 +1230,18 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer aSmoothedPoly.BooleanAdd( *zone->Outline(), SHAPE_POLY_SET::PM_FAST ); if( !GetIsRuleArea() && aBoardOutline ) - aSmoothedPoly.BooleanIntersection( *aBoardOutline, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); + { + SHAPE_POLY_SET bufferedOutline = *aBoardOutline; + bufferedOutline.Deflate( std::max( m_ZoneClearance, edgeClearance ), 16 ); + aSmoothedPoly.BooleanIntersection( bufferedOutline, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); + } smooth( aSmoothedPoly ); if( aSmoothedPolyWithApron ) { SHAPE_POLY_SET bufferedExtents = *maxExtents; - bufferedExtents.Inflate( m_ZoneMinThickness, 8 ); + bufferedExtents.Inflate( m_ZoneMinThickness, 16 ); *aSmoothedPolyWithApron = aSmoothedPoly; aSmoothedPolyWithApron->BooleanIntersection( bufferedExtents, SHAPE_POLY_SET::PM_FAST ); } diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 3e3ab04253..8a1dbea2fc 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -664,10 +664,6 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa return aReporter && ( ticker++ % 50 ) == 0 && aReporter->IsCancelled(); }; - static PCB_SHAPE dummyEdge; - dummyEdge.SetParent( m_board ); - dummyEdge.SetLayer( Edge_Cuts ); - // A small extra clearance to be sure actual track clearances are not smaller than // requested clearance due to many approximations in calculations, like arc to segment // approx, rounding issues, etc.