Don't import Altium objects to disabled layers.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15586

(cherry picked from commit 962f79334f)
This commit is contained in:
Jeff Young 2023-09-14 17:15:15 +01:00
parent 0eca698a39
commit a5f8955d78
1 changed files with 12 additions and 20 deletions

View File

@ -307,14 +307,15 @@ std::vector<PCB_LAYER_ID> ALTIUM_PCB::GetKicadLayersToIterate( ALTIUM_LAYER aAlt
{ {
static std::set<ALTIUM_LAYER> altiumLayersWithWarning; static std::set<ALTIUM_LAYER> altiumLayersWithWarning;
if( aAltiumLayer == ALTIUM_LAYER::MULTI_LAYER ) if( aAltiumLayer == ALTIUM_LAYER::MULTI_LAYER || aAltiumLayer == ALTIUM_LAYER::KEEP_OUT_LAYER )
{ {
std::vector<PCB_LAYER_ID> layers; std::vector<PCB_LAYER_ID> layers;
layers.reserve( MAX_CU_LAYERS ); // TODO: only use Cu layers which are on the board layers.reserve( MAX_CU_LAYERS );
for( PCB_LAYER_ID layer = PCB_LAYER_ID::F_Cu; layer <= PCB_LAYER_ID::B_Cu;
layer = static_cast<PCB_LAYER_ID>( static_cast<int>( layer ) + 1 ) ) for( PCB_LAYER_ID layer : LSET::AllCuMask().Seq() )
{ {
layers.emplace_back( layer ); if( m_board->IsLayerEnabled( layer ) )
layers.emplace_back( layer );
} }
return layers; return layers;
@ -2046,9 +2047,7 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItem( const AREGION6& aElem )
if( aElem.subpolyindex == ALTIUM_POLYGON_NONE ) if( aElem.subpolyindex == ALTIUM_POLYGON_NONE )
{ {
for( PCB_LAYER_ID klayer : GetKicadLayersToIterate( aElem.layer ) ) for( PCB_LAYER_ID klayer : GetKicadLayersToIterate( aElem.layer ) )
{
ConvertShapeBasedRegions6ToBoardItemOnLayer( aElem, klayer ); ConvertShapeBasedRegions6ToBoardItemOnLayer( aElem, klayer );
}
} }
} }
else else
@ -2107,8 +2106,10 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItem( FOOTPRINT* aFoot
if( aElem.subpolyindex == ALTIUM_POLYGON_NONE ) if( aElem.subpolyindex == ALTIUM_POLYGON_NONE )
{ {
for( PCB_LAYER_ID klayer : GetKicadLayersToIterate( aElem.layer ) ) for( PCB_LAYER_ID klayer : GetKicadLayersToIterate( aElem.layer ) )
{
ConvertShapeBasedRegions6ToFootprintItemOnLayer( aFootprint, aElem, klayer, ConvertShapeBasedRegions6ToFootprintItemOnLayer( aFootprint, aElem, klayer,
aPrimitiveIndex ); aPrimitiveIndex );
}
} }
} }
else if( aElem.kind == ALTIUM_REGION_KIND::DASHED_OUTLINE ) else if( aElem.kind == ALTIUM_REGION_KIND::DASHED_OUTLINE )
@ -3143,9 +3144,7 @@ void ALTIUM_PCB::ConvertTracks6ToBoardItem( const ATRACK6& aElem, const int aPri
else else
{ {
for( PCB_LAYER_ID klayer : GetKicadLayersToIterate( aElem.layer ) ) for( PCB_LAYER_ID klayer : GetKicadLayersToIterate( aElem.layer ) )
{
ConvertTracks6ToBoardItemOnLayer( aElem, klayer ); ConvertTracks6ToBoardItemOnLayer( aElem, klayer );
}
} }
for( const auto layerExpansionMask : HelperGetSolderAndPasteMaskExpansions( for( const auto layerExpansionMask : HelperGetSolderAndPasteMaskExpansions(
@ -3596,19 +3595,12 @@ void ALTIUM_PCB::ConvertFills6ToFootprintItemOnLayer( FOOTPRINT* aFootprint, con
void ALTIUM_PCB::HelperSetZoneLayers( ZONE* aZone, const ALTIUM_LAYER aAltiumLayer ) void ALTIUM_PCB::HelperSetZoneLayers( ZONE* aZone, const ALTIUM_LAYER aAltiumLayer )
{ {
if( aAltiumLayer == ALTIUM_LAYER::MULTI_LAYER || aAltiumLayer == ALTIUM_LAYER::KEEP_OUT_LAYER ) LSET layerSet;
{
aZone->SetLayerSet( LSET::AllCuMask() );
}
else
{
LSET layerSet;
for( PCB_LAYER_ID klayer : GetKicadLayersToIterate( aAltiumLayer ) ) for( PCB_LAYER_ID klayer : GetKicadLayersToIterate( aAltiumLayer ) )
layerSet.set( klayer ); layerSet.set( klayer );
aZone->SetLayerSet( layerSet ); aZone->SetLayerSet( layerSet );
}
} }