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,13 +307,14 @@ std::vector<PCB_LAYER_ID> ALTIUM_PCB::GetKicadLayersToIterate( ALTIUM_LAYER aAlt
{
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;
layers.reserve( MAX_CU_LAYERS ); // TODO: only use Cu layers which are on the board
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 ) )
layers.reserve( MAX_CU_LAYERS );
for( PCB_LAYER_ID layer : LSET::AllCuMask().Seq() )
{
if( m_board->IsLayerEnabled( layer ) )
layers.emplace_back( layer );
}
@ -2046,11 +2047,9 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItem( const AREGION6& aElem )
if( aElem.subpolyindex == ALTIUM_POLYGON_NONE )
{
for( PCB_LAYER_ID klayer : GetKicadLayersToIterate( aElem.layer ) )
{
ConvertShapeBasedRegions6ToBoardItemOnLayer( aElem, klayer );
}
}
}
else
{
wxLogError( _( "Ignored polygon shape of kind %d (not yet supported)." ), aElem.kind );
@ -2107,10 +2106,12 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItem( FOOTPRINT* aFoot
if( aElem.subpolyindex == ALTIUM_POLYGON_NONE )
{
for( PCB_LAYER_ID klayer : GetKicadLayersToIterate( aElem.layer ) )
{
ConvertShapeBasedRegions6ToFootprintItemOnLayer( aFootprint, aElem, klayer,
aPrimitiveIndex );
}
}
}
else if( aElem.kind == ALTIUM_REGION_KIND::DASHED_OUTLINE )
{
PCB_LAYER_ID klayer = GetKicadLayer( aElem.layer );
@ -3143,10 +3144,8 @@ void ALTIUM_PCB::ConvertTracks6ToBoardItem( const ATRACK6& aElem, const int aPri
else
{
for( PCB_LAYER_ID klayer : GetKicadLayersToIterate( aElem.layer ) )
{
ConvertTracks6ToBoardItemOnLayer( aElem, klayer );
}
}
for( const auto layerExpansionMask : HelperGetSolderAndPasteMaskExpansions(
ALTIUM_RECORD::TRACK, aPrimitiveIndex, aElem.layer ) )
@ -3595,12 +3594,6 @@ void ALTIUM_PCB::ConvertFills6ToFootprintItemOnLayer( FOOTPRINT* aFootprint, con
void ALTIUM_PCB::HelperSetZoneLayers( ZONE* aZone, const ALTIUM_LAYER aAltiumLayer )
{
if( aAltiumLayer == ALTIUM_LAYER::MULTI_LAYER || aAltiumLayer == ALTIUM_LAYER::KEEP_OUT_LAYER )
{
aZone->SetLayerSet( LSET::AllCuMask() );
}
else
{
LSET layerSet;
@ -3609,7 +3602,6 @@ void ALTIUM_PCB::HelperSetZoneLayers( ZONE* aZone, const ALTIUM_LAYER aAltiumLay
aZone->SetLayerSet( layerSet );
}
}
void ALTIUM_PCB::HelperSetZoneKeepoutRestrictions( ZONE* aZone, const uint8_t aKeepoutRestrictions )