Pcbnew: fix drill file naming issue.
On windows when the project path include a remote volume name (\\NAME), the volume name does not get cleared by calling wxFileName.SetDir( "" ). This caused the volume name to be prepended to the file name when calling wxFileName::GetFullPath(). Use wxFileName::GetFullName() which resolves the issue. Fix some minor grammar errors. Fix some minor coding policy issues. Fixes lp:1606240 https://bugs.launchpad.net/kicad/+bug/1606240
This commit is contained in:
parent
7a4f1685df
commit
abf33cce68
|
@ -6,7 +6,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2012 Jean_Pierre Charras <jp.charras at wanadoo.fr>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -131,8 +131,8 @@ void DIALOG_GENDRILL::InitDisplayParams()
|
|||
m_Check_Mirror->SetValue( m_Mirror );
|
||||
m_Check_Merge_PTH_NPTH->SetValue( m_Merge_PTH_NPTH );
|
||||
m_Choice_Drill_Map->SetSelection( m_mapFileType );
|
||||
m_ViaDrillValue->SetLabel( _( "Use Netclasses values" ) );
|
||||
m_MicroViaDrillValue->SetLabel( _( "Use Netclasses values" ) );
|
||||
m_ViaDrillValue->SetLabel( _( "Use Netclass values" ) );
|
||||
m_MicroViaDrillValue->SetLabel( _( "Use Netclass values" ) );
|
||||
|
||||
// See if we have some buried vias or/and microvias, and display
|
||||
// microvias drill value if so
|
||||
|
@ -243,6 +243,7 @@ void DIALOG_GENDRILL::OnSelDrillUnitsSelected( wxCommandEvent& event )
|
|||
UpdatePrecisionOptions();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_GENDRILL::OnGenMapFile( wxCommandEvent& event )
|
||||
{
|
||||
GenDrillAndMapFiles( false, true);
|
||||
|
@ -302,8 +303,7 @@ void DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
|
|||
fn = Prj().AbsolutePath( m_parent->GetBoard()->GetFileName() );
|
||||
wxString defaultPath = fn.GetPathWithSep();
|
||||
wxString msg;
|
||||
msg.Printf( _( "Do you want to use a path relative to\n'%s'" ),
|
||||
GetChars( defaultPath ) );
|
||||
msg.Printf( _( "Do you want to use a path relative to\n'%s'" ), GetChars( defaultPath ) );
|
||||
|
||||
wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
|
||||
wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
|
||||
|
@ -352,7 +352,7 @@ void DIALOG_GENDRILL::SetParams()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
|
||||
void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
|
||||
{
|
||||
UpdateConfig(); // set params and Save drill options
|
||||
|
||||
|
@ -365,21 +365,19 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
|
|||
PLOT_FORMAT_HPGL, PLOT_FORMAT_POST, PLOT_FORMAT_GERBER,
|
||||
PLOT_FORMAT_DXF, PLOT_FORMAT_SVG, PLOT_FORMAT_PDF
|
||||
};
|
||||
|
||||
unsigned choice = (unsigned) m_Choice_Drill_Map->GetSelection();
|
||||
|
||||
if( choice >= DIM( filefmt ) )
|
||||
choice = 1;
|
||||
|
||||
EXCELLON_WRITER excellonWriter( m_parent->GetBoard() );
|
||||
excellonWriter.SetFormat( !m_UnitDrillIsInch,
|
||||
(EXCELLON_WRITER::ZEROS_FMT) m_ZerosFormat,
|
||||
excellonWriter.SetFormat( !m_UnitDrillIsInch, (EXCELLON_WRITER::ZEROS_FMT) m_ZerosFormat,
|
||||
m_Precision.m_lhs, m_Precision.m_rhs );
|
||||
excellonWriter.SetOptions( m_Mirror, m_MinimalHeader,
|
||||
m_FileDrillOffset, m_Merge_PTH_NPTH );
|
||||
excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset, m_Merge_PTH_NPTH );
|
||||
excellonWriter.SetMapFileFormat( filefmt[choice] );
|
||||
|
||||
excellonWriter.CreateDrillandMapFilesSet( defaultPath, aGenDrill, aGenMap,
|
||||
&reporter);
|
||||
excellonWriter.CreateDrillandMapFilesSet( defaultPath, aGenDrill, aGenMap, &reporter );
|
||||
}
|
||||
|
||||
|
||||
|
@ -397,19 +395,16 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
|
|||
if( defaultPath.IsEmpty() )
|
||||
defaultPath = wxStandardPaths::Get().GetDocumentsDir();
|
||||
|
||||
wxFileDialog dlg( this, _( "Save Drill Report File" ), defaultPath,
|
||||
fn.GetFullName(), wxGetTranslation( ReportFileWildcard ),
|
||||
wxFD_SAVE );
|
||||
wxFileDialog dlg( this, _( "Save Drill Report File" ), defaultPath, fn.GetFullName(),
|
||||
wxGetTranslation( ReportFileWildcard ), wxFD_SAVE );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
EXCELLON_WRITER excellonWriter( m_parent->GetBoard() );
|
||||
excellonWriter.SetFormat( !m_UnitDrillIsInch,
|
||||
(EXCELLON_WRITER::ZEROS_FMT) m_ZerosFormat,
|
||||
excellonWriter.SetFormat( !m_UnitDrillIsInch, (EXCELLON_WRITER::ZEROS_FMT) m_ZerosFormat,
|
||||
m_Precision.m_lhs, m_Precision.m_rhs );
|
||||
excellonWriter.SetOptions( m_Mirror, m_MinimalHeader,
|
||||
m_FileDrillOffset, m_Merge_PTH_NPTH );
|
||||
excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset, m_Merge_PTH_NPTH );
|
||||
|
||||
bool success = excellonWriter.GenDrillReportFile( dlg.GetPath() );
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* Copyright (C) 2015 Jean_Pierre Charras <jp.charras at wanadoo.fr>
|
||||
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -80,8 +80,8 @@ EXCELLON_WRITER::EXCELLON_WRITER( BOARD* aPcb )
|
|||
|
||||
|
||||
void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
|
||||
bool aGenDrill, bool aGenMap,
|
||||
REPORTER * aReporter )
|
||||
bool aGenDrill, bool aGenMap,
|
||||
REPORTER * aReporter )
|
||||
{
|
||||
wxFileName fn;
|
||||
wxString msg;
|
||||
|
@ -93,10 +93,10 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
|
|||
hole_sets.push_back( LAYER_PAIR( F_Cu, B_Cu ) );
|
||||
|
||||
for( std::vector<LAYER_PAIR>::const_iterator it = hole_sets.begin();
|
||||
it != hole_sets.end(); ++it )
|
||||
it != hole_sets.end(); ++it )
|
||||
{
|
||||
LAYER_PAIR pair = *it;
|
||||
// For separate drill files, the last layer pair is the NPTH dril file.
|
||||
// For separate drill files, the last layer pair is the NPTH drill file.
|
||||
bool doing_npth = m_merge_PTH_NPTH ? false : ( it == hole_sets.end() - 1 );
|
||||
|
||||
BuildHolesList( pair, doing_npth );
|
||||
|
@ -118,8 +118,7 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
|
|||
{
|
||||
if( aReporter )
|
||||
{
|
||||
msg.Printf( _( "** Unable to create %s **\n" ),
|
||||
GetChars( fullFilename ) );
|
||||
msg.Printf( _( "** Unable to create %s **\n" ), GetChars( fullFilename ) );
|
||||
aReporter->Report( msg );
|
||||
}
|
||||
break;
|
||||
|
@ -168,17 +167,6 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Creates the drill files in EXCELLON format
|
||||
* Number format:
|
||||
* - Floating point format
|
||||
* - integer format
|
||||
* - integer format: "Trailing Zero" ( TZ ) or "Leading Zero"
|
||||
* Units
|
||||
* - Decimal
|
||||
* - Metric
|
||||
*/
|
||||
int EXCELLON_WRITER::CreateDrillFile( FILE* aFile )
|
||||
{
|
||||
m_file = aFile;
|
||||
|
@ -207,25 +195,23 @@ int EXCELLON_WRITER::CreateDrillFile( FILE* aFile )
|
|||
DRILL_TOOL& tool_descr = m_toolListBuffer[ii];
|
||||
|
||||
#ifdef WRITE_PTH_NPTH_COMMENT
|
||||
if( writePTHcomment && !tool_descr.m_Hole_NotPlated )
|
||||
{
|
||||
writePTHcomment = false;
|
||||
fprintf( m_file, ";TYPE=PLATED\n" );
|
||||
}
|
||||
if( writePTHcomment && !tool_descr.m_Hole_NotPlated )
|
||||
{
|
||||
writePTHcomment = false;
|
||||
fprintf( m_file, ";TYPE=PLATED\n" );
|
||||
}
|
||||
|
||||
if( writeNPTHcomment && tool_descr.m_Hole_NotPlated )
|
||||
{
|
||||
writeNPTHcomment = false;
|
||||
fprintf( m_file, ";TYPE=NON_PLATED\n" );
|
||||
}
|
||||
if( writeNPTHcomment && tool_descr.m_Hole_NotPlated )
|
||||
{
|
||||
writeNPTHcomment = false;
|
||||
fprintf( m_file, ";TYPE=NON_PLATED\n" );
|
||||
}
|
||||
#endif
|
||||
|
||||
fprintf( m_file, "T%dC%.3f\n", ii + 1,
|
||||
tool_descr.m_Diameter * m_conversionUnits );
|
||||
fprintf( m_file, "T%dC%.3f\n", ii + 1, tool_descr.m_Diameter * m_conversionUnits );
|
||||
}
|
||||
|
||||
fputs( "%\n", m_file ); // End of header info
|
||||
|
||||
fputs( "G90\n", m_file ); // Absolute mode
|
||||
fputs( "G05\n", m_file ); // Drill mode
|
||||
|
||||
|
@ -485,8 +471,7 @@ void EXCELLON_WRITER::WriteEXCELLONHeader()
|
|||
wxString msg;
|
||||
msg << wxT("KiCad") << wxT( " " ) << GetBuildVersion();
|
||||
|
||||
fprintf( m_file, ";DRILL file {%s} date %s\n", TO_UTF8( msg ),
|
||||
TO_UTF8( DateAndTime() ) );
|
||||
fprintf( m_file, ";DRILL file {%s} date %s\n", TO_UTF8( msg ), TO_UTF8( DateAndTime() ) );
|
||||
msg = wxT( ";FORMAT={" );
|
||||
|
||||
// Print precision:
|
||||
|
@ -754,7 +739,8 @@ const std::string EXCELLON_WRITER::layerPairName( LAYER_PAIR aPair ) const
|
|||
}
|
||||
|
||||
|
||||
const wxString EXCELLON_WRITER::drillFileName( LAYER_PAIR aPair, bool aNPTH, bool aMerge_PTH_NPTH ) const
|
||||
const wxString EXCELLON_WRITER::drillFileName( LAYER_PAIR aPair, bool aNPTH,
|
||||
bool aMerge_PTH_NPTH ) const
|
||||
{
|
||||
wxASSERT( m_pcb );
|
||||
|
||||
|
@ -777,10 +763,9 @@ const wxString EXCELLON_WRITER::drillFileName( LAYER_PAIR aPair, bool aNPTH, boo
|
|||
wxFileName fn = m_pcb->GetFileName();
|
||||
|
||||
fn.SetName( fn.GetName() + extend );
|
||||
fn.SetPath( "" );
|
||||
fn.SetExt( DrillFileExtension );
|
||||
|
||||
wxString ret = fn.GetFullPath(); // show me in debugger
|
||||
wxString ret = fn.GetFullName(); // show me in debugger
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue