Make sure current sheet gets set when creating BOM.
Fixes https://gitlab.com/kicad/code/kicad/issues/6418
This commit is contained in:
parent
c1d1c12b41
commit
55d0b79746
|
@ -111,6 +111,9 @@ protected:
|
|||
/// The schematic we're generating a netlist for
|
||||
SCHEMATIC* m_schematic;
|
||||
|
||||
/// The schematic's CurrentSheet when we entered. Restore on exiting.
|
||||
SCH_SHEET_PATH m_savedCurrentSheet;
|
||||
|
||||
/**
|
||||
* Function findNextSymbolAndCreatePinList
|
||||
* finds a symbol from the DrawList and builds its pin list in m_sortedSymbolPinList. This
|
||||
|
@ -165,10 +168,12 @@ public:
|
|||
m_schematic( aSchematic )
|
||||
{
|
||||
wxASSERT( aSchematic );
|
||||
m_savedCurrentSheet = m_schematic->CurrentSheet();
|
||||
}
|
||||
|
||||
virtual ~NETLIST_EXPORTER_BASE()
|
||||
{
|
||||
m_schematic->SetCurrentSheet( m_savedCurrentSheet );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -162,15 +162,8 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_COMPONENT* aSymbol
|
|||
}
|
||||
else
|
||||
{
|
||||
if( m_resolveTextVars )
|
||||
fields.value = aSymbol->GetField( VALUE_FIELD )->GetShownText();
|
||||
else
|
||||
fields.value = aSymbol->GetField( VALUE_FIELD )->GetText();
|
||||
|
||||
if( m_resolveTextVars )
|
||||
fields.footprint = aSymbol->GetField( FOOTPRINT_FIELD )->GetShownText();
|
||||
else
|
||||
fields.footprint = aSymbol->GetField( FOOTPRINT_FIELD )->GetText();
|
||||
fields.value = aSymbol->GetValue( aSheet, m_resolveTextVars );
|
||||
fields.footprint = aSymbol->GetFootprint( aSheet, m_resolveTextVars );
|
||||
|
||||
if( m_resolveTextVars )
|
||||
fields.datasheet = aSymbol->GetField( DATASHEET_FIELD )->GetShownText();
|
||||
|
@ -235,6 +228,7 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
|
|||
for( unsigned ii = 0; ii < sheetList.size(); ii++ )
|
||||
{
|
||||
SCH_SHEET_PATH sheet = sheetList[ii];
|
||||
m_schematic->SetCurrentSheet( sheet );
|
||||
|
||||
auto cmp = [sheet]( SCH_COMPONENT* a, SCH_COMPONENT* b )
|
||||
{
|
||||
|
@ -244,7 +238,7 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
|
|||
|
||||
std::set<SCH_COMPONENT*, decltype( cmp )> ordered_symbols( cmp );
|
||||
|
||||
for( SCH_ITEM* item : sheetList[ii].LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
|
||||
{
|
||||
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
|
||||
auto test = ordered_symbols.insert( symbol );
|
||||
|
|
|
@ -576,12 +576,9 @@ const wxString SCH_COMPONENT::GetValue( const SCH_SHEET_PATH* sheet, bool aResol
|
|||
{
|
||||
if( instance.m_Path == path && !instance.m_Value.IsEmpty() )
|
||||
{
|
||||
if( !aResolve )
|
||||
return instance.m_Value;
|
||||
|
||||
SCH_FIELD dummy( wxDefaultPosition, VALUE_FIELD, const_cast<SCH_COMPONENT*>( this ) );
|
||||
dummy.SetText( instance.m_Value );
|
||||
return dummy.GetShownText();
|
||||
// This can only be an override from an Update Schematic from PCB, and therefore
|
||||
// will always be fully resolved.
|
||||
return instance.m_Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -629,12 +626,9 @@ const wxString SCH_COMPONENT::GetFootprint( const SCH_SHEET_PATH* sheet, bool aR
|
|||
{
|
||||
if( instance.m_Path == path && !instance.m_Footprint.IsEmpty() )
|
||||
{
|
||||
if( !aResolve )
|
||||
return instance.m_Footprint;
|
||||
|
||||
SCH_FIELD dummy( wxDefaultPosition, FOOTPRINT_FIELD, const_cast<SCH_COMPONENT*>( this ) );
|
||||
dummy.SetText( instance.m_Footprint );
|
||||
return dummy.GetShownText();
|
||||
// This can only be an override from an Update Schematic from PCB, and therefore
|
||||
// will always be fully resolved.
|
||||
return instance.m_Footprint;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue