Handle Eagle user-defined attributes.
(We map these to text variables.) Fixes https://gitlab.com/kicad/code/kicad/issues/13798
This commit is contained in:
parent
5d116245c6
commit
8fe02ee83c
|
@ -116,6 +116,8 @@ wxString interpretText( const wxString& aText )
|
|||
|
||||
bool substituteVariable( wxString* aText )
|
||||
{
|
||||
if( aText->StartsWith( '>' ) && aText->AfterFirst( ' ' ).IsEmpty() )
|
||||
{
|
||||
if ( *aText == wxT( ">NAME" ) ) *aText = wxT( "${REFERENCE}" );
|
||||
else if( *aText == wxT( ">VALUE" ) ) *aText = wxT( "${VALUE}" );
|
||||
else if( *aText == wxT( ">PART" ) ) *aText = wxT( "${REFERENCE}" );
|
||||
|
@ -132,9 +134,12 @@ bool substituteVariable( wxString* aText )
|
|||
else if( *aText == wxT( ">DRAWING_NAME" ) ) *aText = wxT( "${PROJECTNAME}" );
|
||||
else if( *aText == wxT( ">LAST_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" );
|
||||
else if( *aText == wxT( ">PLOT_DATE_TIME" ) ) *aText = wxT( "${CURRENT_DATE}" );
|
||||
else return false;
|
||||
else *aText = wxString::Format( wxS( "${%s}" ), aText->Mid( 1 ).Trim() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1726,7 +1726,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
valueField->SetVisible( false );
|
||||
}
|
||||
|
||||
for( const auto& a : epart->attribute )
|
||||
for( const auto& [ attrName, attrValue ] : epart->attribute )
|
||||
{
|
||||
VECTOR2I newFieldPosition( 0, 0 );
|
||||
SCH_FIELD* lastField = symbol->GetFieldById( symbol->GetFieldCount() - 1 );
|
||||
|
@ -1736,8 +1736,8 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
|
||||
SCH_FIELD newField( newFieldPosition, symbol->GetFieldCount(), symbol.get() );
|
||||
|
||||
newField.SetName( a.first );
|
||||
newField.SetText( a.second );
|
||||
newField.SetName( attrName );
|
||||
newField.SetText( attrValue );
|
||||
newField.SetVisible( false );
|
||||
|
||||
symbol->AddField( newField );
|
||||
|
|
Loading…
Reference in New Issue