From 32b12228fcae051dbbaa69597c2b950214bc9830 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Thu, 11 Feb 2021 20:16:31 -0500 Subject: [PATCH] Use the right sheet when looking for pins to add to netlist Fixes https://gitlab.com/kicad/code/kicad/-/issues/7434 --- eeschema/netlist_exporters/netlist_exporter_base.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/eeschema/netlist_exporters/netlist_exporter_base.cpp b/eeschema/netlist_exporters/netlist_exporter_base.cpp index d2c35e973b..e924f3f353 100644 --- a/eeschema/netlist_exporters/netlist_exporter_base.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_base.cpp @@ -224,23 +224,25 @@ void NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol( SCH_COMPONENT* aSymbol, for( unsigned i = 0; i < sheetList.size(); i++ ) { + SCH_SHEET_PATH& sheet = sheetList[i]; + for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_COMPONENT_T ) ) { SCH_COMPONENT* comp2 = static_cast( item ); - ref2 = comp2->GetRef( &sheetList[i] ); + ref2 = comp2->GetRef( &sheet ); if( ref2.CmpNoCase( ref ) != 0 ) continue; - for( const SCH_PIN* pin : comp2->GetPins( aSheetPath ) ) + for( const SCH_PIN* pin : comp2->GetPins( &sheet ) ) { - if( SCH_CONNECTION* conn = pin->Connection( aSheetPath ) ) + if( SCH_CONNECTION* conn = pin->Connection( &sheet ) ) { const wxString& netName = conn->Name(); // Skip unconnected pins - CONNECTION_SUBGRAPH* sg = graph->FindSubgraphByName( netName, *aSheetPath ); + CONNECTION_SUBGRAPH* sg = graph->FindSubgraphByName( netName, sheet ); if( !sg || sg->m_no_connect || sg->m_items.size() < 2 ) continue;