44 #include <wx/msgdlg.h> 45 #include <wx/dirdlg.h> 46 #include <wx/filedlg.h> 85 GetSizer()->SetSizeHints(
this );
153 for(
PAD*
pad : footprint->Pads() )
157 if(
pad->GetDrillSize().x != 0 )
167 if(
pad->GetDrillSize().x != 0 &&
pad->GetDrillSize().y != 0 )
180 const PCB_VIA *
via = dynamic_cast<const PCB_VIA*>( track );
184 switch(
via->GetViaType() )
204 wxCommandEvent
dummy;
302 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
304 if( dirDialog.ShowModal() == wxID_CANCEL )
307 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
309 wxString defaultPath = fn.GetPathWithSep();
311 msg.Printf(
_(
"Do you want to use a path relative to\n'%s'?" ), defaultPath );
313 wxMessageDialog dialog(
this, msg,
_(
"Plot Output Directory" ),
314 wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
316 if( dialog.ShowModal() == wxID_YES )
318 if( !dirName.MakeRelativeTo( defaultPath ) )
320 wxMessageBox(
_(
"Cannot make path relative (target volume different from file volume)!" ),
321 _(
"Plot Output Directory" ), wxOK | wxICON_ERROR );
336 dirStr.Replace( wxT(
"\\" ), wxT(
"/" ) );
392 std::function<bool( wxString* )> textResolver =
393 [&]( wxString* token ) ->
bool 403 wxFileName outputDir = wxFileName::DirName(
path );
409 msg.Printf(
_(
"Could not write drill and/or map files to folder '%s'." ),
410 outputDir.GetPath() );
449 fn.SetName( fn.GetName() + wxT(
"-drl" ) );
455 if( defaultPath.IsEmpty() )
458 wxFileDialog dlg(
this,
_(
"Save Drill Report File" ), defaultPath, fn.GetFullName(),
461 if( dlg.ShowModal() == wxID_CANCEL )
484 msg.Printf(
_(
"Failed to create file '%s'." ), dlg.GetPath() );
489 msg.Printf(
_(
"Report file '%s' created." ), dlg.GetPath() );
static int m_UnitDrillIsInch
DIALOG_GENERATE_DRILL m_GenDrill
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
wxRadioBox * m_Choice_Drill_Map
wxStaticText * m_PlatedPadsCountInfoMsg
void OnModify() override
Must be called after a board change to set the modified flag.
void SetRouteModeForOvalHoles(bool aUseRouteModeForOvalHoles)
void OnGenDrillFile(wxCommandEvent &event) override
wxString GetPrecisionString()
const PCB_PLOT_PARAMS & GetPlotOptions() const
void UpdatePrecisionOptions()
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
void SetUseAuxOrigin(bool aAux)
This file is part of the common library.
wxRadioBox * m_Choice_Drill_Offset
void OnSelZerosFmtSelected(wxCommandEvent &event) override
int m_notplatedPadsHoleCount
Create Excellon drill, drill map, and drill report files.
wxCheckBox * m_Check_Merge_PTH_NPTH
void OnSelDrillUnitsSelected(wxCommandEvent &event) override
Class DIALOG_GENDRILL_BASE.
void SetOutputDirectory(const wxString &aDir)
static bool m_Merge_PTH_NPTH
wxCheckBox * m_Check_Mirror
static bool m_UseRouteModeForOvalHoles
void SetMergeOption(bool aMerge)
Set the option to make separate drill files for PTH and NPTH.
wxPoint m_DrillFileOffset
void SetFormat(int aRightDigits=6)
Initialize internal parameters to match the given format.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Used to create Gerber drill files.
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
const wxString & GetFileName() const
wxStaticText * m_NotPlatedPadsCountInfoMsg
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Helper to handle drill precision format in excellon files.
A wrapper for reporting to a wxTextCtrl object.
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.
wxRadioBox * m_Choice_Unit
void SetFormat(bool aMetric, ZEROS_FMT aZerosFmt=DECIMAL_FORMAT, int aLeftDigits=0, int aRightDigits=0)
Initialize internal parameters to match the given format.
Board plot function definition file.
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
wxRadioBox * m_radioBoxOvalHoleMode
static bool m_MinimalHeader
wxStaticText * m_MicroViasInfoMsg
like PAD_PTH, but not plated
int GetGerberPrecision() const
wxRadioButton * m_rbExcellon
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,...
bool IsSameAs(const PCB_PLOT_PARAMS &aPcbPlotParams) const
Compare current settings to aPcbPlotParams, including not saved parameters in brd file.
wxStaticText * m_BuriedViasInfoMsg
wxString ReportFileWildcard()
wxStaticText * m_ThroughViasInfoMsg
PLOT_FORMAT
The set of supported output plot formats.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
wxTextCtrl * m_outputDirectoryName
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.
FOOTPRINTS & Footprints()
wxTextCtrl * m_messagesBox
void 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,...
wxRadioBox * m_Choice_Zeros_Format
Definition of file extensions used in Kicad.
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
void SetOptions(bool aMirror, bool aMinimalHeader, const wxPoint &aOffset, bool aMerge_PTH_NPTH)
Initialize internal parameters to match drill options.
PCB_PLOT_PARAMS m_plotOpts
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
static DRILL_PRECISION precisionListForMetric(3, 3)
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
virtual void ClearMsgPanel()
Clear all messages from the message panel.
DIALOG_GENDRILL(PCB_EDIT_FRAME *aPcbEditFrame, wxWindow *aParent)
wxBitmapButton * m_browseButton
wxCheckBox * m_Check_Minimal
wxString GetOutputDirectory() const
wxButton * m_sdbSizerCancel
void SetOptions(const wxPoint &aOffset)
Initialize internal parameters to match drill options.
wxBoxSizer * m_buttonsSizer
static wxString GetDefaultUserProjectsPath()
Gets the default path we point users to create projects.
DRILL_PRECISION m_Precision
void onFileFormatSelection(wxCommandEvent &event) override
static int m_drillFileType
wxButton * m_sdbSizerApply
const wxPoint & GetAuxOrigin()
const std::string ReportFileExtension
int m_platedPadsHoleCount
bool m_drillOriginIsAuxAxis
The main frame for Pcbnew.
PCBNEW_SETTINGS * GetPcbNewSettings() const
Classes used in drill files, map files and report files generation.
void CreateDrillandMapFilesSet(const wxString &aPlotDirectory, bool aGenDrill, bool aGenMap, REPORTER *aReporter=nullptr)
Create the full set of Excellon drill file for the board.
wxStaticText * m_staticTextPrecision
Classes used in drill files, map files and report files generation.
void OnGenReportFile(wxCommandEvent &event) override
int GenerateDrillFiles(const TOOL_EVENT &aEvent)
void UpdateDrillParams()
Update board drill/plot parameters.
bool GetUseAuxOrigin() const
int m_blindOrBuriedViasCount
bool ResolveTextVar(wxString *token, int aDepth) const
void OnOutputDirectoryBrowseClicked(wxCommandEvent &event) override
void OnGenMapFile(wxCommandEvent &event) override
void GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
Call the functions to create EXCELLON drill files and/or drill map files.
wxRadioButton * m_rbGerberX2
static DRILL_PRECISION precisionListForInches(2, 4)
PCB_EDIT_FRAME * m_pcbEditFrame