47#include <wx/filedlg.h>
79 { wxID_APPLY,
_(
"Generate Map File" ) },
80 { wxID_CANCEL,
_(
"Close" ) } } );
86 GetSizer()->SetSizeHints(
this );
110 GetSizer()->SetSizeHints(
this );
219 for(
PAD*
pad : footprint->Pads() )
221 if(
pad->GetDrillShape() == PAD_DRILL_SHAPE::CIRCLE )
223 if(
pad->GetDrillSize().x != 0 )
225 if(
pad->GetAttribute() == PAD_ATTRIB::NPTH )
233 if(
pad->GetDrillSize().x != 0 &&
pad->GetDrillSize().y != 0 )
235 if(
pad->GetAttribute() == PAD_ATTRIB::NPTH )
250 switch(
via->GetViaType() )
267 wxCommandEvent
dummy;
388 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
390 if( dirDialog.ShowModal() == wxID_CANCEL )
393 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
395 wxString defaultPath = fn.GetPathWithSep();
397 msg.Printf(
_(
"Do you want to use a path relative to\n'%s'?" ), defaultPath );
399 wxMessageDialog dialog(
this, msg,
_(
"Plot Output Directory" ),
400 wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
402 if( dialog.ShowModal() == wxID_YES )
404 if( !dirName.MakeRelativeTo( defaultPath ) )
406 wxMessageBox(
_(
"Cannot make path relative (target volume different from board "
408 _(
"Plot Output Directory" ), wxOK | wxICON_ERROR );
421 dirStr.Replace( wxT(
"\\" ), wxT(
"/" ) );
477 std::function<bool( wxString* )> textResolver =
478 [&]( wxString* token ) ->
bool
488 wxFileName outputDir = wxFileName::DirName(
path );
494 msg.Printf(
_(
"Could not write drill and/or map files to folder '%s'." ),
495 outputDir.GetPath() );
534 fn.SetName( fn.GetName() + wxT(
"-drl" ) );
540 if( defaultPath.IsEmpty() )
543 wxFileDialog dlg(
this,
_(
"Save Drill Report File" ), defaultPath, fn.GetFullName(),
546 if( dlg.ShowModal() == wxID_CANCEL )
569 msg.Printf(
_(
"Failed to create file '%s'." ), dlg.GetPath() );
574 msg.Printf(
_(
"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)
const VECTOR2I & GetAuxOrigin()
int GenerateDrillFiles(const TOOL_EVENT &aEvent)
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
bool ResolveTextVar(wxString *token, int aDepth) const
const FOOTPRINTS & Footprints() const
const TRACKS & Tracks() const
const wxString & GetFileName() const
const PCB_PLOT_PARAMS & GetPlotOptions() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Class DIALOG_GENDRILL_BASE.
wxRadioButton * m_rbExcellon
wxRadioBox * m_Choice_Drill_Offset
wxStaticText * m_staticTextPrecision
wxBoxSizer * m_buttonsSizer
STD_BITMAP_BUTTON * m_browseButton
wxStaticBoxSizer * bMsgSizer
wxStaticText * m_MicroViasInfoMsg
wxRadioButton * m_rbGerberX2
wxStaticText * m_PlatedPadsCountInfoMsg
wxCheckBox * m_Check_Mirror
wxCheckBox * m_Check_Merge_PTH_NPTH
wxButton * m_sdbSizerApply
wxStaticText * m_ThroughViasInfoMsg
wxRadioBox * m_Choice_Drill_Map
wxRadioBox * m_Choice_Unit
wxStaticText * m_BuriedViasInfoMsg
wxStaticText * m_NotPlatedPadsCountInfoMsg
wxRadioBox * m_radioBoxOvalHoleMode
wxTextCtrl * m_outputDirectoryName
wxRadioBox * m_Choice_Zeros_Format
wxTextCtrl * m_messagesBox
wxButton * m_buttonReport
wxCheckBox * m_Check_Minimal
PCB_PLOT_PARAMS m_plotOpts
VECTOR2I m_DrillFileOffset
void UpdatePrecisionOptions()
void onFileFormatSelection(wxCommandEvent &event) override
void OnSelDrillUnitsSelected(wxCommandEvent &event) override
bool TransferDataFromWindow() override
static bool m_MinimalHeader
static bool m_Merge_PTH_NPTH
PCB_EDIT_FRAME * m_pcbEditFrame
int m_platedPadsHoleCount
DIALOG_GENDRILL(PCB_EDIT_FRAME *aPcbEditFrame, wxWindow *aParent)
bool TransferDataToWindow() override
void OnGenReportFile(wxCommandEvent &event) override
void GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
Call the functions to create EXCELLON drill files and/or drill map files.
void OnSelZerosFmtSelected(wxCommandEvent &event) override
void OnGenDrillFile(wxCommandEvent &event) override
int m_blindOrBuriedViasCount
int m_notplatedPadsHoleCount
static int m_UnitDrillIsInch
void UpdateDrillParams()
Update board drill/plot parameters.
static bool m_UseRouteModeForOvalHoles
void OnGenMapFile(wxCommandEvent &event) override
bool m_drillOriginIsAuxAxis
void OnOutputDirectoryBrowseClicked(wxCommandEvent &event) override
DRILL_PRECISION m_Precision
static int m_drillFileType
JOB_EXPORT_PCB_DRILL * m_job
void SetupStandardButtons(std::map< int, wxString > aLabels={})
Helper to handle drill precision format in excellon files.
wxString GetPrecisionString()
virtual void ClearMsgPanel()
Clear all messages from the message panel.
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.
bool GenDrillReportFile(const wxString &aFullFileName)
Create a plain text report file giving a list of drill values and drill count for through holes,...
void SetMergeOption(bool aMerge)
Set the option to make separate drill files for PTH and NPTH.
Used to create Gerber drill files.
bool CreateDrillandMapFilesSet(const wxString &aPlotDirectory, bool aGenDrill, bool aGenMap, 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.
ZEROS_FORMAT m_zeroFormat
bool m_excellonOvalDrillRoute
DRILL_ORIGIN m_drillOrigin
bool m_excellonCombinePTHNPTH
bool m_excellonMinimalHeader
void SetOutputPath(const wxString &aPath)
wxString GetOutputPath() const
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.
DIALOG_GENERATE_DRILL m_GenDrill
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
PCBNEW_SETTINGS * GetPcbNewSettings() const
The main frame for Pcbnew.
void OnModify() override
Must be called after a board change to set the modified flag.
bool GetUseAuxOrigin() const
void SetOutputDirectory(const wxString &aDir)
wxString GetOutputDirectory() const
int GetGerberPrecision() const
bool IsSameAs(const PCB_PLOT_PARAMS &aPcbPlotParams) const
Compare current settings to aPcbPlotParams, including not saved parameters in brd file.
void SetUseAuxOrigin(bool aAux)
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.
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.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
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
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.