Begin refactoring netlist creation
This commit is contained in:
parent
c8c0b89eef
commit
5cf82f1a9e
|
@ -472,7 +472,10 @@ void DIALOG_BOM::OnRunPlugin( wxCommandEvent& event )
|
||||||
m_parent->SetExecFlags( wxEXEC_SHOW_CONSOLE );
|
m_parent->SetExecFlags( wxEXEC_SHOW_CONSOLE );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_parent->CreateNetlist( -1, fullfilename, 0, &reporter, false );
|
auto netlist = m_parent->CreateNetlist( false, false );
|
||||||
|
|
||||||
|
m_parent->WriteNetListFile( netlist, -1,
|
||||||
|
fullfilename, 0, &reporter );
|
||||||
|
|
||||||
m_Messages->SetValue( reportmsg );
|
m_Messages->SetValue( reportmsg );
|
||||||
}
|
}
|
||||||
|
|
|
@ -597,7 +597,10 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
|
||||||
else
|
else
|
||||||
m_Parent->SetNetListerCommand( wxEmptyString );
|
m_Parent->SetNetListerCommand( wxEmptyString );
|
||||||
|
|
||||||
m_Parent->CreateNetlist( currPage->m_IdNetType, fullpath, netlist_opt, NULL, false );
|
auto netlist = m_Parent->CreateNetlist( false, false );
|
||||||
|
|
||||||
|
m_Parent->WriteNetListFile( netlist, currPage->m_IdNetType,
|
||||||
|
fullpath, netlist_opt, NULL );
|
||||||
|
|
||||||
WriteCurrentNetlistSetup();
|
WriteCurrentNetlistSetup();
|
||||||
|
|
||||||
|
@ -674,8 +677,10 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
|
||||||
if( currPage->m_SpiceAjustPassiveValues && currPage->m_SpiceAjustPassiveValues->GetValue() )
|
if( currPage->m_SpiceAjustPassiveValues && currPage->m_SpiceAjustPassiveValues->GetValue() )
|
||||||
netlist_opt |= NET_ADJUST_PASSIVE_VALS;
|
netlist_opt |= NET_ADJUST_PASSIVE_VALS;
|
||||||
|
|
||||||
if( ! m_Parent->CreateNetlist( currPage->m_IdNetType, fn.GetFullPath(),
|
auto netlist = m_Parent->CreateNetlist( false, false );
|
||||||
netlist_opt, NULL, false ) )
|
|
||||||
|
if( ! m_Parent->WriteNetListFile( netlist, currPage->m_IdNetType,
|
||||||
|
fn.GetFullPath(), netlist_opt, NULL ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ExecuteFile( this, ExecFile, CommandLine );
|
ExecuteFile( this, ExecFile, CommandLine );
|
||||||
|
|
|
@ -191,11 +191,11 @@ bool SCH_EDIT_FRAME::prepareForNetlist()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::sendNetlist()
|
void SCH_EDIT_FRAME::sendNetlistToCvpcb()
|
||||||
{
|
{
|
||||||
NETLIST_OBJECT_LIST* net_atoms = BuildNetListBase();
|
NETLIST_OBJECT_LIST* net_atoms = BuildNetListBase();
|
||||||
|
|
||||||
NETLIST_EXPORTER_KICAD exporter( this, net_atoms );
|
NETLIST_EXPORTER_KICAD exporter( this, net_atoms, g_ConnectionGraph );
|
||||||
|
|
||||||
STRING_FORMATTER formatter;
|
STRING_FORMATTER formatter;
|
||||||
|
|
||||||
|
@ -210,13 +210,13 @@ void SCH_EDIT_FRAME::sendNetlist()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
NETLIST_OBJECT_LIST* SCH_EDIT_FRAME::CreateNetlist( bool aSilent,
|
||||||
unsigned aNetlistOptions, REPORTER* aReporter, bool aSilent )
|
bool aSilentAnnotate )
|
||||||
{
|
{
|
||||||
if( !aSilent ) // checks for errors and invokes annotation dialog as neccessary
|
if( !aSilent ) // checks for errors and invokes annotation dialog as neccessary
|
||||||
{
|
{
|
||||||
if( !prepareForNetlist() )
|
if( !prepareForNetlist() )
|
||||||
return false;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else // performs similar function as prepareForNetlist but without a dialog.
|
else // performs similar function as prepareForNetlist but without a dialog.
|
||||||
{
|
{
|
||||||
|
@ -224,14 +224,16 @@ bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
||||||
schematic.UpdateSymbolLinks();
|
schematic.UpdateSymbolLinks();
|
||||||
SCH_SHEET_LIST sheets( g_RootSheet );
|
SCH_SHEET_LIST sheets( g_RootSheet );
|
||||||
sheets.AnnotatePowerSymbols();
|
sheets.AnnotatePowerSymbols();
|
||||||
|
|
||||||
|
if( aSilentAnnotate )
|
||||||
|
AnnotateComponents( true, UNSORTED, INCREMENTAL_BY_REF, 0, false, false, true,
|
||||||
|
NULL_REPORTER::GetInstance() );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<NETLIST_OBJECT_LIST> connectedItemsList( BuildNetListBase() );
|
// TODO(JE) This is really going to turn into "PrepareForNetlist"
|
||||||
|
// when the old netlister (BuildNetListBase) is removed
|
||||||
|
|
||||||
bool success = WriteNetListFile( connectedItemsList.release(), aFormat,
|
return BuildNetListBase();
|
||||||
aFullFileName, aNetlistOptions, aReporter );
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -907,25 +907,9 @@ void SCH_EDIT_FRAME::doUpdatePcb( const wxString& aUpdateOptions )
|
||||||
frame->Raise();
|
frame->Raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aUpdateOptions.Contains( "quiet-annotate" ) )
|
auto net_atoms = CreateNetlist( aUpdateOptions.Contains( "no-annotate" ),
|
||||||
{
|
aUpdateOptions.Contains( "quiet-annotate" ) );
|
||||||
SCH_SCREENS schematic;
|
|
||||||
schematic.UpdateSymbolLinks();
|
|
||||||
SCH_SHEET_LIST sheets( g_RootSheet );
|
|
||||||
sheets.AnnotatePowerSymbols();
|
|
||||||
AnnotateComponents( true, UNSORTED, INCREMENTAL_BY_REF, 0, false, false, true,
|
|
||||||
NULL_REPORTER::GetInstance() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !aUpdateOptions.Contains( "no-annotate" ) )
|
|
||||||
{
|
|
||||||
// Ensure the schematic is OK for a netlist creation
|
|
||||||
// (especially all components are annotated):
|
|
||||||
if( !prepareForNetlist() )
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NETLIST_OBJECT_LIST* net_atoms = BuildNetListBase();
|
|
||||||
NETLIST_EXPORTER_KICAD exporter( this, net_atoms, g_ConnectionGraph );
|
NETLIST_EXPORTER_KICAD exporter( this, net_atoms, g_ConnectionGraph );
|
||||||
STRING_FORMATTER formatter;
|
STRING_FORMATTER formatter;
|
||||||
|
|
||||||
|
@ -1173,7 +1157,7 @@ void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
|
||||||
// player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
|
// player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
sendNetlist();
|
sendNetlistToCvpcb();
|
||||||
|
|
||||||
player->Raise();
|
player->Raise();
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,7 +241,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Send the kicad netlist over to CVPCB.
|
* Send the kicad netlist over to CVPCB.
|
||||||
*/
|
*/
|
||||||
void sendNetlist();
|
void sendNetlistToCvpcb();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||||
|
@ -562,24 +562,12 @@ public:
|
||||||
* - Build netlist info
|
* - Build netlist info
|
||||||
* - Create the netlist file (different formats)
|
* - Create the netlist file (different formats)
|
||||||
*
|
*
|
||||||
* @param aFormat = netlist format (NET_TYPE_PCBNEW ...)
|
* @param aSilent is true if annotation error dialog should be skipped
|
||||||
* @param aFullFileName = full netlist file name
|
* @param aSilentAnnotate is true if components should be reannotated silently
|
||||||
* @param aNetlistOptions = netlist options using OR'ed bits.
|
* @returns a unique_ptr to the netlist
|
||||||
* <p>
|
|
||||||
* For SPICE netlist only:
|
|
||||||
* if NET_USE_NETNAMES is set, use net names from labels in schematic
|
|
||||||
* else use net numbers (net codes)
|
|
||||||
* if NET_USE_X_PREFIX is set : change "U" and "IC" reference prefix to "X"
|
|
||||||
* </p>
|
|
||||||
* @param aReporter = a REPORTER to report error messages,
|
|
||||||
* mainly if a command line must be run (can be NULL
|
|
||||||
* @return true if success.
|
|
||||||
*/
|
*/
|
||||||
bool CreateNetlist( int aFormat,
|
NETLIST_OBJECT_LIST* CreateNetlist( bool aSilent = false,
|
||||||
const wxString& aFullFileName,
|
bool aSilentAnnotate = false );
|
||||||
unsigned aNetlistOptions,
|
|
||||||
REPORTER* aReporter = NULL,
|
|
||||||
bool silent = false );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a netlist file.
|
* Create a netlist file.
|
||||||
|
|
Loading…
Reference in New Issue