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
This commit is contained in:
jean-pierre charras 2022-02-18 18:09:02 +01:00
parent 6f6cf995ba
commit 7de0159e0e
3 changed files with 14 additions and 2 deletions

View File

@ -371,7 +371,16 @@ int BOARD_STACKUP::BuildBoardThicknessFromStackup() const
for( BOARD_STACKUP_ITEM* item : m_list ) for( BOARD_STACKUP_ITEM* item : m_list )
{ {
if( item->IsThicknessEditable() && item->IsEnabled() ) if( item->IsThicknessEditable() && item->IsEnabled() )
{
thickness += item->GetThickness(); 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; return thickness;

View File

@ -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; 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 // The text in the event will translate to the value for the text control
// and is only updated if it changed // and is only updated if it changed
m_tcCTValue->ChangeValue( thicknessStr ); m_tcCTValue->ChangeValue( thicknessStr );
return thickness;
} }

View File

@ -185,8 +185,9 @@ private:
/** /**
* Recompute the board thickness and update the textbox * Recompute the board thickness and update the textbox
* @return the computed value
*/ */
void computeBoardThickness(); int computeBoardThickness();
void onColorSelected( wxCommandEvent& event ); void onColorSelected( wxCommandEvent& event );
void onMaterialChange( wxCommandEvent& event ); void onMaterialChange( wxCommandEvent& event );