From 24fcdb00cc46f93ae071316fc3b067861653fa34 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Sat, 17 Feb 2018 00:01:43 +0100 Subject: [PATCH] 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. --- common/eagle_parser.cpp | 11 +++++++++++ eeschema/sch_eagle_plugin.cpp | 11 ----------- eeschema/sch_eagle_plugin.h | 3 --- include/eagle_parser.h | 3 +++ pcbnew/eagle_plugin.cpp | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/common/eagle_parser.cpp b/common/eagle_parser.cpp index 82ca767a59..2b4ef74790 100644 --- a/common/eagle_parser.cpp +++ b/common/eagle_parser.cpp @@ -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::OPTIONAL_XML_ATTRIBUTE( wxString aData ) { diff --git a/eeschema/sch_eagle_plugin.cpp b/eeschema/sch_eagle_plugin.cpp index e071b9e16a..f4f134fa6b 100644 --- a/eeschema/sch_eagle_plugin.cpp +++ b/eeschema/sch_eagle_plugin.cpp @@ -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; -} diff --git a/eeschema/sch_eagle_plugin.h b/eeschema/sch_eagle_plugin.h index 214ea799b7..df4c0acb36 100644 --- a/eeschema/sch_eagle_plugin.h +++ b/eeschema/sch_eagle_plugin.h @@ -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 ); diff --git a/include/eagle_parser.h b/include/eagle_parser.h index 1c62c7e58c..34eb288459 100644 --- a/include/eagle_parser.h +++ b/include/eagle_parser.h @@ -52,6 +52,9 @@ typedef std::map MODULE_MAP; typedef std::map EINSTANCE_MAP; typedef std::map> 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 ); diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 5b564caae0..42d3d85809 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -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() );