Handle multiple holes in footprints

Our basic logic for whether we have a hole or an outline in a footprint
checks if there is copper pads outside of the closed edge.  This misses
the case where the footprint is used to align multiple holes but has no
copper.  Since we do not support multiple outlines in a board, we can
safely assume that multiple, closed edges in a footprint represent holes
and not outlines

Fixes https://gitlab.com/kicad/code/kicad/issues/14468

(cherry picked from commit 4b91c0c8ee)
This commit is contained in:
Seth Hillbrand 2023-04-20 14:54:00 -07:00
parent 9a0e2f3395
commit a2ad9f8b10
1 changed files with 7 additions and 2 deletions

View File

@ -652,7 +652,11 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, int aE
// gets an opportunity to use these segments
nullptr );
if( success && isCopperOutside( fp, fpOutlines ) )
// Here, we test to see if we should make holes or outlines. Holes are made if the footprint
// has copper outside of a single, closed outline. If there are multiple outlines, we assume
// that the footprint edges represent holes as we do not support multiple boards. Similarly, if
// any of the footprint pads are located outside of the edges, then the edges are holes
if( success && ( isCopperOutside( fp, fpOutlines ) || fpOutlines.OutlineCount() > 1 ) )
{
fpHoles.Append( fpOutlines );
}
@ -904,7 +908,8 @@ bool BuildFootprintPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, in
wxLogTrace( traceBoardOutline, wxT( "Closed outline found" ) );
// If copper is outside a closed polygon, treat it as a hole
if( isCopperOutside( footprint, outlines ) )
// If there are multiple outlines in the footprint, they are also holes
if( isCopperOutside( footprint, outlines ) || outlines.OutlineCount() > 1 )
{
wxLogTrace( traceBoardOutline, wxT( "Treating outline as a hole" ) );