ADDED: support for multiple footprints in the footprint json from HTTP libraries

These are semi-colon-separated.

This is different from the footprint_filters dict entry, which is space-separated.

The first footprint in the footprint dict entry
will go into the "Footprint" field, while the rest
will go into the symbol's footprint filters.

(cherry picked from commit 91405ae34d)
This commit is contained in:
Jeff Young
2025-09-15 18:09:25 +01:00
parent 35889130e8
commit 4e2f84727c
+13 -6
View File
@@ -405,14 +405,23 @@ LIB_SYMBOL* SCH_IO_HTTP_LIB::loadSymbolFromPart( const wxString& aSymbolName,
symbol->SetExcludedFromBoard( aPart.exclude_from_board );
symbol->SetExcludedFromSim( aPart.exclude_from_sim );
wxArrayString fp_filters;
for( auto& [fieldName, fieldProperties] : aPart.fields )
{
wxString lowerFieldName = wxString( fieldName ).Lower();
if( lowerFieldName == footprint_field )
{
SCH_FIELD* field = &symbol->GetFootprintField();
field->SetText( std::get<0>( fieldProperties ) );
SCH_FIELD* field = &symbol->GetFootprintField();
wxStringTokenizer tokenizer( std::get<0>( fieldProperties ), ';' );
while( tokenizer.HasMoreTokens() )
fp_filters.Add( tokenizer.GetNextToken() );
if( fp_filters.size() > 0 )
field->SetText( fp_filters[0] );
field->SetVisible( std::get<1>( fieldProperties ) );
}
else if( lowerFieldName == description_field )
@@ -476,12 +485,10 @@ LIB_SYMBOL* SCH_IO_HTTP_LIB::loadSymbolFromPart( const wxString& aSymbolName,
symbol->SetDescription( aPart.desc );
symbol->SetKeyWords( aPart.keywords );
wxArrayString filters;
for( const std::string& filter : aPart.fp_filters )
filters.push_back( filter );
fp_filters.push_back( filter );
symbol->SetFPFilters( filters );
symbol->SetFPFilters( fp_filters );
return symbol;
}