From 5d8def9055f0a5bc3256e2133ba1b556acdb35ff Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 7 Jul 2025 18:48:30 +0100 Subject: [PATCH] Don't assert inner layer in Footprint Editor (KICAD-STX). --- pcbnew/padstack.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pcbnew/padstack.cpp b/pcbnew/padstack.cpp index 2432fbbfcf..65fd2e36f1 100644 --- a/pcbnew/padstack.cpp +++ b/pcbnew/padstack.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -990,21 +991,21 @@ PCB_LAYER_ID PADSTACK::EffectiveLayerFor( PCB_LAYER_ID aLayer ) const return INNER_LAYERS; // Custom padstack: Clamp to parent board's stackup if present - if( m_parent ) + BOARD* board = m_parent ? m_parent->GetBoard() : nullptr; + + if( board && !board->GetEnabledLayers().Contains( boardCuLayer ) ) { - LSET boardCopper = m_parent->BoardLayerSet() & LSET::AllCuMask(); - - if( boardCopper.Contains( boardCuLayer ) ) - return boardCuLayer; - // We're asked for an inner copper layer not present in the board. There is no right // answer here, so fall back on the front shape - wxFAIL_MSG( "Asked for inner padstack layer not present on the board" ); + + // Lots of people get around our "single-inner-layer" in footprint editor, so only + // assert if in the PCB editor. + if( !board->IsFootprintHolder() ) + wxFAIL_MSG( "Asked for inner padstack layer not present on the board" ); return ALL_LAYERS; } - // No parent, just pass through return boardCuLayer; }