pcb_io_kicad_sexpr_parser.cpp: init a default board stackup only if no stackup

is defined, and only after the enabled layers are defined.
Fixes #16754
https://gitlab.com/kicad/code/kicad/-/issues/16754
This commit is contained in:
jean-pierre charras 2024-01-28 14:17:00 +01:00
parent dd022c44e7
commit 06d63a2aa0
1 changed files with 9 additions and 5 deletions

View File

@ -2018,11 +2018,6 @@ void PCB_IO_KICAD_SEXPR_PARSER::parseSetup()
// not the default value (0.25mm)
bds.m_SolderMaskMinWidth = 0;
// Set up a default stackup in case the file doesn't define one
BOARD_STACKUP& stackup = bds.GetStackupDescriptor();
stackup.RemoveAll();
stackup.BuildDefaultStackupList( &bds, m_board->GetCopperLayerCount() );
for( T token = NextTok(); token != T_RIGHT; token = NextTok() )
{
if( token != T_LEFT )
@ -2362,6 +2357,15 @@ void PCB_IO_KICAD_SEXPR_PARSER::parseSetup()
Unexpected( CurText() );
}
}
// Set up a default stackup in case the file doesn't define one, and now we know
// the enabled layers
if( ! m_board->GetDesignSettings().m_HasStackup )
{
BOARD_STACKUP& stackup = bds.GetStackupDescriptor();
stackup.RemoveAll();
stackup.BuildDefaultStackupList( &bds, m_board->GetCopperLayerCount() );
}
}