From 7de0159e0e5ebf18b63c043948b958cd381610ba Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 18 Feb 2022 18:09:02 +0100 Subject: [PATCH] pcbnew: fix incorrect calculation of the board thickness from board stackup. dielectric sub layers were not taken in account. Fixes #10899 https://gitlab.com/kicad/code/kicad/issues/10899 --- pcbnew/board_stackup_manager/board_stackup.cpp | 9 +++++++++ pcbnew/board_stackup_manager/panel_board_stackup.cpp | 4 +++- pcbnew/board_stackup_manager/panel_board_stackup.h | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pcbnew/board_stackup_manager/board_stackup.cpp b/pcbnew/board_stackup_manager/board_stackup.cpp index a10730dbde..cecb817762 100644 --- a/pcbnew/board_stackup_manager/board_stackup.cpp +++ b/pcbnew/board_stackup_manager/board_stackup.cpp @@ -371,7 +371,16 @@ int BOARD_STACKUP::BuildBoardThicknessFromStackup() const for( BOARD_STACKUP_ITEM* item : m_list ) { if( item->IsThicknessEditable() && item->IsEnabled() ) + { thickness += item->GetThickness(); + + // dielectric layers can have more than one main layer + // add thickness of all sublayers + for( int idx = 1; idx < item->GetSublayersCount(); idx++ ) + { + thickness += item->GetThickness( idx ); + } + } } return thickness; diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.cpp b/pcbnew/board_stackup_manager/panel_board_stackup.cpp index b276bee5a0..d8a55ee4ed 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.cpp +++ b/pcbnew/board_stackup_manager/panel_board_stackup.cpp @@ -428,7 +428,7 @@ wxColor PANEL_SETUP_BOARD_STACKUP::GetSelectedColor( int aRow ) const } -void PANEL_SETUP_BOARD_STACKUP::computeBoardThickness() +int PANEL_SETUP_BOARD_STACKUP::computeBoardThickness() { int thickness = 0; @@ -451,6 +451,8 @@ void PANEL_SETUP_BOARD_STACKUP::computeBoardThickness() // The text in the event will translate to the value for the text control // and is only updated if it changed m_tcCTValue->ChangeValue( thicknessStr ); + + return thickness; } diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.h b/pcbnew/board_stackup_manager/panel_board_stackup.h index 1e2ac81009..99de0a5d5e 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.h +++ b/pcbnew/board_stackup_manager/panel_board_stackup.h @@ -185,8 +185,9 @@ private: /** * Recompute the board thickness and update the textbox + * @return the computed value */ - void computeBoardThickness(); + int computeBoardThickness(); void onColorSelected( wxCommandEvent& event ); void onMaterialChange( wxCommandEvent& event );