Fix duplicate symbol value fields when importing Eagle schematic.

Don't use the value field when adding Eagle part attributes to a symbol.
This issue was cause by using a mandatory symbol field ID instead of
using the next available field ID when adding new fields to as symbol.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13468
This commit is contained in:
Wayne Stambaugh 2023-02-04 12:37:24 -05:00
parent 729be64850
commit 52b07b8bac
1 changed files with 13 additions and 4 deletions

View File

@ -1717,10 +1717,19 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
for( const auto& a : epart->attribute )
{
SCH_FIELD* field = symbol->AddField( *symbol->GetField( VALUE_FIELD ) );
field->SetName( a.first );
field->SetText( a.second );
field->SetVisible( false );
VECTOR2I newFieldPosition( 0, 0 );
SCH_FIELD* lastField = symbol->GetFieldById( symbol->GetFieldCount() - 1 );
if( lastField )
newFieldPosition = lastField->GetPosition();
SCH_FIELD newField( newFieldPosition, symbol->GetFieldCount(), symbol.get() );
newField.SetName( a.first );
newField.SetText( a.second );
newField.SetVisible( false );
symbol->AddField( newField );
}
for( const auto& a : epart->variant )