Browse Source

Pcbnew: fix an issue that prevent to write the right layer type in brd files

In layers block, the file type for User.n was always written as "user" type.
However this type can be set to "front" or "back" by the board settings
dialog (Off-board, front or Off-board, back) and allowed in file.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20892
pull/18/head
jean-pierre charras 5 months ago
parent
commit
db23ee481c
  1. 16
      pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp

16
pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp

@ -684,10 +684,24 @@ void PCB_IO_KICAD_SEXPR::formatBoardLayers( const BOARD* aBoard ) const
for( PCB_LAYER_ID layer : seq )
{
bool print_type = false;
// User layers (layer id >= User_1) have a qualifier
// default is "user", but other qualifiers exist
if( layer >= User_1 )
{
if( IsCopperLayer( layer ) )
print_type = true;
if( aBoard->GetLayerType( layer ) == LT_FRONT
|| aBoard->GetLayerType( layer ) == LT_BACK )
print_type = true;
}
m_out->Print( "(%d %s %s %s)",
layer,
m_out->Quotew( LSET::Name( layer ) ).c_str(),
layer >= User_1 && IsCopperLayer( layer )
print_type
? LAYER::ShowType( aBoard->GetLayerType( layer ) )
: "user",
m_board->GetLayerName( layer ) == LSET::Name( layer )

Loading…
Cancel
Save