Merge branch 'cadstar_layerpairs' into 'master'

Cadstar importer: ignore layerpairs that are not supported

See merge request kicad/code/kicad!2247
This commit is contained in:
Lucas Gerads 2025-09-11 23:41:54 +00:00
commit 63126ba3de
3 changed files with 28 additions and 2 deletions

View File

@ -141,6 +141,16 @@ void CADSTAR_PCB_ARCHIVE_LOADER::Load( BOARD* aBoard, PROJECT* aProject )
loadNets();
loadTextVariables();
for( const auto& UnsupportedLayerPair : Assignments.Codedefs.UnsupportedLayerPairs )
{
auto id = UnsupportedLayerPair.first;
auto type = UnsupportedLayerPair.second.UnsupportedChildID;
wxLogWarning( wxString::Format(
_( "The CADSTAR layerpair '%s' of type '%s' "
"is not supported by the KiCad importer and will be ignored" ),
id, type ) );
}
if( Layout.Trunks.size() > 0 )
{
wxLogWarning(

View File

@ -300,7 +300,19 @@ void CADSTAR_PCB_ARCHIVE_PARSER::CODEDEFS_PCB::Parse( XNODE* aNode, PARSER_CONTE
{
LAYERPAIR layerpair;
layerpair.Parse( cNode, aContext );
LayerPairs.insert( std::make_pair( layerpair.ID, layerpair ) );
if( layerpair.UnsupportedChildID.IsEmpty() )
{
LayerPairs.insert( std::make_pair( layerpair.ID, layerpair ) );
}
else
{
// keeping track of unsupported layerpairs such as "MANUAL" to warn
// the user after the import that they are ignored
// hoping that ignoring those layerpairs will not cause any problems
// further down during the import
UnsupportedLayerPairs.insert( std::make_pair( layerpair.ID, layerpair ) );
}
}
else if( nodeName == wxT( "SPCCLASSSPACE" ) )
{
@ -927,7 +939,8 @@ void CADSTAR_PCB_ARCHIVE_PARSER::LAYERPAIR::Parse( XNODE* aNode, PARSER_CONTEXT*
}
else
{
THROW_UNKNOWN_NODE_IO_ERROR( aNode->GetChildren()->GetName(), location );
UnsupportedChildID = aNode->GetChildren()->GetName();
// THROW_UNKNOWN_NODE_IO_ERROR( aNode->GetChildren()->GetName(), location );
}
CheckNoNextNodes( aNode->GetChildren() );

View File

@ -68,6 +68,7 @@ public:
typedef wxString COPPERCODE_ID;
typedef wxString PADCODE_ID;
typedef wxString VIACODE_ID;
typedef wxString LAYERPAIR_UNSUPPORTED_CHILD_ID;
typedef wxString SPACINGCODE_ID;
typedef wxString LAYERPAIR_ID;
typedef wxString RULESET_ID;
@ -354,6 +355,7 @@ public:
PHYSICAL_LAYER_ID PhysicalLayerStart;
PHYSICAL_LAYER_ID PhysicalLayerEnd;
VIACODE_ID ViacodeID;
LAYERPAIR_UNSUPPORTED_CHILD_ID UnsupportedChildID;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
};
@ -398,6 +400,7 @@ public:
std::map<VIACODE_ID, VIACODE> ViaCodes;
std::map<LAYERPAIR_ID, LAYERPAIR>
LayerPairs; ///< Default vias to use between pairs of layers
std::map<LAYERPAIR_ID, LAYERPAIR> UnsupportedLayerPairs;
std::vector<SPCCLASSSPACE> SpacingClasses;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;