From 9c78d86f58053f754b6ad307900736dff003bb5d Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Fri, 5 May 2023 08:53:29 -0400 Subject: [PATCH] Don't include power symbol pin when exporting netlist. The netlist exporter was never updated to exclude symbols that are tagged as power symbols. Only the legacy power symbol name prefix ('#') was used as the power symbol check. Power symbols no longer require the '#' name prefix. (cherry picked from commit fb6b8eaeeac97cb17976ca82d360768acb370cf3) --- eeschema/netlist_exporters/netlist_exporter_base.cpp | 10 ++++++---- eeschema/sch_symbol.cpp | 7 +++++++ eeschema/sch_symbol.h | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/eeschema/netlist_exporters/netlist_exporter_base.cpp b/eeschema/netlist_exporters/netlist_exporter_base.cpp index b558b54911..79c1552fd6 100644 --- a/eeschema/netlist_exporters/netlist_exporter_base.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_base.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 1992-2017 jp.charras at wanadoo.fr * Copyright (C) 2013-2017 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -117,13 +117,15 @@ std::vector NETLIST_EXPORTER_BASE::CreatePinList( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPath, bool aKeepUnconnectedPins ) { - wxString ref( aSymbol->GetRef( aSheetPath ) ); std::vector pins; + wxCHECK( aSymbol, pins ); + + wxString ref( aSymbol->GetRef( aSheetPath ) ); + // Power symbols and other symbols which have the reference starting with "#" are not // included in netlist (pseudo or virtual symbols) - - if( ref[0] == wxChar( '#' ) ) + if( ( ref[0] == wxChar( '#' ) ) || aSymbol->IsPower() ) return pins; // if( aSymbol->m_FlagControlMulti == 1 ) diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index c37cca18ee..be64fac3f2 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -2299,3 +2299,10 @@ bool SCH_SYMBOL::IsSymbolLikePowerGlobalLabel() const return pin_list[0]->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN; } + +bool SCH_SYMBOL::IsPower() const +{ + wxCHECK( m_part, false ); + + return m_part->IsPower(); +} diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h index bca97f4344..992aace896 100644 --- a/eeschema/sch_symbol.h +++ b/eeschema/sch_symbol.h @@ -763,6 +763,8 @@ public: */ bool IsSymbolLikePowerGlobalLabel() const; + bool IsPower() const; + private: BOX2I doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;