← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] GAL: Draw hole even if pad has no layer

 

Le 24/06/2018 à 21:52, Wayne Stambaugh a écrit :
> Are we planning on fixing this for rc3?  If so, what is required.  I'm fine with waiting a day or
> two to tag rc3.
> 

Attached a possible fix.

The board test file shows really broken layer set in a few pads:
- no layers for some pads (the layers section is empty).
This make no sense for me.

After tests, It is not possible to create this empty layer set from Pcbnew (even with old 2013
stable version).

My opinion is the board (or the footprints) was modified by hand (or by a script).

This patch is short and fixes silently this kind of issues.
(I am not sure it is worth to try a better fix, because this issue cannot happens when editing a
board from pcbnew)

-- 
Jean-Pierre CHARRAS
 pcbnew/pcb_parser.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp
index bacf543e8..5baeffdd9 100644
--- a/pcbnew/pcb_parser.cpp
+++ b/pcbnew/pcb_parser.cpp
@@ -2468,6 +2468,19 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent )
         case T_layers:
             {
                 LSET layerMask = parseBoardItemLayersAsMask();
+
+                // Protect layer set against malformed (modifed by hand) layer list:
+                if( !layerMask.any() )
+                    // No layer set: keep the default mask.
+                    // This is similar to the case layers section is missing
+                    break;
+
+                // Through hole pads must be on all copper layers, to correctly define
+                // clearance parameters ( area size and layer )
+                if( ( pad->GetAttribute() == PAD_ATTRIB_STANDARD ) ||
+                    ( pad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED ) )
+                    layerMask |= LSET::AllCuMask( MAX_CU_LAYERS );
+
                 pad->SetLayerSet( layerMask );
             }
             break;

Follow ups

References