47#include <wx/filedlg.h>
77 { wxID_APPLY,
_(
"Generate Map File" ) },
78 { wxID_CANCEL,
_(
"Close" ) } } );
84 GetSizer()->SetSizeHints(
this );
152 for(
PAD*
pad : footprint->Pads() )
156 if(
pad->GetDrillSize().x != 0 )
158 if(
pad->GetAttribute() == PAD_ATTRIB::NPTH )
166 if(
pad->GetDrillSize().x != 0 &&
pad->GetDrillSize().y != 0 )
168 if(
pad->GetAttribute() == PAD_ATTRIB::NPTH )
183 switch(
via->GetViaType() )
203 wxCommandEvent
dummy;
301 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
303 if( dirDialog.ShowModal() == wxID_CANCEL )
306 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
308 wxString defaultPath = fn.GetPathWithSep();
310 msg.Printf(
_(
"Do you want to use a path relative to\n'%s'?" ), defaultPath );
312 wxMessageDialog dialog(
this, msg,
_(
"Plot Output Directory" ),
313 wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
315 if( dialog.ShowModal() == wxID_YES )
317 if( !dirName.MakeRelativeTo( defaultPath ) )
319 wxMessageBox(
_(
"Cannot make path relative (target volume different from board "
321 _(
"Plot Output Directory" ), wxOK | wxICON_ERROR );
334 dirStr.Replace( wxT(
"\\" ), wxT(
"/" ) );
390 std::function<bool( wxString* )> textResolver =
391 [&]( wxString* token ) ->
bool
401 wxFileName outputDir = wxFileName::DirName(
path );
407 msg.Printf(
_(
"Could not write drill and/or map files to folder '%s'." ),
408 outputDir.GetPath() );
447 fn.SetName( fn.GetName() + wxT(
"-drl" ) );
453 if( defaultPath.IsEmpty() )
456 wxFileDialog dlg(
this,
_(
"Save Drill Report File" ), defaultPath, fn.GetFullName(),
459 if( dlg.ShowModal() == wxID_CANCEL )
482 msg.Printf(
_(
"Failed to create file '%s'." ), dlg.GetPath() );
487 msg.Printf(
_(
"Report file '%s' created." ), dlg.GetPath() );
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
const VECTOR2I & GetAuxOrigin()
int GenerateDrillFiles(const TOOL_EVENT &aEvent)
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
bool ResolveTextVar(wxString *token, int aDepth) const
FOOTPRINTS & Footprints()
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
wxStaticText * m_MicroViasInfoMsg
wxRadioButton * m_rbGerberX2
wxStaticText * m_PlatedPadsCountInfoMsg
wxCheckBox * m_Check_Mirror
wxCheckBox * m_Check_Merge_PTH_NPTH
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
wxCheckBox * m_Check_Minimal
PCB_PLOT_PARAMS m_plotOpts
VECTOR2I m_DrillFileOffset
void UpdatePrecisionOptions()
void onFileFormatSelection(wxCommandEvent &event) override
void OnSelDrillUnitsSelected(wxCommandEvent &event) 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)
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
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.
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.
const std::string ReportFileExtension
wxString ReportFileWildcard()
PLOT_FORMAT
The set of supported output plot formats.
std::vector< FAB_LAYER_COLOR > dummy
Definition of file extensions used in Kicad.