Eagle importer: convert special characters in net names

Convert '!' to '~' to reflect overbar toggling and change '~' to '~~'.
Now it matches the net names in schematics import plugin.
This commit is contained in:
Maciej Suminski 2018-02-17 00:01:43 +01:00
parent b1f456fade
commit 24fcdb00cc
5 changed files with 15 additions and 15 deletions

View File

@ -34,6 +34,17 @@
constexpr auto DEFAULT_ALIGNMENT = ETEXT::BOTTOM_LEFT;
wxString escapeName( const wxString& aNetName )
{
wxString ret( aNetName );
ret.Replace( "~", "~~" );
ret.Replace( "!", "~" );
return ret;
}
template<> template<>
OPTIONAL_XML_ATTRIBUTE<wxString>::OPTIONAL_XML_ATTRIBUTE( wxString aData )
{

View File

@ -2295,14 +2295,3 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
} // for ( line ..
} // for ( bus ..
}
wxString SCH_EAGLE_PLUGIN::escapeName( const wxString& aNetName )
{
wxString ret( aNetName );
ret.Replace( "~", "~~" );
ret.Replace( "!", "~" );
return ret;
}

View File

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

View File

@ -52,6 +52,9 @@ typedef std::map<wxString, MODULE*> MODULE_MAP;
typedef std::map<wxString, EINSTANCE*> EINSTANCE_MAP;
typedef std::map<wxString, std::unique_ptr<EPART>> EPART_MAP;
///> Translates Eagle special characters to their counterparts in KiCad.
wxString escapeName( const wxString& aNetName );
static inline wxXmlNode* getChildrenNodes( NODE_MAP& aMap, const wxString& aName )
{
auto it = aMap.find( aName );

View File

@ -1717,7 +1717,7 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
zones.clear();
const wxString& netName = net->GetAttribute( "name" );
const wxString& netName = escapeName( net->GetAttribute( "name" ) );
m_board->Add( new NETINFO_ITEM( m_board, netName, netCode ) );
m_xpath->Value( netName.c_str() );