Ensure better smoothing for zones clipped by board edges.

This commit is contained in:
Jeff Young 2020-11-19 18:34:30 +00:00
parent 826e47dde3
commit 203c860f01
2 changed files with 8 additions and 6 deletions

View File

@ -1177,11 +1177,13 @@ bool ZONE::BuildSmoothedPoly( SHAPE_POLY_SET& aSmoothedPoly, PCB_LAYER_ID aLayer
} }
BOARD* board = GetBoard(); BOARD* board = GetBoard();
int edgeClearance = 0;
int maxError = ARC_HIGH_DEF; int maxError = ARC_HIGH_DEF;
bool keepExternalFillets = false; bool keepExternalFillets = false;
if( board ) if( board )
{ {
edgeClearance = board->GetDesignSettings().m_CopperEdgeClearance;
maxError = board->GetDesignSettings().m_MaxError; maxError = board->GetDesignSettings().m_MaxError;
keepExternalFillets = board->GetDesignSettings().m_ZoneKeepExternalFillets; 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 ); aSmoothedPoly.BooleanAdd( *zone->Outline(), SHAPE_POLY_SET::PM_FAST );
if( !GetIsRuleArea() && aBoardOutline ) 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 ); smooth( aSmoothedPoly );
if( aSmoothedPolyWithApron ) if( aSmoothedPolyWithApron )
{ {
SHAPE_POLY_SET bufferedExtents = *maxExtents; SHAPE_POLY_SET bufferedExtents = *maxExtents;
bufferedExtents.Inflate( m_ZoneMinThickness, 8 ); bufferedExtents.Inflate( m_ZoneMinThickness, 16 );
*aSmoothedPolyWithApron = aSmoothedPoly; *aSmoothedPolyWithApron = aSmoothedPoly;
aSmoothedPolyWithApron->BooleanIntersection( bufferedExtents, SHAPE_POLY_SET::PM_FAST ); aSmoothedPolyWithApron->BooleanIntersection( bufferedExtents, SHAPE_POLY_SET::PM_FAST );
} }

View File

@ -664,10 +664,6 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
return aReporter && ( ticker++ % 50 ) == 0 && aReporter->IsCancelled(); 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 // 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 // requested clearance due to many approximations in calculations, like arc to segment
// approx, rounding issues, etc. // approx, rounding issues, etc.