Browse Source

kicad2step: Set correct file extension if no output file is specified

pull/13/head
Maciej Suminski 7 years ago
parent
commit
7037e422a8
  1. 32
      utils/kicad2step/kicad2step.cpp

32
utils/kicad2step/kicad2step.cpp

@ -43,6 +43,9 @@ public:
virtual bool OnCmdLineParsed(wxCmdLineParser& parser) override;
private:
///> Returns file extension for the selected output format
wxString getOutputExt() const;
#ifdef SUPPORTS_IGES
bool m_fmtIGES;
#endif
@ -250,23 +253,21 @@ int KICAD2MCAD::OnRun()
wxFileName tfname;
if( m_outputFile.empty() )
{
tfname.Assign( fname.GetFullPath() );
tfname.SetExt( getOutputExt() );
}
else
{
tfname.Assign( m_outputFile );
// Set the file extension if the user's requested file name does not have an extension.
if( !tfname.HasExt() )
{
#ifdef SUPPORTS_IGES
if( m_fmtIGES )
tfname.SetExt( "igs" );
else
#endif
tfname.SetExt( "stp" );
// Set the file extension if the user's requested
// file name does not have an extension.
if( !tfname.HasExt() )
tfname.SetExt( getOutputExt() );
}
wxString outfile = tfname.GetFullPath();
KICADPCB pcb;
pcb.SetOrigin( m_xOrigin, m_yOrigin );
@ -310,3 +311,14 @@ int KICAD2MCAD::OnRun()
return 0;
}
wxString KICAD2MCAD::getOutputExt() const
{
#ifdef SUPPORTS_IGES
if( m_fmtIGES )
return wxString( "igs" );
else
#endif
return wxString( "stp" );
}
Loading…
Cancel
Save