30#include <wx/filedlg.h>
74 m_plotOpts( aPcbEditFrame->GetPlotSettings() ),
80 { wxID_CANCEL,
_(
"Close" ) } } );
106 SetTitle(
m_job->GetSettingsDialogTitle() );
137 m_zeros->SetSelection(
static_cast<int>(
m_job->m_zeroFormat ) );
151 wxCommandEvent
dummy;
192 m_units->Enable( enbl_Excellon );
194 m_zeros->Enable( enbl_Excellon );
219 dirStr.Replace( wxT(
"\\" ), wxT(
"/" ) );
245 if(
m_units->GetSelection() == 1 )
275 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
277 if( dirDialog.ShowModal() == wxID_CANCEL )
280 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
281 wxFileName fn(
Prj().AbsolutePath(
m_board->GetFileName() ) );
282 wxString defaultPath = fn.GetPathWithSep();
284 if(
IsOK(
this, wxString::Format(
_(
"Do you want to use a path relative to\n'%s'?" ), defaultPath ) ) )
286 if( !dirName.MakeRelativeTo( defaultPath ) )
322 std::function<bool( wxString* )> textResolver =
323 [&]( wxString* token ) ->
bool
326 return m_board->ResolveTextVar( token, 0 );
333 wxFileName outputDir = wxFileName::DirName(
path );
334 wxString boardFilename =
m_board->GetFileName();
338 DisplayError(
this, wxString::Format(
_(
"Could not write drill and/or map files to folder '%s'." ),
339 outputDir.GetPath() ) );
349 drillFileOffset =
m_board->GetDesignSettings().GetAuxOrigin();
351 if(
m_units->GetSelection() == 0 )
389 wxFileName fn =
m_board->GetFileName();
391 fn.SetName( fn.GetName() + wxT(
"-drl" ) );
397 if( defaultPath.IsEmpty() )
400 wxFileDialog dlg(
this,
_(
"Save Drill Report File" ), defaultPath, fn.GetFullName(),
405 if( dlg.ShowModal() == wxID_CANCEL )
426 m_messagesBox->AppendText( wxString::Format(
_(
"Failed to create file '%s'." ), dlg.GetPath() ) );
428 m_messagesBox->AppendText( wxString::Format(
_(
"Report file '%s' created." ), dlg.GetPath() ) );
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
int GenerateDrillFiles(const TOOL_EVENT &aEvent)
wxRadioButton * m_rbExcellon
wxStaticText * m_staticTextPrecision
STD_BITMAP_BUTTON * m_browseButton
wxStaticBoxSizer * bMsgSizer
wxCheckBox * m_altDrillMode
wxStaticText * m_unitsLabel
wxChoice * m_choiceDrillMap
wxRadioButton * m_rbGerberX2
wxCheckBox * m_Check_Mirror
DIALOG_GENDRILL_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Generate Drill Files"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxCheckBox * m_Check_Merge_PTH_NPTH
wxStaticText * m_zerosLabel
wxTextCtrl * m_outputDirectoryName
wxCheckBox * m_cbGenerateMap
wxTextCtrl * m_messagesBox
wxCheckBox * m_generateTentingLayers
wxStaticText * m_precisionLabel
wxButton * m_buttonReport
wxCheckBox * m_Check_Minimal
PCB_PLOT_PARAMS m_plotOpts
void onOutputDirectoryBrowseClicked(wxCommandEvent &event) override
void onFileFormatSelection(wxCommandEvent &event) override
void genDrillAndMapFiles(bool aGenDrill, bool aGenMap, bool aGenTenting)
Call to create EXCELLON drill files and/or drill map files.
bool TransferDataFromWindow() override
PCB_EDIT_FRAME * m_pcbEditFrame
DIALOG_GENDRILL(PCB_EDIT_FRAME *aPcbEditFrame, wxWindow *aParent)
bool TransferDataToWindow() override
void onSelZerosFmtSelected(wxCommandEvent &event) override
void onGenReportFile(wxCommandEvent &event) override
JOB_EXPORT_PCB_DRILL * m_job
void onSelDrillUnitsSelected(wxCommandEvent &event) override
void updatePrecisionOptions()
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Helper to handle drill precision format in excellon files.
Create Excellon drill, drill map, and drill report files.
void SetFormat(bool aMetric, ZEROS_FMT aZerosFmt=DECIMAL_FORMAT, int aLeftDigits=0, int aRightDigits=0)
Initialize internal parameters to match the given format.
bool CreateDrillandMapFilesSet(const wxString &aPlotDirectory, bool aGenDrill, bool aGenMap, REPORTER *aReporter=nullptr)
Create the full set of Excellon drill file for the board.
void SetOptions(bool aMirror, bool aMinimalHeader, const VECTOR2I &aOffset, bool aMerge_PTH_NPTH)
Initialize internal parameters to match drill options.
void SetRouteModeForOvalHoles(bool aUseRouteModeForOvalHoles)
void SetMapFileFormat(PLOT_FORMAT aMapFmt)
Initialize the format for the drill map file.
void SetMergeOption(bool aMerge)
Set the option to make separate drill files for PTH and NPTH.
void SetPageInfo(const PAGE_INFO *aPageInfo)
Set the page info used to plot drill maps.
bool GenDrillReportFile(const wxString &aFullFileName, REPORTER *aReporter=nullptr)
Create a plain text report file giving a list of drill values and drill count for through holes,...
Used to create Gerber drill files.
bool CreateDrillandMapFilesSet(const wxString &aPlotDirectory, bool aGenDrill, bool aGenMap, bool aGenTenting, REPORTER *aReporter=nullptr)
Create the full set of Excellon drill file for the board filenames are computed from the board name,...
void SetOptions(const VECTOR2I &aOffset)
Initialize internal parameters to match drill options.
void SetFormat(int aRightDigits=6)
Initialize internal parameters to match the given format.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
static wxString GetDefaultUserProjectsPath()
Gets the default path we point users to create projects.
The main frame for Pcbnew.
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
A wrapper for reporting to a wxTextCtrl object.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
bool EnsureFileDirectoryExists(wxFileName *aTargetFullFileName, const wxString &aBaseFilename, REPORTER *aReporter)
Make aTargetFullFileName absolute and create the path of this file if it doesn't yet exist.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
static DRILL_PRECISION precisionListForInches(2, 4)
static DRILL_PRECISION precisionListForMetric(3, 3)
Classes used in drill files, map files and report files generation.
Classes used in drill files, map files and report files generation.
static const std::string ReportFileExtension
static wxString ReportFileWildcard()
PLOT_FORMAT
The set of supported output plot formats.
std::vector< FAB_LAYER_COLOR > dummy
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.