altium: Fix handling of odd layercount (otherwise, saved *.kicad_pcb file would no longer load)
This commit is contained in:
parent
919a66a703
commit
a29e55fe7e
|
@ -500,7 +500,8 @@ void ALTIUM_PCB::ParseBoard6Data(
|
||||||
for( size_t i = static_cast<size_t>( ALTIUM_LAYER::TOP_LAYER );
|
for( size_t i = static_cast<size_t>( ALTIUM_LAYER::TOP_LAYER );
|
||||||
i < elem.stackup.size() && i != 0; i = elem.stackup[i - 1].nextId, layercount++ )
|
i < elem.stackup.size() && i != 0; i = elem.stackup[i - 1].nextId, layercount++ )
|
||||||
;
|
;
|
||||||
m_board->SetCopperLayerCount( layercount );
|
size_t kicadLayercount = layercount % 2 == 0 ? layercount : layercount + 1;
|
||||||
|
m_board->SetCopperLayerCount( kicadLayercount );
|
||||||
|
|
||||||
BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings();
|
BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings();
|
||||||
BOARD_STACKUP& stackup = designSettings.GetStackupDescriptor();
|
BOARD_STACKUP& stackup = designSettings.GetStackupDescriptor();
|
||||||
|
@ -519,6 +520,25 @@ void ALTIUM_PCB::ParseBoard6Data(
|
||||||
i < elem.stackup.size() && i != 0; i = elem.stackup[i - 1].nextId, layercount++ )
|
i < elem.stackup.size() && i != 0; i = elem.stackup[i - 1].nextId, layercount++ )
|
||||||
{
|
{
|
||||||
auto layer = elem.stackup.at( i - 1 ); // array starts with 0, but stackup with 1
|
auto layer = elem.stackup.at( i - 1 ); // array starts with 0, but stackup with 1
|
||||||
|
|
||||||
|
// handle unused layer
|
||||||
|
if( i == elem.stackup.size() - 1 && layercount != kicadLayercount )
|
||||||
|
{
|
||||||
|
if( ( *it )->GetType() != BS_ITEM_TYPE_COPPER )
|
||||||
|
{
|
||||||
|
THROW_IO_ERROR( "Board6 stream, unexpected item while parsing stackup" );
|
||||||
|
}
|
||||||
|
( *it )->SetThickness( 0 );
|
||||||
|
|
||||||
|
++it;
|
||||||
|
if( ( *it )->GetType() != BS_ITEM_TYPE_DIELECTRIC )
|
||||||
|
{
|
||||||
|
THROW_IO_ERROR( "Board6 stream, unexpected item while parsing stackup" );
|
||||||
|
}
|
||||||
|
( *it )->SetThickness( 0, 0 );
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
m_layermap.insert(
|
m_layermap.insert(
|
||||||
{ static_cast<ALTIUM_LAYER>( i ), static_cast<PCB_LAYER_ID>( curLayer++ ) } );
|
{ static_cast<ALTIUM_LAYER>( i ), static_cast<PCB_LAYER_ID>( curLayer++ ) } );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue