Eeschema Eagle Import: changed fixNetName() to escapeName()

This commit is contained in:
Maciej Suminski 2017-10-11 23:28:07 +11:00
parent b796b13a89
commit 87465002c3
2 changed files with 7 additions and 12 deletions

View File

@ -762,7 +762,7 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n
// this preserves the named net feature of Eagle schematics. // this preserves the named net feature of Eagle schematics.
if( labelled == false && wire != NULL ) if( labelled == false && wire != NULL )
{ {
wxString netname = fixNetName( netName ); wxString netname = escapeName( netName );
// Add a global label if the net appears on more than one Eagle sheet // Add a global label if the net appears on more than one Eagle sheet
if( m_netCounts[netName.ToStdString()]>1 ) if( m_netCounts[netName.ToStdString()]>1 )
@ -843,7 +843,7 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadLabel( wxXmlNode* aLabelNode,
wxPoint elabelpos( elabel.x * EUNIT_TO_MIL, -elabel.y * EUNIT_TO_MIL ); wxPoint elabelpos( elabel.x * EUNIT_TO_MIL, -elabel.y * EUNIT_TO_MIL );
wxString netname = fixNetName( elabel.netname ); wxString netname = escapeName( elabel.netname );
// Determine if the Label is a local and global label based on the number of sheets the net appears on. // Determine if the Label is a local and global label based on the number of sheets the net appears on.
@ -1353,11 +1353,7 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode,
pin->SetPartNumber( aGateNumber ); pin->SetPartNumber( aGateNumber );
pin->SetUnit( aGateNumber ); pin->SetUnit( aGateNumber );
pin->SetName( escapeName( pin->GetName() ) );
wxString pinname = pin->GetName();
pinname.Replace( "~", "~~" );
pinname.Replace( "!", "~" );
pin->SetName( pinname );
if( pads.GetCount() > 1) if( pads.GetCount() > 1)
{ {
@ -1773,9 +1769,7 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadPlainText( wxXmlNode* aSchText )
schtext->SetPosition( wxPoint( etext.x * EUNIT_TO_MIL, -etext.y * EUNIT_TO_MIL ) ); schtext->SetPosition( wxPoint( etext.x * EUNIT_TO_MIL, -etext.y * EUNIT_TO_MIL ) );
wxString thetext = aSchText->GetNodeContent(); wxString thetext = aSchText->GetNodeContent();
thetext.Replace( "~", "~~" ); schtext->SetText( aSchText->GetNodeContent().IsEmpty() ? "\" \"" : escapeName( thetext ) );
thetext.Replace( "!", "~" );
schtext->SetText( thetext );
if( etext.ratio ) if( etext.ratio )
{ {
@ -2404,7 +2398,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
} }
wxString SCH_EAGLE_PLUGIN::fixNetName( const wxString& aNetName ) wxString SCH_EAGLE_PLUGIN::escapeName( const wxString& aNetName )
{ {
wxString ret( aNetName ); wxString ret( aNetName );

View File

@ -144,7 +144,8 @@ private:
/// ends on an Eagle bus segment. /// ends on an Eagle bus segment.
void addBusEntries(); void addBusEntries();
static wxString fixNetName( const wxString& aNetName ); ///> Translates Eagle special characters to their counterparts in KiCad.
static wxString escapeName( const wxString& aNetName );
/// Return the matching layer or return LAYER_NOTES /// Return the matching layer or return LAYER_NOTES
SCH_LAYER_ID kiCadLayer( int aEagleLayer ); SCH_LAYER_ID kiCadLayer( int aEagleLayer );