Update a bunch of netlist exporters to resolve textVars.
Fixes https://gitlab.com/kicad/code/kicad/issues/5285
This commit is contained in:
parent
65bdaff133
commit
23c8123ac9
|
@ -80,7 +80,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsig
|
|||
continue;
|
||||
|
||||
if( !component->GetField( FOOTPRINT )->IsVoid() )
|
||||
footprint = component->GetField( FOOTPRINT )->GetText();
|
||||
footprint = component->GetField( FOOTPRINT )->GetShownText();
|
||||
else
|
||||
footprint = "$noname";
|
||||
|
||||
|
@ -88,7 +88,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsig
|
|||
ret |= fprintf( f, "%s ", TO_UTF8( StartCmpDesc ) );
|
||||
ret |= fprintf( f, "%s", TO_UTF8( msg ) );
|
||||
|
||||
msg = component->GetField( VALUE )->GetText();
|
||||
msg = component->GetField( VALUE )->GetShownText();
|
||||
msg.Replace( wxT( " " ), wxT( "_" ) );
|
||||
ret |= fprintf( f, " \"%s\"", TO_UTF8( msg ) );
|
||||
ret |= fprintf( f, " \"%s\"", TO_UTF8( footprint ) );
|
||||
|
@ -127,14 +127,15 @@ bool NETLIST_EXPORTER_CADSTAR::writeListOfNets( FILE* f )
|
|||
|
||||
std::vector<std::pair<SCH_PIN*, SCH_SHEET_PATH>> sorted_items;
|
||||
|
||||
for( auto subgraph : subgraphs )
|
||||
for( CONNECTION_SUBGRAPH* subgraph : subgraphs )
|
||||
{
|
||||
auto sheet = subgraph->m_sheet;
|
||||
SCH_SHEET_PATH sheet = subgraph->m_sheet;
|
||||
|
||||
for( auto item : subgraph->m_items )
|
||||
for( SCH_ITEM* item : subgraph->m_items )
|
||||
{
|
||||
if( item->Type() == SCH_PIN_T )
|
||||
sorted_items.emplace_back(
|
||||
std::make_pair( static_cast<SCH_PIN*>( item ), sheet ) );
|
||||
sorted_items.emplace_back( static_cast<SCH_PIN*>( item ), sheet );
|
||||
}
|
||||
}
|
||||
|
||||
// Netlist ordering: Net name, then ref des, then pin name
|
||||
|
@ -156,8 +157,8 @@ bool NETLIST_EXPORTER_CADSTAR::writeListOfNets( FILE* f )
|
|||
sorted_items.erase( std::unique( sorted_items.begin(), sorted_items.end(),
|
||||
[]( auto a, auto b )
|
||||
{
|
||||
auto ref_a = a.first->GetParentComponent()->GetRef( &a.second );
|
||||
auto ref_b = b.first->GetParentComponent()->GetRef( &b.second );
|
||||
wxString ref_a = a.first->GetParentComponent()->GetRef( &a.second );
|
||||
wxString ref_b = b.first->GetParentComponent()->GetRef( &b.second );
|
||||
|
||||
return ref_a == ref_b && a.first->GetNumber() == b.first->GetNumber();
|
||||
} ),
|
||||
|
@ -165,7 +166,7 @@ bool NETLIST_EXPORTER_CADSTAR::writeListOfNets( FILE* f )
|
|||
|
||||
print_ter = 0;
|
||||
|
||||
for( const auto& pair : sorted_items )
|
||||
for( const std::pair<SCH_PIN*, SCH_SHEET_PATH>& pair : sorted_items )
|
||||
{
|
||||
SCH_PIN* pin = pair.first;
|
||||
SCH_SHEET_PATH sheet = pair.second;
|
||||
|
|
|
@ -85,7 +85,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
|
||||
if( !comp->GetField( FOOTPRINT )->IsVoid() )
|
||||
{
|
||||
footprint = comp->GetField( FOOTPRINT )->GetText();
|
||||
footprint = comp->GetField( FOOTPRINT )->GetShownText();
|
||||
footprint.Replace( wxT( " " ), wxT( "_" ) );
|
||||
}
|
||||
else
|
||||
|
@ -101,7 +101,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
|
||||
ret |= fprintf( f, " %s", TO_UTF8( field ) );
|
||||
|
||||
field = comp->GetField( VALUE )->GetText();
|
||||
field = comp->GetField( VALUE )->GetShownText();
|
||||
field.Replace( wxT( " " ), wxT( "_" ) );
|
||||
ret |= fprintf( f, " %s", TO_UTF8( field ) );
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceField( SPICE_FIELD aField,
|
|||
SCH_COMPONENT* aComponent, unsigned aCtl )
|
||||
{
|
||||
SCH_FIELD* field = aComponent->FindField( GetSpiceFieldName( aField ) );
|
||||
return field ? field->GetText() : GetSpiceFieldDefVal( aField, aComponent, aCtl );
|
||||
return field ? field->GetShownText() : GetSpiceFieldDefVal( aField, aComponent, aCtl );
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,15 +186,15 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_FIELD aField,
|
|||
{
|
||||
case SF_PRIMITIVE:
|
||||
{
|
||||
const wxString refName = aComponent->GetField( REFERENCE )->GetText();
|
||||
const wxString refName = aComponent->GetField( REFERENCE )->GetShownText();
|
||||
return refName.GetChar( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
case SF_MODEL:
|
||||
{
|
||||
wxChar prim = aComponent->GetField( REFERENCE )->GetText().GetChar( 0 );
|
||||
wxString value = aComponent->GetField( VALUE )->GetText();
|
||||
wxChar prim = aComponent->GetField( REFERENCE )->GetShownText().GetChar( 0 );
|
||||
wxString value = aComponent->GetField( VALUE )->GetShownText();
|
||||
|
||||
// Is it a passive component?
|
||||
if( aCtl & NET_ADJUST_PASSIVE_VALS && ( prim == 'C' || prim == 'L' || prim == 'R' ) )
|
||||
|
@ -316,8 +316,8 @@ bool NETLIST_EXPORTER_PSPICE::ProcessNetlist( unsigned aCtl )
|
|||
// Check to see if component should be removed from Spice netlist
|
||||
spiceItem.m_enabled = StringToBool( GetSpiceField( SF_ENABLED, comp, aCtl ) );
|
||||
|
||||
if( fieldLibFile && !fieldLibFile->GetText().IsEmpty() )
|
||||
m_libraries.insert( fieldLibFile->GetText() );
|
||||
if( fieldLibFile && !fieldLibFile->GetShownText().IsEmpty() )
|
||||
m_libraries.insert( fieldLibFile->GetShownText() );
|
||||
|
||||
wxArrayString pinNames;
|
||||
|
||||
|
@ -336,7 +336,7 @@ bool NETLIST_EXPORTER_PSPICE::ProcessNetlist( unsigned aCtl )
|
|||
if( fieldSeq )
|
||||
{
|
||||
// Get the string containing the sequence of nodes:
|
||||
const wxString& nodeSeqIndexLineStr = fieldSeq->GetText();
|
||||
const wxString& nodeSeqIndexLineStr = fieldSeq->GetShownText();
|
||||
|
||||
// Verify field exists and is not empty:
|
||||
if( !nodeSeqIndexLineStr.IsEmpty() )
|
||||
|
@ -380,7 +380,7 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
|
|||
{
|
||||
for( auto item : sheetList[i].LastScreen()->Items().OfType( SCH_TEXT_T ) )
|
||||
{
|
||||
wxString text = static_cast<SCH_TEXT*>( item )->GetText();
|
||||
wxString text = static_cast<SCH_TEXT*>( item )->GetShownText();
|
||||
|
||||
if( text.IsEmpty() )
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue