alitum: set layer name, fix handling of odd layercount

This commit is contained in:
Thomas Pointhuber 2020-04-15 16:01:02 +02:00 committed by Ian McInerney
parent ff5a0f61b2
commit 2703bd6b81
1 changed files with 9 additions and 4 deletions

View File

@ -500,7 +500,7 @@ 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++ )
; ;
size_t kicadLayercount = layercount % 2 == 0 ? layercount : layercount + 1; size_t kicadLayercount = ( layercount % 2 == 0 ) ? layercount : layercount + 1;
m_board->SetCopperLayerCount( kicadLayercount ); m_board->SetCopperLayerCount( kicadLayercount );
BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings();
@ -517,13 +517,15 @@ void ALTIUM_PCB::ParseBoard6Data(
auto curLayer = static_cast<int>( F_Cu ); auto curLayer = static_cast<int>( F_Cu );
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 )
{ {
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 // handle unused layer in case of odd layercount
if( i == elem.stackup.size() - 1 && layercount != kicadLayercount ) if( layer.nextId == 0 && layercount != kicadLayercount )
{ {
m_board->SetLayerName( ( *it )->GetBrdLayerId(), "[unused]" );
if( ( *it )->GetType() != BS_ITEM_TYPE_COPPER ) if( ( *it )->GetType() != BS_ITEM_TYPE_COPPER )
{ {
THROW_IO_ERROR( "Board6 stream, unexpected item while parsing stackup" ); THROW_IO_ERROR( "Board6 stream, unexpected item while parsing stackup" );
@ -536,6 +538,7 @@ void ALTIUM_PCB::ParseBoard6Data(
THROW_IO_ERROR( "Board6 stream, unexpected item while parsing stackup" ); THROW_IO_ERROR( "Board6 stream, unexpected item while parsing stackup" );
} }
( *it )->SetThickness( 0, 0 ); ( *it )->SetThickness( 0, 0 );
( *it )->SetThicknessLocked( true, 0 );
++it; ++it;
} }
@ -548,6 +551,8 @@ void ALTIUM_PCB::ParseBoard6Data(
} }
( *it )->SetThickness( layer.copperthick ); ( *it )->SetThickness( layer.copperthick );
m_board->SetLayerName( ( *it )->GetBrdLayerId(), layer.name );
if( ( *it )->GetBrdLayerId() == B_Cu ) if( ( *it )->GetBrdLayerId() == B_Cu )
{ {
if( layer.nextId != 0 ) if( layer.nextId != 0 )