Accept all Altium PCB extensions on import
When importing an Altium project, the handler only recognized PcbDoc files. Projects that reference Circuit Studio, Circuit Maker, or SolidWorks PCB files (CSPcbDoc, CMPcbDoc, SWPcbDoc) had their board silently skipped. Map each extension to its correct PCB_IO plugin type so the right parser is used.
This commit is contained in:
+28
-4
@@ -238,10 +238,29 @@ void IMPORT_PROJ_HELPER::AltiumProjectHandler()
|
||||
long groupid;
|
||||
|
||||
std::set<wxString> sch_file;
|
||||
std::set<wxString> pcb_file;
|
||||
std::set<wxString> sch_libs;
|
||||
std::set<wxString> pcb_libs;
|
||||
|
||||
wxString pcb_file;
|
||||
int pcb_file_type = PCB_IO_MGR::ALTIUM_DESIGNER;
|
||||
|
||||
auto matchPcbExt = []( const wxString& aExt ) -> int
|
||||
{
|
||||
if( !aExt.CmpNoCase( wxS( "PcbDoc" ) ) )
|
||||
return PCB_IO_MGR::ALTIUM_DESIGNER;
|
||||
|
||||
if( !aExt.CmpNoCase( wxS( "CSPcbDoc" ) ) )
|
||||
return PCB_IO_MGR::ALTIUM_CIRCUIT_STUDIO;
|
||||
|
||||
if( !aExt.CmpNoCase( wxS( "CMPcbDoc" ) ) )
|
||||
return PCB_IO_MGR::ALTIUM_CIRCUIT_MAKER;
|
||||
|
||||
if( !aExt.CmpNoCase( wxS( "SWPcbDoc" ) ) )
|
||||
return PCB_IO_MGR::SOLIDWORKS_PCB;
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
for( bool more = config.GetFirstGroup( groupname, groupid ); more;
|
||||
more = config.GetNextGroup( groupname, groupid ) )
|
||||
{
|
||||
@@ -264,8 +283,13 @@ void IMPORT_PROJ_HELPER::AltiumProjectHandler()
|
||||
if( !fname.IsAbsolute() )
|
||||
fname.MakeAbsolute( m_InputFile.GetPath() );
|
||||
|
||||
if( !fname.GetExt().CmpNoCase( "PCBDOC" ) )
|
||||
pcb_file.insert( fname.GetFullPath() );
|
||||
int pcbType = matchPcbExt( fname.GetExt() );
|
||||
|
||||
if( pcbType >= 0 && pcb_file.empty() )
|
||||
{
|
||||
pcb_file = fname.GetFullPath();
|
||||
pcb_file_type = pcbType;
|
||||
}
|
||||
|
||||
if( !fname.GetExt().CmpNoCase( "SCHDOC" ) )
|
||||
sch_file.insert( fname.GetFullPath() );
|
||||
@@ -294,7 +318,7 @@ void IMPORT_PROJ_HELPER::AltiumProjectHandler()
|
||||
doImport( "", FRAME_SCH, SCH_IO_MGR::SCH_ALTIUM );
|
||||
|
||||
if( !pcb_file.empty() )
|
||||
doImport( *pcb_file.begin(), FRAME_PCB_EDITOR, PCB_IO_MGR::ALTIUM_DESIGNER );
|
||||
doImport( pcb_file, FRAME_PCB_EDITOR, pcb_file_type );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -178,7 +178,8 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle,
|
||||
void KICAD_MANAGER_FRAME::OnImportAltiumProjectFiles( wxCommandEvent& event )
|
||||
{
|
||||
ImportNonKiCadProject( _( "Import Altium Project Files" ),
|
||||
FILEEXT::AltiumProjectFilesWildcard(), { "SchDoc" }, { "PcbDoc" },
|
||||
FILEEXT::AltiumProjectFilesWildcard(), { "SchDoc" },
|
||||
{ "PcbDoc", "CSPcbDoc", "CMPcbDoc", "SWPcbDoc" },
|
||||
SCH_IO_MGR::SCH_ALTIUM, PCB_IO_MGR::ALTIUM_DESIGNER );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user