Kicad Eagle Project Import Improvements. -- schematic and board files are both visible in file selection dialog. -- Allows for the selection of either the board or schematic file. -- silently fails on not detecting the corrosponding board or schematic file. -- all new kicad files are generated in new project directory -- Silently read netlist without generating annotation warnings which synchronises timestamps and paths based on given eagle references, otherwise renumbering schematic references will break links accross schematic and pcbnew.
This commit is contained in:
parent
3145829b77
commit
869743d573
|
@ -73,6 +73,7 @@ const wxString SchematicLibraryFileWildcard( _( "KiCad component library file (*
|
||||||
const wxString ProjectFileWildcard( _( "KiCad project files (*.pro)|*.pro" ) );
|
const wxString ProjectFileWildcard( _( "KiCad project files (*.pro)|*.pro" ) );
|
||||||
const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch|Eagle 6.x XML schematic file (*.sch)|*.sch" ) );
|
const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch|Eagle 6.x XML schematic file (*.sch)|*.sch" ) );
|
||||||
const wxString EagleSchematicFileWildcard( _( "Eagle XML schematic file (*.sch)|*.sch" ) );
|
const wxString EagleSchematicFileWildcard( _( "Eagle XML schematic file (*.sch)|*.sch" ) );
|
||||||
|
const wxString EagleFilesWildcard( _( "Eagle XML files (*.sch *.brd)|*.sch;*.brd" ) );
|
||||||
const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );
|
const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );
|
||||||
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
|
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
|
||||||
const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) );
|
const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) );
|
||||||
|
|
|
@ -433,7 +433,7 @@ 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 );
|
m_parent->CreateNetlist( -1, fullfilename, 0, &reporter, false );
|
||||||
|
|
||||||
m_Messages->SetValue( reportmsg );
|
m_Messages->SetValue( reportmsg );
|
||||||
}
|
}
|
||||||
|
|
|
@ -611,7 +611,7 @@ 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 );
|
m_Parent->CreateNetlist( currPage->m_IdNetType, fullpath, netlist_opt, NULL, false );
|
||||||
|
|
||||||
WriteCurrentNetlistSetup();
|
WriteCurrentNetlistSetup();
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
|
||||||
netlist_opt |= NET_ADJUST_PASSIVE_VALS;
|
netlist_opt |= NET_ADJUST_PASSIVE_VALS;
|
||||||
|
|
||||||
if( ! m_Parent->CreateNetlist( currPage->m_IdNetType, fn.GetFullPath(),
|
if( ! m_Parent->CreateNetlist( currPage->m_IdNetType, fn.GetFullPath(),
|
||||||
netlist_opt ) )
|
netlist_opt, NULL, false ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ExecuteFile( this, ExecFile, CommandLine );
|
ExecuteFile( this, ExecFile, CommandLine );
|
||||||
|
@ -878,4 +878,3 @@ int InvokeDialogNetList( SCH_EDIT_FRAME* aCaller )
|
||||||
|
|
||||||
return dlg.ShowModal();
|
return dlg.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -650,11 +650,11 @@ bool SCH_EDIT_FRAME::ImportFile( const wxString aFileName)
|
||||||
|
|
||||||
g_RootSheet = pi->Load( fullFileName, &Kiway() );
|
g_RootSheet = pi->Load( fullFileName, &Kiway() );
|
||||||
|
|
||||||
|
|
||||||
wxString projectpath = Kiway().Prj().GetProjectPath();
|
wxString projectpath = Kiway().Prj().GetProjectPath();
|
||||||
|
wxFileName newfilename = Prj().AbsolutePath( Prj().GetProjectName() );
|
||||||
|
|
||||||
wxFileName newfilename( fullFileName );
|
newfilename.SetExt( SchematicFileExtension );
|
||||||
|
|
||||||
newfilename.SetPath(projectpath);
|
|
||||||
|
|
||||||
m_CurrentSheet->clear();
|
m_CurrentSheet->clear();
|
||||||
m_CurrentSheet->push_back( g_RootSheet );
|
m_CurrentSheet->push_back( g_RootSheet );
|
||||||
|
|
|
@ -110,20 +110,32 @@ void SCH_EDIT_FRAME::sendNetlist()
|
||||||
|
|
||||||
|
|
||||||
bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
||||||
unsigned aNetlistOptions, REPORTER* aReporter )
|
unsigned aNetlistOptions, REPORTER* aReporter, bool silent )
|
||||||
{
|
{
|
||||||
if( !prepareForNetlist() )
|
if( !silent )
|
||||||
return false;
|
{
|
||||||
|
if( !prepareForNetlist() )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SCH_SCREENS schematic;
|
||||||
|
schematic.UpdateSymbolLinks();
|
||||||
|
SCH_SHEET_LIST sheets( g_RootSheet );
|
||||||
|
sheets.AnnotatePowerSymbols( Prj().SchLibs() );
|
||||||
|
schematic.SchematicCleanUp();
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<NETLIST_OBJECT_LIST> connectedItemsList( BuildNetListBase() );
|
std::unique_ptr<NETLIST_OBJECT_LIST> connectedItemsList( BuildNetListBase() );
|
||||||
|
|
||||||
bool success = WriteNetListFile( connectedItemsList.release(), aFormat,
|
bool success = WriteNetListFile( connectedItemsList.release(), aFormat,
|
||||||
aFullFileName, aNetlistOptions, aReporter );
|
aFullFileName, aNetlistOptions, aReporter );
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#define NETLIST_DEBUG
|
//#define NETLIST_DEBUG
|
||||||
|
|
||||||
NETLIST_OBJECT_LIST::~NETLIST_OBJECT_LIST()
|
NETLIST_OBJECT_LIST::~NETLIST_OBJECT_LIST()
|
||||||
|
|
|
@ -371,8 +371,9 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, KIWAY* aKiway,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a schematic symbol library
|
// Create a schematic symbol library
|
||||||
wxFileName libfn = aFileName;
|
wxString projectpath = m_kiway->Prj().GetProjectPath();
|
||||||
libfn.SetName( libfn.GetName() );
|
wxFileName libfn = m_kiway->Prj().AbsolutePath( m_kiway->Prj().GetProjectName() );
|
||||||
|
|
||||||
libfn.SetExt( SchematicLibraryFileExtension );
|
libfn.SetExt( SchematicLibraryFileExtension );
|
||||||
std::unique_ptr<PART_LIB> lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, libfn.GetFullPath() ) );
|
std::unique_ptr<PART_LIB> lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, libfn.GetFullPath() ) );
|
||||||
lib->EnableBuffering();
|
lib->EnableBuffering();
|
||||||
|
|
|
@ -532,7 +532,8 @@ public:
|
||||||
bool CreateNetlist( int aFormat,
|
bool CreateNetlist( int aFormat,
|
||||||
const wxString& aFullFileName,
|
const wxString& aFullFileName,
|
||||||
unsigned aNetlistOptions,
|
unsigned aNetlistOptions,
|
||||||
REPORTER* aReporter = NULL ) override;
|
REPORTER* aReporter = NULL,
|
||||||
|
bool silent = false ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function WriteNetListFile
|
* Function WriteNetListFile
|
||||||
|
|
|
@ -214,7 +214,8 @@ public:
|
||||||
VTBL_ENTRY bool CreateNetlist( int aFormat,
|
VTBL_ENTRY bool CreateNetlist( int aFormat,
|
||||||
const wxString& aFullFileName,
|
const wxString& aFullFileName,
|
||||||
unsigned aNetlistOptions,
|
unsigned aNetlistOptions,
|
||||||
REPORTER* aReporter = NULL )
|
REPORTER* aReporter = NULL,
|
||||||
|
bool silent = false )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -89,6 +89,7 @@ extern const wxString LegacyPcbFileWildcard;
|
||||||
extern const wxString PcbFileWildcard;
|
extern const wxString PcbFileWildcard;
|
||||||
extern const wxString EaglePcbFileWildcard;
|
extern const wxString EaglePcbFileWildcard;
|
||||||
extern const wxString EagleSchematicFileWildcard;
|
extern const wxString EagleSchematicFileWildcard;
|
||||||
|
extern const wxString EagleFilesWildcard;
|
||||||
extern const wxString PCadPcbFileWildcard;
|
extern const wxString PCadPcbFileWildcard;
|
||||||
extern const wxString PdfFileWildcard;
|
extern const wxString PdfFileWildcard;
|
||||||
extern const wxString PSFileWildcard;
|
extern const wxString PSFileWildcard;
|
||||||
|
|
|
@ -67,7 +67,7 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
|
||||||
ClearMsg();
|
ClearMsg();
|
||||||
|
|
||||||
wxFileDialog schdlg( this, title, default_dir, wxEmptyString,
|
wxFileDialog schdlg( this, title, default_dir, wxEmptyString,
|
||||||
EagleSchematicFileWildcard, style );
|
EagleFilesWildcard, style );
|
||||||
|
|
||||||
if( schdlg.ShowModal() == wxID_CANCEL )
|
if( schdlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
@ -75,9 +75,12 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
|
||||||
|
|
||||||
wxFileName sch( schdlg.GetPath() );
|
wxFileName sch( schdlg.GetPath() );
|
||||||
|
|
||||||
|
sch.SetExt( SchematicFileExtension );
|
||||||
|
|
||||||
|
|
||||||
wxString protitle = _( "Kicad Project Destination" );
|
wxString protitle = _( "Kicad Project Destination" );
|
||||||
|
|
||||||
wxFileDialog prodlg( this, protitle, default_dir, wxEmptyString,
|
wxFileDialog prodlg( this, protitle, sch.GetPath(), sch.GetName(),
|
||||||
ProjectFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
ProjectFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
|
|
||||||
if( prodlg.ShowModal() == wxID_CANCEL )
|
if( prodlg.ShowModal() == wxID_CANCEL )
|
||||||
|
@ -122,80 +125,86 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
|
||||||
|
|
||||||
wxString sch_filename = sch.GetFullPath();
|
wxString sch_filename = sch.GetFullPath();
|
||||||
|
|
||||||
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) Kiway.Player( FRAME_SCH, false );
|
if( sch.FileExists() )
|
||||||
|
|
||||||
if( !schframe )
|
|
||||||
{
|
{
|
||||||
try
|
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) Kiway.Player( FRAME_SCH, false );
|
||||||
|
|
||||||
|
if( !schframe )
|
||||||
{
|
{
|
||||||
schframe = (SCH_EDIT_FRAME*) Kiway.Player( FRAME_SCH, true );
|
try
|
||||||
|
{
|
||||||
|
schframe = (SCH_EDIT_FRAME*) Kiway.Player( FRAME_SCH, true );
|
||||||
|
}
|
||||||
|
catch( IO_ERROR err )
|
||||||
|
{
|
||||||
|
wxMessageBox( _( "Eeschema failed to load:\n" ) + err.What(),
|
||||||
|
_( "KiCad Error" ), wxOK | wxICON_ERROR, this );
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch( IO_ERROR err )
|
|
||||||
|
schframe->ImportFile( sch_filename );
|
||||||
|
|
||||||
|
if( !schframe->IsShown() ) // the frame exists, (created by the dialog field editor)
|
||||||
|
// but no project loaded.
|
||||||
{
|
{
|
||||||
wxMessageBox( _( "Eeschema failed to load:\n" ) + err.What(),
|
schframe->Show( true );
|
||||||
_( "KiCad Error" ), wxOK | wxICON_ERROR, this );
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( schframe->IsIconized() )
|
||||||
|
schframe->Iconize( false );
|
||||||
|
|
||||||
|
schframe->Raise();
|
||||||
|
|
||||||
|
schframe->CreateNetlist( NET_TYPE_PCBNEW, netlist.GetFullPath(), 0, NULL, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
schframe->ImportFile( sch_filename );
|
if( pcb.FileExists() )
|
||||||
|
|
||||||
if( !schframe->IsShown() ) // the frame exists, (created by the dialog field editor)
|
|
||||||
// but no project loaded.
|
|
||||||
{
|
{
|
||||||
schframe->Show( true );
|
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway.Player( FRAME_PCB, false );
|
||||||
}
|
|
||||||
|
|
||||||
if( schframe->IsIconized() )
|
if( !pcbframe )
|
||||||
schframe->Iconize( false );
|
|
||||||
|
|
||||||
schframe->Raise();
|
|
||||||
|
|
||||||
|
|
||||||
// Calculate the netlist filename
|
|
||||||
wxString nestlistFileFullpath = netlist.GetFullPath();
|
|
||||||
schframe->CreateNetlist( NET_TYPE_PCBNEW, nestlistFileFullpath, 0 );
|
|
||||||
|
|
||||||
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway.Player( FRAME_PCB, false );
|
|
||||||
|
|
||||||
if( !pcbframe )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
pcbframe = (PCB_EDIT_FRAME*) Kiway.Player( FRAME_PCB, true );
|
try
|
||||||
|
{
|
||||||
|
pcbframe = (PCB_EDIT_FRAME*) Kiway.Player( FRAME_PCB, true );
|
||||||
|
}
|
||||||
|
catch( IO_ERROR err )
|
||||||
|
{
|
||||||
|
wxMessageBox( _( "Pcbnew failed to load:\n" ) + err.What(), _( "KiCad Error" ),
|
||||||
|
wxOK | wxICON_ERROR, this );
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch( IO_ERROR err )
|
|
||||||
|
// a pcb frame can be already existing, but not yet used.
|
||||||
|
// this is the case when running the footprint editor, or the footprint viewer first
|
||||||
|
// if the frame is not visible, the board is not yet loaded
|
||||||
|
if( !pcbframe->IsVisible() )
|
||||||
{
|
{
|
||||||
wxMessageBox( _( "Pcbnew failed to load:\n" ) + err.What(), _( "KiCad Error" ),
|
pcbframe->ImportFile( pcb.GetFullPath() );
|
||||||
wxOK | wxICON_ERROR, this );
|
pcbframe->Show( true );
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
// On Windows, Raise() does not bring the window on screen, when iconized
|
||||||
|
if( pcbframe->IsIconized() )
|
||||||
|
pcbframe->Iconize( false );
|
||||||
|
|
||||||
|
pcbframe->Raise();
|
||||||
|
|
||||||
|
if( netlist.FileExists() )
|
||||||
|
{
|
||||||
|
pcbframe->ReadPcbNetlist( netlist.GetFullPath(),
|
||||||
|
wxEmptyString,
|
||||||
|
NULL,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// a pcb frame can be already existing, but not yet used.
|
|
||||||
// this is the case when running the footprint editor, or the footprint viewer first
|
|
||||||
// if the frame is not visible, the board is not yet loaded
|
|
||||||
if( !pcbframe->IsVisible() )
|
|
||||||
{
|
|
||||||
pcbframe->ImportFile( pcb.GetFullPath() );
|
|
||||||
pcbframe->Show( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
// On Windows, Raise() does not bring the window on screen, when iconized
|
|
||||||
if( pcbframe->IsIconized() )
|
|
||||||
pcbframe->Iconize( false );
|
|
||||||
|
|
||||||
pcbframe->Raise();
|
|
||||||
|
|
||||||
pcbframe->ReadPcbNetlist( nestlistFileFullpath,
|
|
||||||
wxEmptyString,
|
|
||||||
NULL,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false );
|
|
||||||
|
|
||||||
ReCreateTreePrj();
|
ReCreateTreePrj();
|
||||||
}
|
}
|
||||||
|
|
|
@ -870,9 +870,10 @@ bool PCB_EDIT_FRAME::ImportFile( const wxString aFileName )
|
||||||
KICTL_EAGLE_BRD ) )
|
KICTL_EAGLE_BRD ) )
|
||||||
{
|
{
|
||||||
wxString projectpath = Kiway().Prj().GetProjectPath();
|
wxString projectpath = Kiway().Prj().GetProjectPath();
|
||||||
|
wxFileName newfilename = Prj().AbsolutePath( Prj().GetProjectName() );
|
||||||
|
|
||||||
|
newfilename.SetExt( KiCadPcbFileExtension );
|
||||||
|
|
||||||
wxFileName newfilename( aFileName );
|
|
||||||
newfilename.SetPath( projectpath );
|
|
||||||
|
|
||||||
GetBoard()->SetFileName( newfilename.GetFullPath() );
|
GetBoard()->SetFileName( newfilename.GetFullPath() );
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
|
|
Loading…
Reference in New Issue