Drill dialog: creates the directory, when the path entered in dialog does not exist.
This commit is contained in:
parent
c8706e9c15
commit
000ee22e39
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2016 <Jean-Pierre Charras>
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2017 <Jean-Pierre Charras>
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.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
|
||||
|
@ -502,7 +502,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
|
|||
msg = ShowGBRShape();
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
|
||||
|
||||
// Display D_Code value:
|
||||
// Display D_Code value with its attributes:
|
||||
msg.Printf( _( "D Code %d" ), m_DCode );
|
||||
D_CODE* apertDescr = GetDcodeDescr();
|
||||
|
||||
|
@ -513,9 +513,9 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
|
|||
|
||||
aList.push_back( MSG_PANEL_ITEM( msg, text, RED ) );
|
||||
|
||||
// Display graphic layer number
|
||||
// Display graphic layer name
|
||||
msg = GERBER_FILE_IMAGE_LIST::GetImagesList().GetDisplayName( GetLayer(), true );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Graphic Layer" ), msg, BROWN ) );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Graphic Layer" ), msg, DARKGREEN ) );
|
||||
|
||||
// Display item rotation
|
||||
// The full rotation is Image rotation + m_lyrRotation
|
||||
|
@ -550,6 +550,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
|
|||
{
|
||||
net_msg = _( "Net:" );
|
||||
net_msg << " ";
|
||||
|
||||
if( m_netAttributes.m_Netname.IsEmpty() )
|
||||
net_msg << "<no net name>";
|
||||
else
|
||||
|
@ -569,8 +570,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
|
|||
cmp_pad_msg << " " << m_netAttributes.m_Cmpref;
|
||||
}
|
||||
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( net_msg, cmp_pad_msg, CYAN ) );
|
||||
aList.push_back( MSG_PANEL_ITEM( net_msg, cmp_pad_msg, DARKCYAN ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <kiface_i.h>
|
||||
#include <confirm.h>
|
||||
#include <pcbnew.h>
|
||||
#include <wxPcbStruct.h>
|
||||
#include <pcbplot.h>
|
||||
#include <gendrill_Excellon_writer.h>
|
||||
#include <gendrill_gerber_writer.h>
|
||||
//#include <macros.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_track.h>
|
||||
|
@ -386,7 +386,6 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
|
|||
UpdateConfig(); // set params and Save drill options
|
||||
|
||||
m_parent->ClearMsgPanel();
|
||||
wxString defaultPath = Prj().AbsolutePath( m_plotOpts.GetOutputDirectory() );
|
||||
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
|
||||
|
||||
const PlotFormat filefmt[6] =
|
||||
|
@ -400,6 +399,20 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
|
|||
if( choice >= DIM( filefmt ) )
|
||||
choice = 1;
|
||||
|
||||
// Create output directory if it does not exist (also transform it in
|
||||
// absolute form). Bail if it fails
|
||||
wxFileName outputDir = wxFileName::DirName( m_plotOpts.GetOutputDirectory() );
|
||||
wxString boardFilename = m_parent->GetBoard()->GetFileName();
|
||||
|
||||
if( !EnsureFileDirectoryExists( &outputDir, boardFilename, &reporter ) )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Could not write drill and/or map files to folder \"%s\"." ),
|
||||
GetChars( outputDir.GetPath() ) );
|
||||
DisplayError( this, msg );
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_drillFileType == 0 )
|
||||
{
|
||||
EXCELLON_WRITER excellonWriter( m_parent->GetBoard() );
|
||||
|
@ -408,7 +421,8 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
|
|||
excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset, m_Merge_PTH_NPTH );
|
||||
excellonWriter.SetMapFileFormat( filefmt[choice] );
|
||||
|
||||
excellonWriter.CreateDrillandMapFilesSet( defaultPath, aGenDrill, aGenMap, &reporter );
|
||||
excellonWriter.CreateDrillandMapFilesSet( outputDir.GetFullPath(),
|
||||
aGenDrill, aGenMap, &reporter );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -420,7 +434,8 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
|
|||
gerberWriter.SetOptions( m_FileDrillOffset );
|
||||
gerberWriter.SetMapFileFormat( filefmt[choice] );
|
||||
|
||||
gerberWriter.CreateDrillandMapFilesSet( defaultPath, aGenDrill, aGenMap, &reporter );
|
||||
gerberWriter.CreateDrillandMapFilesSet( outputDir.GetFullPath(),
|
||||
aGenDrill, aGenMap, &reporter );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue