Remove BuildNetListBase from netlisting paths
This commit is contained in:
parent
ca41dc2e66
commit
a63df2fbf0
|
@ -399,7 +399,7 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
||||||
if( payload.find( "no-annotate" ) == std::string::npos )
|
if( payload.find( "no-annotate" ) == std::string::npos )
|
||||||
{
|
{
|
||||||
// Ensure schematic is OK for netlist creation (especially that it is fully annotated):
|
// Ensure schematic is OK for netlist creation (especially that it is fully annotated):
|
||||||
if( !prepareForNetlist() )
|
if( !ReadyToNetlist() )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -474,10 +474,8 @@ void DIALOG_BOM::OnRunGenerator( wxCommandEvent& event )
|
||||||
m_parent->SetExecFlags( wxEXEC_SHOW_CONSOLE );
|
m_parent->SetExecFlags( wxEXEC_SHOW_CONSOLE );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto netlist = m_parent->CreateNetlist( false, false );
|
if( m_parent->ReadyToNetlist( false, false ) )
|
||||||
|
m_parent->WriteNetListFile( -1, fullfilename, 0, &reporter );
|
||||||
m_parent->WriteNetListFile( netlist, -1,
|
|
||||||
fullfilename, 0, &reporter );
|
|
||||||
|
|
||||||
m_Messages->SetValue( reportmsg );
|
m_Messages->SetValue( reportmsg );
|
||||||
|
|
||||||
|
|
|
@ -498,12 +498,10 @@ bool NETLIST_DIALOG::TransferDataFromWindow()
|
||||||
else
|
else
|
||||||
m_Parent->SetNetListerCommand( wxEmptyString );
|
m_Parent->SetNetListerCommand( wxEmptyString );
|
||||||
|
|
||||||
auto netlist = m_Parent->CreateNetlist( false, false );
|
if( m_Parent->ReadyToNetlist( false, false ) )
|
||||||
|
m_Parent->WriteNetListFile( currPage->m_IdNetType, fullpath, netlist_opt, nullptr );
|
||||||
if( netlist == nullptr )
|
|
||||||
wxMessageBox( _( "Schematic netlist not available" ) );
|
|
||||||
else
|
else
|
||||||
m_Parent->WriteNetListFile( netlist, currPage->m_IdNetType, fullpath, netlist_opt, NULL );
|
wxMessageBox( _( "Schematic netlist not available" ) );
|
||||||
|
|
||||||
WriteCurrentNetlistSetup();
|
WriteCurrentNetlistSetup();
|
||||||
|
|
||||||
|
|
|
@ -518,8 +518,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
if( m_generateNetlistAndExit )
|
if( m_generateNetlistAndExit )
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT( "Writing netlist to %s and exiting..." ), m_netlistFilename );
|
wxLogDebug( wxT( "Writing netlist to %s and exiting..." ), m_netlistFilename );
|
||||||
NETLIST_OBJECT_LIST* netlist = CreateNetlist( false, false );
|
WriteNetListFile( NET_TYPE_PCBNEW, m_netlistFilename, 0, nullptr );
|
||||||
WriteNetListFile( netlist, NET_TYPE_PCBNEW, m_netlistFilename, 0, nullptr );
|
|
||||||
Close( false );
|
Close( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,6 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file eeschema/netform.cpp
|
|
||||||
* @brief Net list generation code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
|
@ -46,13 +41,14 @@
|
||||||
#include <netlist_exporter_kicad.h>
|
#include <netlist_exporter_kicad.h>
|
||||||
#include <netlist_exporter_generic.h>
|
#include <netlist_exporter_generic.h>
|
||||||
|
|
||||||
#include <invoke_sch_dialog.h>
|
|
||||||
|
|
||||||
bool SCH_EDIT_FRAME::WriteNetListFile( NETLIST_OBJECT_LIST* aConnectedItemsList,
|
bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileName,
|
||||||
int aFormat, const wxString& aFullFileName,
|
|
||||||
unsigned aNetlistOptions, REPORTER* aReporter )
|
unsigned aNetlistOptions, REPORTER* aReporter )
|
||||||
{
|
{
|
||||||
if( aConnectedItemsList == nullptr ) // Schematic netlist not available.
|
// Ensure all power symbols have a valid reference
|
||||||
|
Schematic().GetSheets().AnnotatePowerSymbols();
|
||||||
|
|
||||||
|
if( !ReadyToNetlist( false ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool res = true;
|
bool res = true;
|
||||||
|
@ -163,25 +159,37 @@ bool SCH_EDIT_FRAME::WriteNetListFile( NETLIST_OBJECT_LIST* aConnectedItemsList,
|
||||||
int TestDuplicateSheetNames( SCHEMATIC* aSchematic, bool aCreateMarker );
|
int TestDuplicateSheetNames( SCHEMATIC* aSchematic, bool aCreateMarker );
|
||||||
|
|
||||||
|
|
||||||
bool SCH_EDIT_FRAME::prepareForNetlist()
|
bool SCH_EDIT_FRAME::ReadyToNetlist( bool aSilent, bool aSilentAnnotate )
|
||||||
{
|
{
|
||||||
// Ensure all power symbols have a valid reference
|
// Ensure all power symbols have a valid reference
|
||||||
Schematic().GetSheets().AnnotatePowerSymbols();
|
Schematic().GetSheets().AnnotatePowerSymbols();
|
||||||
|
|
||||||
// Performs some controls:
|
// Components must be annotated
|
||||||
if( CheckAnnotate( NULL_REPORTER::GetInstance(), 0 ) )
|
if( CheckAnnotate( NULL_REPORTER::GetInstance(), false ) )
|
||||||
{
|
{
|
||||||
// Schematic must be annotated: call Annotate dialog and tell the user why.
|
if( aSilentAnnotate )
|
||||||
ModalAnnotate( _( "Exporting the netlist requires a completely annotated schematic." ) );
|
{
|
||||||
|
AnnotateComponents( true, UNSORTED, INCREMENTAL_BY_REF, 0, false, false, true,
|
||||||
if( CheckAnnotate( NULL_REPORTER::GetInstance(), 0 ) )
|
NULL_REPORTER::GetInstance() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( aSilent )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Schematic must be annotated: call Annotate dialog and tell the user why.
|
||||||
|
ModalAnnotate(
|
||||||
|
_( "Exporting the netlist requires a completely annotated schematic." ) );
|
||||||
|
|
||||||
|
if( CheckAnnotate( NULL_REPORTER::GetInstance(), false ) )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test duplicate sheet names:
|
// Test duplicate sheet names:
|
||||||
if( TestDuplicateSheetNames( &Schematic(), false ) > 0 )
|
if( TestDuplicateSheetNames( &Schematic(), false ) > 0 )
|
||||||
{
|
{
|
||||||
if( !IsOK( this, _( "Error: duplicate sheet names. Continue?" ) ) )
|
if( aSilent || !IsOK( this, _( "Error: duplicate sheet names. Continue?" ) ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,30 +210,6 @@ void SCH_EDIT_FRAME::sendNetlistToCvpcb()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NETLIST_OBJECT_LIST* SCH_EDIT_FRAME::CreateNetlist( bool aSilent,
|
|
||||||
bool aSilentAnnotate )
|
|
||||||
{
|
|
||||||
if( !aSilent ) // checks for errors and invokes annotation dialog as necessary
|
|
||||||
{
|
|
||||||
if( !prepareForNetlist() )
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
else // performs similar function as prepareForNetlist but without a dialog.
|
|
||||||
{
|
|
||||||
Schematic().GetSheets().AnnotatePowerSymbols();
|
|
||||||
|
|
||||||
if( aSilentAnnotate )
|
|
||||||
AnnotateComponents( true, UNSORTED, INCREMENTAL_BY_REF, 0, false, false, true,
|
|
||||||
NULL_REPORTER::GetInstance() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(JE) This is really going to turn into "PrepareForNetlist"
|
|
||||||
// when the old netlister (BuildNetListBase) is removed
|
|
||||||
|
|
||||||
return BuildNetListBase();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NETLIST_OBJECT_LIST* SCH_EDIT_FRAME::BuildNetListBase( bool updateStatusText )
|
NETLIST_OBJECT_LIST* SCH_EDIT_FRAME::BuildNetListBase( bool updateStatusText )
|
||||||
{
|
{
|
||||||
// Ensure netlist is up to date
|
// Ensure netlist is up to date
|
||||||
|
|
|
@ -839,7 +839,7 @@ void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
|
||||||
wxFileName fn = Prj().AbsolutePath( Schematic().GetFileName() );
|
wxFileName fn = Prj().AbsolutePath( Schematic().GetFileName() );
|
||||||
fn.SetExt( NetlistFileExtension );
|
fn.SetExt( NetlistFileExtension );
|
||||||
|
|
||||||
if( !prepareForNetlist() )
|
if( !ReadyToNetlist() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -167,14 +167,6 @@ protected:
|
||||||
*/
|
*/
|
||||||
bool isAutoSaveRequired() const override;
|
bool isAutoSaveRequired() const override;
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify that annotation is complete so that a proper netlist is even
|
|
||||||
* possible. If not, asks the user if annotation should be done.
|
|
||||||
*
|
|
||||||
* @return bool - true if annotation is complete, else false.
|
|
||||||
*/
|
|
||||||
bool prepareForNetlist();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the kicad netlist over to CVPCB.
|
* Send the kicad netlist over to CVPCB.
|
||||||
*/
|
*/
|
||||||
|
@ -400,6 +392,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a flat list which stores all connected objects.
|
* Create a flat list which stores all connected objects.
|
||||||
|
* TODO(JE) Remove this once ERC is moved off of it
|
||||||
*
|
*
|
||||||
* @param updateStatusText decides if window StatusText should be modified.
|
* @param updateStatusText decides if window StatusText should be modified.
|
||||||
* @return NETLIST_OBJECT_LIST* - caller owns the object.
|
* @return NETLIST_OBJECT_LIST* - caller owns the object.
|
||||||
|
@ -407,23 +400,19 @@ public:
|
||||||
NETLIST_OBJECT_LIST* BuildNetListBase( bool updateStatusText = true );
|
NETLIST_OBJECT_LIST* BuildNetListBase( bool updateStatusText = true );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a netlist for the current schematic.
|
* Checks if we are ready to write a netlist file for the current schematic
|
||||||
*
|
*
|
||||||
* - Test for some issues (missing or duplicate references and sheet names)
|
* - Test for some issues (missing or duplicate references and sheet names)
|
||||||
* - Build netlist info
|
|
||||||
* - Create the netlist file (different formats)
|
|
||||||
*
|
*
|
||||||
* @param aSilent is true if annotation error dialog should be skipped
|
* @param aSilent is true if annotation error dialog should be skipped
|
||||||
* @param aSilentAnnotate is true if components should be reannotated silently
|
* @param aSilentAnnotate is true if components should be reannotated silently
|
||||||
* @returns a unique_ptr to the netlist
|
* @returns true if all is well (i.e. you can call WriteNetListFile next)
|
||||||
*/
|
*/
|
||||||
NETLIST_OBJECT_LIST* CreateNetlist( bool aSilent = false,
|
bool ReadyToNetlist( bool aSilent = false, bool aSilentAnnotate = false );
|
||||||
bool aSilentAnnotate = false );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a netlist file.
|
* Create a netlist file.
|
||||||
*
|
*
|
||||||
* @param aConnectedItemsList = the initialized list of connected items, take ownership.
|
|
||||||
* @param aFormat = netlist format (NET_TYPE_PCBNEW ...)
|
* @param aFormat = netlist format (NET_TYPE_PCBNEW ...)
|
||||||
* @param aFullFileName = full netlist file name
|
* @param aFullFileName = full netlist file name
|
||||||
* @param aNetlistOptions = netlist options using OR'ed bits.
|
* @param aNetlistOptions = netlist options using OR'ed bits.
|
||||||
|
@ -437,8 +426,7 @@ public:
|
||||||
* mainly if a command line must be run (can be NULL
|
* mainly if a command line must be run (can be NULL
|
||||||
* @return true if success.
|
* @return true if success.
|
||||||
*/
|
*/
|
||||||
bool WriteNetListFile( NETLIST_OBJECT_LIST* aConnectedItemsList,
|
bool WriteNetListFile( int aFormat,
|
||||||
int aFormat,
|
|
||||||
const wxString& aFullFileName,
|
const wxString& aFullFileName,
|
||||||
unsigned aNetlistOptions,
|
unsigned aNetlistOptions,
|
||||||
REPORTER* aReporter = NULL );
|
REPORTER* aReporter = NULL );
|
||||||
|
|
|
@ -638,6 +638,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
if( item->IsType( wires ) )
|
if( item->IsType( wires ) )
|
||||||
{
|
{
|
||||||
|
// TODO(JE) Port to connection graph
|
||||||
std::unique_ptr<NETLIST_OBJECT_LIST> netlist( m_frame->BuildNetListBase() );
|
std::unique_ptr<NETLIST_OBJECT_LIST> netlist( m_frame->BuildNetListBase() );
|
||||||
|
|
||||||
for( NETLIST_OBJECT* obj : *netlist )
|
for( NETLIST_OBJECT* obj : *netlist )
|
||||||
|
|
Loading…
Reference in New Issue