CADSTAR Schematic: Load symbols even if part definition is incomplete
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11671
(cherry picked from commit 8725c3a35f
)
This commit is contained in:
parent
32a11e4df0
commit
a3da0b9af6
|
@ -369,9 +369,6 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary()
|
||||||
PART_ID partID = partPair.first;
|
PART_ID partID = partPair.first;
|
||||||
PART part = partPair.second;
|
PART part = partPair.second;
|
||||||
|
|
||||||
if( part.Definition.GateSymbols.size() == 0 )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
wxString escapedPartName = EscapeString( part.Name, CTX_LIBID );
|
wxString escapedPartName = EscapeString( part.Name, CTX_LIBID );
|
||||||
LIB_SYMBOL* kiPart = new LIB_SYMBOL( escapedPartName );
|
LIB_SYMBOL* kiPart = new LIB_SYMBOL( escapedPartName );
|
||||||
|
|
||||||
|
@ -383,7 +380,6 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary()
|
||||||
GATE_ID gateID = gatePair.first;
|
GATE_ID gateID = gatePair.first;
|
||||||
PART::DEFINITION::GATE gate = gatePair.second;
|
PART::DEFINITION::GATE gate = gatePair.second;
|
||||||
SYMDEF_ID symbolID = getSymDefFromName( gate.Name, gate.Alternate );
|
SYMDEF_ID symbolID = getSymDefFromName( gate.Name, gate.Alternate );
|
||||||
m_partSymbolsMap.insert( { { partID, gateID }, symbolID } );
|
|
||||||
|
|
||||||
if( symbolID.IsEmpty() )
|
if( symbolID.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -400,10 +396,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_partSymbolsMap.insert( { { partID, gateID }, symbolID } );
|
||||||
loadSymDefIntoLibrary( symbolID, &part, gateID, kiPart );
|
loadSymDefIntoLibrary( symbolID, &part, gateID, kiPart );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ok )
|
if( ok && part.Definition.GateSymbols.size() != 0 )
|
||||||
{
|
{
|
||||||
( *m_plugin )->SaveSymbol( m_libraryFileName.GetFullPath(), kiPart );
|
( *m_plugin )->SaveSymbol( m_libraryFileName.GetFullPath(), kiPart );
|
||||||
|
|
||||||
|
@ -414,8 +411,19 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if( part.Definition.GateSymbols.size() == 0 )
|
||||||
|
{
|
||||||
|
m_reporter->Report(
|
||||||
|
wxString::Format( _( "Part definition '%s' has an incomplete definition (no"
|
||||||
|
" symbol definitions are associated with it). The part"
|
||||||
|
" has not been loaded into the KiCad library." ),
|
||||||
|
part.Name ),
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
|
}
|
||||||
|
|
||||||
// Don't save in the library, but still keep it cached as some of the units might have
|
// Don't save in the library, but still keep it cached as some of the units might have
|
||||||
// been loaded correctly (saving us time later on)
|
// been loaded correctly (saving us time later on), plus the part definition contains
|
||||||
|
// the part name, which is important to load
|
||||||
m_partMap.insert( { partID, kiPart } );
|
m_partMap.insert( { partID, kiPart } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1603,17 +1611,19 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString fpNameInLibrary = generateLibName( footprintRefName, footprintAlternateName );
|
wxString fpNameInLibrary = generateLibName( footprintRefName, footprintAlternateName );
|
||||||
|
|
||||||
|
if( !fpNameInLibrary.IsEmpty() )
|
||||||
|
{
|
||||||
wxArrayString fpFilters;
|
wxArrayString fpFilters;
|
||||||
fpFilters.Add( fpNameInLibrary );
|
fpFilters.Add( fpNameInLibrary );
|
||||||
|
|
||||||
aSymbol->SetFPFilters( fpFilters );
|
aSymbol->SetFPFilters( fpFilters );
|
||||||
|
|
||||||
// Assume that the PCB footprint library name will be the same as the schematic filename
|
// Assume that the PCB footprint library name will be the same as the schematic filename
|
||||||
wxFileName schFilename( Filename );
|
wxFileName schFilename( Filename );
|
||||||
wxString libName = schFilename.GetName();
|
wxString libName = schFilename.GetName();
|
||||||
|
|
||||||
aSymbol->GetFootprintField().SetText( libName + wxT( ":" ) + fpNameInLibrary );
|
aSymbol->GetFootprintField().SetText( libName + wxT( ":" ) + fpNameInLibrary );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( aCadstarPart && aCadstarPart->Definition.HidePinNames )
|
if( aCadstarPart && aCadstarPart->Definition.HidePinNames )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue