7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Strip extra library data when importing Altium

Altium stores (or can store) full information about the absolute
location of libraries for each footprint in their board files.  Since
KiCad only stores an alias, we have no place to keep the full path.
Just keeping the filename should be enough for most cases and still
allows the user to disambiguate manually after import without crowding
the UI.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15593
This commit is contained in:
Seth Hillbrand 2025-01-12 17:05:12 -08:00
parent 82c1118679
commit e4d2dbb7a7

View File

@ -1290,7 +1290,7 @@ void ALTIUM_PCB::ParseClasses6Data( const ALTIUM_PCB_COMPOUND_FILE& aAltiumP
}
void ALTIUM_PCB::ParseComponents6Data( const ALTIUM_PCB_COMPOUND_FILE& aAltiumPcbFile,
void ALTIUM_PCB::ParseComponents6Data( const ALTIUM_PCB_COMPOUND_FILE& aAltiumPcbFile,
const CFB::COMPOUND_FILE_ENTRY* aEntry )
{
if( m_progressReporter )
@ -1307,7 +1307,13 @@ void ALTIUM_PCB::ParseComponents6Data( const ALTIUM_PCB_COMPOUND_FILE& aAlti
std::unique_ptr<FOOTPRINT> footprint = std::make_unique<FOOTPRINT>( m_board );
LIB_ID fpID = AltiumToKiCadLibID( elem.sourcefootprintlibrary, elem.pattern );
// Altium stores the footprint library information needed to find the footprint in the
// source library in the sourcefootprintlibrary field. Since Altium is a Windows-only
// program, the path separator is always a backslash. We need strip the extra path information
// here to prevent overly-long LIB_IDs because KiCad doesn't store the full path to the
// footprint library in the design file, only in a library table.
wxFileName libName( elem.sourcefootprintlibrary, wxPATH_WIN );
LIB_ID fpID = AltiumToKiCadLibID( libName.GetName(), elem.pattern );
footprint->SetFPID( fpID );