72 GetSizer()->SetSizeHints(
this);
88 void OnGenerate( wxCommandEvent& event )
override;
158 m_fileOpt = cfg->m_PlaceFile.file_options;
174 GetSizer()->SetSizeHints(
this );
183 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ), path );
185 if( dirDialog.ShowModal() == wxID_CANCEL )
188 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
190 wxMessageDialog dialog(
this,
_(
"Use a relative path?"),
191 _(
"Plot Output Directory" ),
192 wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
194 if( dialog.ShowModal() == wxID_YES )
198 if( !dirName.MakeRelativeTo( boardFilePath ) )
199 wxMessageBox(
_(
"Cannot make path relative (target volume different from board file volume)!" ),
200 _(
"Plot Output Directory" ), wxOK | wxICON_ERROR );
216 cfg->m_PlaceFile.file_options =
m_fileOpt;
224 dirStr.Replace( wxT(
"\\" ), wxT(
"/" ) );
245 wxFileName outputDir = wxFileName::DirName( path );
252 msg.Printf(
_(
"Could not write plot files to folder \"%s\"." ),
253 outputDir.GetPath() );
259 fn.SetPath( outputDir.GetPath() );
270 msg.Printf(
_(
"Unable to create \"%s\"." ), fn.GetFullPath() );
276 msg.Printf(
_(
"Front (top side) placement file: \"%s\"." ), filename );
279 msg.Printf(
_(
"Component count: %d." ), fpcount );
291 msg.Printf(
_(
"Unable to create file \"%s\"." ), filename );
298 msg.Printf(
_(
"Back (bottom side) placement file: \"%s\"." ), filename );
301 msg.Printf(
_(
"Component count: %d." ), fpcount );
305 fullcount += fpcount;
306 msg.Printf(
_(
"Full component count: %d\n" ), fullcount );
324 int bottom_side =
true;
334 wxMessageBox(
_(
"No footprint for automated placement." ) );
349 msg.Printf(
_(
"Could not write plot files to folder \"%s\"." ), outputDir.GetPath() );
355 fn.SetPath( outputDir.GetPath() );
364 fn.SetName( fn.GetName() + wxT(
"-" ) + wxT(
"all") );
373 fn.SetExt( wxT(
"csv" ) );
383 msg.Printf(
_(
"Unable to create \"%s\"." ), fn.GetFullPath() );
390 msg.Printf(
_(
"Placement file: \"%s\"." ), fn.GetFullPath() );
392 msg.Printf(
_(
"Front (top side) placement file: \"%s\"." ),
396 msg.Printf(
_(
"Component count: %d." ), fpcount );
410 fn.SetPath( outputDir.GetPath() );
416 fn.SetExt( wxT(
"csv" ) );
422 top_side, bottom_side, useCSVfmt );
426 msg.Printf(
_(
"Unable to create file \"%s\"." ), fn.GetFullPath() );
435 msg.Printf(
_(
"Back (bottom side) placement file: \"%s\"." ), fn.GetFullPath() );
438 msg.Printf(
_(
"Component count: %d." ), fpcount );
445 fullcount += fpcount;
446 msg.Printf(
_(
"Full component count: %d\n" ), fullcount );
467 bool aForceSmdItems,
bool aTopSide,
468 bool aBottomSide,
bool aFormatCSV )
472 if( !aFullFileName.IsEmpty() )
474 file = wxFopen( aFullFileName, wxT(
"wt" ) );
493 fputs( data.c_str(), file );
506 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ), boardFilePath );
508 if( dirDialog.ShowModal() == wxID_CANCEL )
512 fn.SetPath( dirDialog.GetPath() );
513 fn.SetExt( wxT(
"rpt" ) );
521 msg.Printf(
_(
"Footprint report file created:\n\"%s\"" ), fn.GetFullPath() );
522 wxMessageBox( msg,
_(
"Footprint Report" ), wxICON_INFORMATION );
527 msg.Printf(
_(
"Unable to create \"%s\"" ), fn.GetFullPath() );
536 FILE* rptfile = wxFopen( aFullFilename, wxT(
"wt" ) );
538 if( rptfile ==
NULL )
545 fputs( data.c_str(), rptfile );
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
std::string GenPositionData()
build a string filled with the position data
Classes used in place file generation.
int CreatePlaceFile(wxString &aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges)
Creates an pnp gerber file.
This file is part of the common library TODO brief description.
This file is part of the common library.
const BITMAP_OPAQUE small_folder_xpm[1]
int GeneratePosFile(const TOOL_EVENT &aEvent)
const wxString ExpandEnvVarSubstitutions(const wxString &aString, PROJECT *aProject)
Replace any environment variable & text variable references with their values.
A pure virtual class used to derive REPORTER objects from.
const wxString & GetFileName() const
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
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.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
bool DoGenFootprintsReport(const wxString &aFullFilename, bool aUnitsMM)
Create an ASCII footprint report file giving some infos on footprints and board outlines.
void GenFootprintsReport(wxCommandEvent &event)
Call DoGenFootprintsReport to create a footprint report file.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
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.
Definition of file extensions used in Kicad.
virtual void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings)
void SetOutputDirectory(wxString aDir)
The ASCII format of the kicad place file is:
std::string GenReportData()
build a string filled with the pad report data This report does not used options aForceSmdItems,...
PCB_PLOT_PARAMS handles plot parameters and options when plotting/printing a board.
wxString GetOutputDirectory() const
const wxString GetPlaceFileName(const wxString &aFullBaseFilename, PCB_LAYER_ID aLayer) const
Information pertinent to a Pcbnew printed circuit board.
The main frame for Pcbnew.
PCBNEW_SETTINGS * GetPcbNewSettings() const
void MsgPanelSetMinSize(const wxSize &aMinSize)
returns the reporter object that reports to this panel
const std::string FootprintPlaceFileExtension
int DoGenFootprintsPositionFile(const wxString &aFullFileName, bool aUnitsMM, bool aForceSmdItems, bool aTopSide, bool aBottomSide, bool aFormatCSV=false)
Create an ASCII footprint position file.
void SetFileName(const wxString &aReportFileName)
PLACEFILE_GERBER_WRITER is a class mainly used to create Gerber drill files.
static std::string GetBackSideName()
static std::string GetFrontSideName()
EDA_UNITS GetUserUnits() const
Return the user units currently in use.