From 469d3ea329d243e3e5bb4f97be4f95aaaddae46f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 20 Sep 2021 19:54:47 +0100 Subject: [PATCH] Don't add global labels when a power symbol is connected. Fixes https://gitlab.com/kicad/code/kicad/issues/7497 --- eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp | 15 +++++++++++++-- eeschema/sch_plugins/eagle/sch_eagle_plugin.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp index a4538f0491..96dee2ce36 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp @@ -1081,8 +1081,16 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n else if( nodeName == "pinref" ) { segmentAttribute->GetAttribute( "gate" ); // REQUIRED - segmentAttribute->GetAttribute( "part" ); // REQUIRED - segmentAttribute->GetAttribute( "pin" ); // REQUIRED + wxString part = segmentAttribute->GetAttribute( "part" ); // REQUIRED + wxString pin = segmentAttribute->GetAttribute( "pin" ); // REQUIRED + + auto powerPort = m_powerPorts.find( "#" + part ); + + if( powerPort != m_powerPorts.end() + && powerPort->second == EscapeString( pin, CTX_NETNAME ) ) + { + labelled = true; + } } else if( nodeName == "wire" ) { @@ -1460,6 +1468,9 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode ) for( const LIB_PIN* pin : pins ) m_connPoints[symbol->GetPinPhysicalPosition( pin )].emplace( pin ); + if( part->IsPower() ) + m_powerPorts[ reference ] = symbol->GetField( VALUE_FIELD )->GetText(); + symbol->ClearFlags(); screen->Append( symbol.release() ); diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.h b/eeschema/sch_plugins/eagle/sch_eagle_plugin.h index 79e91928c0..bebe85b44c 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.h +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.h @@ -234,6 +234,8 @@ private: std::map m_netCounts; std::map m_layerMap; + std::map m_powerPorts; ///< map from symbol reference to global + ///< label equivalent ///< Wire intersection points, used for quick checks whether placing a net label in a particular ///< place would short two nets.