CADSTAR PCB Importer: Ignore construction layers on outer surfaces
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14443
This commit is contained in:
parent
aaeb8ca739
commit
d5bc223ff2
|
@ -232,8 +232,7 @@ std::vector<std::unique_ptr<FOOTPRINT>> CADSTAR_PCB_ARCHIVE_LOADER::LoadLibrary(
|
|||
}
|
||||
|
||||
|
||||
void CADSTAR_PCB_ARCHIVE_LOADER::logBoardStackupWarning(
|
||||
const wxString& aCadstarLayerName,
|
||||
void CADSTAR_PCB_ARCHIVE_LOADER::logBoardStackupWarning( const wxString& aCadstarLayerName,
|
||||
const PCB_LAYER_ID& aKiCadLayer )
|
||||
{
|
||||
if( m_logLayerWarnings )
|
||||
|
@ -300,6 +299,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup()
|
|||
|
||||
std::vector<LAYER_BLOCK> cadstarBoardStackup;
|
||||
LAYER_BLOCK currentBlock;
|
||||
bool first = true;
|
||||
|
||||
// Find the electrical and construction (dielectric) layers in the stackup
|
||||
for( LAYER_ID cadstarLayerID : Assignments.Layerdefs.LayerStack )
|
||||
|
@ -317,10 +317,21 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup()
|
|||
}
|
||||
|
||||
currentBlock.ElecLayerID = cadstarLayerID;
|
||||
first = false;
|
||||
}
|
||||
else if( cadstarLayer.Type == LAYER_TYPE::CONSTRUCTION )
|
||||
{
|
||||
currentBlock.ConstructionLayers.push_back( cadstarLayerID );
|
||||
if( first )
|
||||
{
|
||||
wxLogWarning( wxString::Format( _( "The CADSTAR construction layer '%s' is on "
|
||||
"the outer surface of the board. It has been "
|
||||
"ignored." ),
|
||||
cadstarLayer.Name ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
currentBlock.ConstructionLayers.push_back( cadstarLayerID );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,12 +340,20 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup()
|
|||
|
||||
m_numCopperLayers = cadstarBoardStackup.size();
|
||||
|
||||
// Special case: last layer in the stackup is a construction layer, we need to use B.Cu as a
|
||||
// dummy layer
|
||||
// Special case: last layer in the stackup is a construction layer, drop it
|
||||
if( cadstarBoardStackup.back().ConstructionLayers.size() > 0 )
|
||||
{
|
||||
cadstarBoardStackup.push_back( LAYER_BLOCK() ); //Add dummy layer at the end
|
||||
++m_numCopperLayers;
|
||||
for( const LAYER_ID& layerID : cadstarBoardStackup.back().ConstructionLayers )
|
||||
{
|
||||
LAYER cadstarLayer = Assignments.Layerdefs.Layers.at( layerID );
|
||||
|
||||
wxLogWarning( wxString::Format( _( "The CADSTAR construction layer '%s' is on "
|
||||
"the outer surface of the board. It has been "
|
||||
"ignored." ),
|
||||
cadstarLayer.Name ) );
|
||||
}
|
||||
|
||||
cadstarBoardStackup.back().ConstructionLayers.clear();
|
||||
}
|
||||
|
||||
// Make sure it is an even number of layers (KiCad doesn't yet support unbalanced stack-ups)
|
||||
|
@ -347,21 +366,27 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadBoardStackup()
|
|||
cadstarBoardStackup.pop_back();
|
||||
|
||||
LAYER_BLOCK dummyLayer;
|
||||
LAYER_ID lastConstruction = secondToLastLayer.ConstructionLayers.back();
|
||||
|
||||
if( secondToLastLayer.ConstructionLayers.size() > 1 )
|
||||
if( secondToLastLayer.ConstructionLayers.size() > 0 )
|
||||
{
|
||||
// At least two construction layers, lets remove it here and use it in the dummy layer
|
||||
secondToLastLayer.ConstructionLayers.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
// There is only one construction layer, lets halve its thickness so it is split evenly
|
||||
// between this layer and the dummy layer
|
||||
Assignments.Layerdefs.Layers.at( lastConstruction ).Thickness /= 2;
|
||||
LAYER_ID lastConstruction = secondToLastLayer.ConstructionLayers.back();
|
||||
|
||||
if( secondToLastLayer.ConstructionLayers.size() > 1 )
|
||||
{
|
||||
// At least two construction layers, lets remove one here and use the
|
||||
// other in the dummy layer
|
||||
secondToLastLayer.ConstructionLayers.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
// There is only one construction layer, lets halve its thickness so it is split
|
||||
// evenly between this layer and the dummy layer
|
||||
Assignments.Layerdefs.Layers.at( lastConstruction ).Thickness /= 2;
|
||||
}
|
||||
|
||||
dummyLayer.ConstructionLayers.push_back( lastConstruction );
|
||||
}
|
||||
|
||||
dummyLayer.ConstructionLayers.push_back( lastConstruction );
|
||||
cadstarBoardStackup.push_back( secondToLastLayer );
|
||||
cadstarBoardStackup.push_back( dummyLayer );
|
||||
cadstarBoardStackup.push_back( bottomLayer );
|
||||
|
|
Loading…
Reference in New Issue