CADSTAR Archive Importer: Only load the Master variant

This commit is contained in:
Roberto Fernandez Bautista 2020-11-21 12:55:58 +00:00 committed by jean-pierre charras
parent e3334cd25c
commit 71f9847601
4 changed files with 19 additions and 11 deletions

View File

@ -92,9 +92,10 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( ::SCHEMATIC* aSchematic, ::SCH_SHEET* aRo
if( Schematic.VariantHierarchy.Variants.size() > 0 )
{
wxLogWarning(
_( "The CADSTAR design contains variants which has no KiCad equivalent. All "
"components have been loaded on top of each other. " ) );
wxLogWarning( wxString::Format(
_( "The CADSTAR design contains variants which has no KiCad equivalent. Only "
"the master variant ('%s') was loaded." ),
Schematic.VariantHierarchy.Variants.at( "V0" ).Name ) );
}
if( Schematic.Groups.size() > 0 )
@ -317,6 +318,9 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
{
SYMBOL sym = symPair.second;
if( !sym.VariantID.empty() && sym.VariantParentSymbolID != sym.ID )
continue; // Only load master Variant
if( sym.IsComponent )
{
if( mPartMap.find( sym.PartRef.RefID ) == mPartMap.end() )

View File

@ -650,8 +650,8 @@ void CADSTAR_SCH_ARCHIVE_PARSER::SYMBOL::Parse( XNODE* aNode )
}
else if( cNodeName == wxT( "VSYMMASTER" ) )
{
VariantParentSymbolID = GetXmlAttributeIDString( aNode, 0 );
VariantID = GetXmlAttributeIDString( aNode, 1 );
VariantParentSymbolID = GetXmlAttributeIDString( cNode, 0 );
VariantID = GetXmlAttributeIDString( cNode, 1 );
}
else if( cNodeName == wxT( "GROUPREF" ) )
{

View File

@ -107,9 +107,10 @@ void CADSTAR_PCB_ARCHIVE_LOADER::Load( ::BOARD* aBoard )
if( Layout.VariantHierarchy.Variants.size() > 0 )
{
wxLogWarning(
_( "The CADSTAR design contains variants which has no KiCad equivalent. All "
"components have been loaded on top of each other. " ) );
wxLogWarning( wxString::Format(
_( "The CADSTAR design contains variants which has no KiCad equivalent. Only "
"the master variant ('%s') was loaded." ),
Layout.VariantHierarchy.Variants.at( "V0" ).Name ) );
}
if( Layout.ReuseBlocks.size() > 0 )
@ -1192,7 +1193,10 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponents()
{
for( std::pair<COMPONENT_ID, COMPONENT> compPair : Layout.Components )
{
COMPONENT& comp = compPair.second;
COMPONENT& comp = compPair.second;
if( !comp.VariantID.empty() && comp.VariantParentComponentID != comp.ID )
continue; // Only load master Variant
auto fpIter = mLibraryMap.find( comp.SymdefID );

View File

@ -1846,8 +1846,8 @@ void CADSTAR_PCB_ARCHIVE_PARSER::COMPONENT::Parse( XNODE* aNode )
}
else if( cNodeName == wxT( "VCOMPMASTER" ) )
{
VariantParentComponentID = GetXmlAttributeIDString( aNode, 0 );
VariantID = GetXmlAttributeIDString( aNode, 1 );
VariantParentComponentID = GetXmlAttributeIDString( cNode, 0 );
VariantID = GetXmlAttributeIDString( cNode, 1 );
}
else if( cNodeName == wxT( "TEXTLOC" ) )
{