Set currentSheet when exporting netlist.

Patch courtesy of Fernando Gomez.
This commit is contained in:
Jeff Young 2023-04-26 18:19:15 +01:00
parent 9d2824ec5e
commit 5e21e94478
1 changed files with 7 additions and 0 deletions

View File

@ -222,6 +222,7 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
m_libParts.clear();
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
SCH_SHEET_PATH currentSheet = m_schematic->CurrentSheet();
// Output is xml, so there is no reason to remove spaces from the field values.
// And XML element names need not be translated to various languages.
@ -230,6 +231,10 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
{
SCH_SHEET_PATH sheet = sheetList[ii];
// Change schematic CurrentSheet in each iteration to allow hierarchical
// resolution of text variables in sheet fields.
m_schematic->SetCurrentSheet( sheet );
auto cmp = [sheet]( SCH_SYMBOL* a, SCH_SYMBOL* b )
{
return ( StrNumCmp( a->GetRef( &sheet, false ),
@ -400,6 +405,8 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
}
}
m_schematic->SetCurrentSheet( currentSheet );
return xcomps;
}