altium: Fix Reference and Description parsing of footprint

This commit is contained in:
Thomas Pointhuber 2022-02-06 16:23:46 +01:00
parent 41b6c9bf8f
commit 79f80c4cd7
1 changed files with 19 additions and 3 deletions

View File

@ -685,8 +685,24 @@ FOOTPRINT* ALTIUM_PCB::ParseFootprint( const ALTIUM_COMPOUND_FILE& altiumLibFile
LIB_ID fpID = AltiumToKiCadLibID( "", footprintName ); // TODO: library name
footprint->SetFPID( fpID );
footprint->SetDescription( wxT( "Test Description for " ) + aFootprintName + wxT( " - " ) + footprintName );
footprint->SetReference( wxT( "UNK" ) ); // TODO: extract
std::string parametersStreamName = aFootprintName.ToStdString() + "\\Parameters";
const CFB::COMPOUND_FILE_ENTRY* parametersData =
altiumLibFile.FindStream( parametersStreamName );
if( parametersData != nullptr )
{
ALTIUM_PARSER parametersReader( altiumLibFile, parametersData );
std::map<wxString, wxString> parameterProperties = parametersReader.ReadProperties();
wxString description =
ALTIUM_PARSER::ReadString( parameterProperties, wxT( "DESCRIPTION" ), wxT( "" ) );
footprint->SetDescription( description );
}
else
{
wxLogError( _( "File not found: '%s'." ), parametersStreamName );
footprint->SetDescription( wxT( "" ) );
}
footprint->SetReference( wxT( "REF**" ) );
footprint->SetValue( footprintName );
footprint->Reference().SetVisible( true ); // TODO: extract visibility information
footprint->Value().SetVisible( true );
@ -3414,4 +3430,4 @@ void ALTIUM_PCB::HelperPcpShapeAsFootprintKeepoutRegion( FOOTPRINT* aFootp
// TODO: zone->SetLocalCoord(); missing?
aFootprint->Add( zone, ADD_MODE::APPEND );
}
}