63 { wxID_CANCEL,
_(
"Close" ) } } );
65 GetSizer()->SetSizeHints(
this);
72 void OnGenerate( wxCommandEvent& event )
override;
198 GetSizer()->SetSizeHints(
this );
208 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
210 if( dirDialog.ShowModal() == wxID_CANCEL )
213 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
215 wxMessageDialog dialog(
this,
_(
"Use a relative path?"),
_(
"Plot Output Directory" ),
216 wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
218 if( dialog.ShowModal() == wxID_YES )
222 if( !dirName.MakeRelativeTo( boardFilePath ) )
224 wxMessageBox(
_(
"Cannot make path relative (target volume different from board "
226 _(
"Plot Output Directory" ), wxOK | wxICON_ERROR );
242 dirStr.Replace( wxT(
"\\" ), wxT(
"/" ) );
271 std::function<bool( wxString* )> textResolver =
272 [&]( wxString* token ) ->
bool
282 wxFileName outputDir = wxFileName::DirName(
path );
289 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
295 fn.SetPath( outputDir.GetPath() );
306 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
312 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), filename );
315 msg.Printf(
_(
"Component count: %d." ), fpcount );
327 msg.Printf(
_(
"Failed to create file '%s'." ), filename );
334 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), filename );
337 msg.Printf(
_(
"Component count: %d." ), fpcount );
340 fullcount += fpcount;
341 msg.Printf(
_(
"Full component count: %d." ), fullcount );
355 bool useCSVfmt =
m_rbFormat->GetSelection() == 1;
359 int bottomSide =
true;
365 topSide, bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
370 wxMessageBox(
_(
"No footprint for automated placement." ) );
378 std::function<bool( wxString* )> textResolver =
379 [&]( wxString* token ) ->
bool
389 wxFileName outputDir = wxFileName::DirName(
path );
396 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
402 fn.SetPath( outputDir.GetPath() );
411 fn.SetName( fn.GetName() + wxT(
"-" ) + wxT(
"all" ) );
422 fn.SetExt( wxT(
"csv" ) );
431 bottomSide, useCSVfmt, useAuxOrigin,
435 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
442 msg.Printf(
_(
"Placement file: '%s'." ), fn.GetFullPath() );
444 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), fn.GetFullPath() );
448 msg.Printf(
_(
"Component count: %d." ), fpcount );
462 fn.SetPath( outputDir.GetPath() );
468 fn.SetExt( wxT(
"csv" ) );
477 bottomSide, useCSVfmt,
478 useAuxOrigin, negateBottomX );
482 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
491 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
494 msg.Printf(
_(
"Component count: %d." ), fpcount );
500 fullcount += fpcount;
501 msg.Printf(
_(
"Full component count: %d." ), fullcount );
519 bool aOnlySMD,
bool aNoTHItems,
bool aExcludeDNP,
520 bool aTopSide,
bool aBottomSide,
bool aFormatCSV,
521 bool aUseAuxOrigin,
bool aNegateBottomX )
523 FILE * file =
nullptr;
525 if( !aFullFileName.IsEmpty() )
527 file = wxFopen( aFullFileName, wxT(
"wt" ) );
529 if( file ==
nullptr )
535 aBottomSide, aFormatCSV, aUseAuxOrigin, aNegateBottomX );
546 fputs( data.c_str(), file );
559 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ), boardFilePath );
561 if( dirDialog.ShowModal() == wxID_CANCEL )
565 fn.SetPath( dirDialog.GetPath() );
566 fn.SetExt( wxT(
"rpt" ) );
575 msg.Printf(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() );
576 wxMessageBox( msg,
_(
"Footprint Report" ), wxICON_INFORMATION );
580 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
588 FILE* rptfile = wxFopen( aFullFilename, wxT(
"wt" ) );
590 if( rptfile ==
nullptr )
602 fputs( data.c_str(), rptfile );
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
int GeneratePosFile(const TOOL_EVENT &aEvent)
Information pertinent to a Pcbnew printed circuit board.
bool ResolveTextVar(wxString *token, int aDepth) const
const wxString & GetFileName() const
void SetupStandardButtons(std::map< int, wxString > aLabels={})
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
DIALOG_PLACE_FILE m_PlaceFile
PCBNEW_SETTINGS * GetPcbNewSettings() const
The main frame for Pcbnew.
int DoGenFootprintsPositionFile(const wxString &aFullFileName, bool aUnitsMM, bool aOnlySMD, bool aNoTHItems, bool aExcludeDNP, bool aTopSide, bool aBottomSide, bool aFormatCSV, bool aUseAuxOrigin, bool aNegateBottomX)
Create an ASCII footprint position file.
void GenFootprintsReport(wxCommandEvent &event)
Call DoGenFootprintsReport to create a footprint report file.
bool DoGenFootprintsReport(const wxString &aFullFilename, bool aUnitsMM)
Create an ASCII footprint report file giving some infos on footprints and board outlines.
Used to create Gerber drill files.
const wxString GetPlaceFileName(const wxString &aFullBaseFilename, PCB_LAYER_ID aLayer) const
int CreatePlaceFile(wxString &aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges)
Create an pnp gerber file.
The ASCII format of the kicad place file is:
static std::string GetFrontSideName()
std::string GenPositionData()
build a string filled with the position data
static std::string GetBackSideName()
std::string GenReportData()
build a string filled with the pad report data This report does not used options aForceSmdItems,...
The backing store for a PROJECT, in JSON format.
wxString m_PcbLastPath[LAST_PATH_SIZE]
MRU path storage.
virtual PROJECT_FILE & GetProjectFile() const
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 pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
void MsgPanelSetMinSize(const wxSize &aMinSize)
returns the reporter object that reports to this panel
void SetFileName(const wxString &aReportFileName)
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.
Classes used in place file generation.
const std::string FootprintPlaceFileExtension
int GetUserUnits()
Return the currently selected user unit value for the interface.
wxString output_directory
Definition of file extensions used in Kicad.