65 { wxID_CANCEL,
_(
"Close" ) } } );
67 GetSizer()->SetSizeHints(
this);
74 void OnGenerate( wxCommandEvent& event )
override;
191 GetSizer()->SetSizeHints(
this );
200 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
202 if( dirDialog.ShowModal() == wxID_CANCEL )
205 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
207 wxMessageDialog dialog(
this,
_(
"Use a relative path?"),
_(
"Plot Output Directory" ),
208 wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
210 if( dialog.ShowModal() == wxID_YES )
214 if( !dirName.MakeRelativeTo( boardFilePath ) )
215 wxMessageBox(
_(
"Cannot make path relative (target volume different from board "
217 _(
"Plot Output Directory" ), wxOK | wxICON_ERROR );
232 dirStr.Replace( wxT(
"\\" ), wxT(
"/" ) );
262 std::function<bool( wxString* )> textResolver =
263 [&]( wxString* token ) ->
bool
273 wxFileName outputDir = wxFileName::DirName(
path );
280 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
286 fn.SetPath( outputDir.GetPath() );
297 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
303 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), filename );
306 msg.Printf(
_(
"Component count: %d." ), fpcount );
318 msg.Printf(
_(
"Failed to create file '%s'." ), filename );
325 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), filename );
328 msg.Printf(
_(
"Component count: %d." ), fpcount );
331 fullcount += fpcount;
332 msg.Printf(
_(
"Full component count: %d." ), fullcount );
347 bool useCSVfmt =
m_rbFormat->GetSelection() == 1;
351 int bottomSide =
true;
357 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
362 wxMessageBox(
_(
"No footprint for automated placement." ) );
370 std::function<bool( wxString* )> textResolver =
371 [&]( wxString* token ) ->
bool
381 wxFileName outputDir = wxFileName::DirName(
path );
388 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
394 fn.SetPath( outputDir.GetPath() );
403 fn.SetName( fn.GetName() + wxT(
"-" ) + wxT(
"all" ) );
414 fn.SetExt( wxT(
"csv" ) );
423 useCSVfmt, useAuxOrigin, negateBottomX );
426 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
433 msg.Printf(
_(
"Placement file: '%s'." ), fn.GetFullPath() );
435 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), fn.GetFullPath() );
439 msg.Printf(
_(
"Component count: %d." ), fpcount );
453 fn.SetPath( outputDir.GetPath() );
459 fn.SetExt( wxT(
"csv" ) );
468 useAuxOrigin, negateBottomX );
472 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
481 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
484 msg.Printf(
_(
"Component count: %d." ), fpcount );
490 fullcount += fpcount;
491 msg.Printf(
_(
"Full component count: %d." ), fullcount );
512 bool aOnlySMD,
bool aNoTHItems,
bool aTopSide,
513 bool aBottomSide,
bool aFormatCSV,
514 bool aUseAuxOrigin,
bool aNegateBottomX )
516 FILE * file =
nullptr;
518 if( !aFullFileName.IsEmpty() )
520 file = wxFopen( aFullFileName, wxT(
"wt" ) );
522 if( file ==
nullptr )
528 aFormatCSV, aUseAuxOrigin, aNegateBottomX );
539 fputs( data.c_str(), file );
552 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ), boardFilePath );
554 if( dirDialog.ShowModal() == wxID_CANCEL )
558 fn.SetPath( dirDialog.GetPath() );
559 fn.SetExt( wxT(
"rpt" ) );
568 msg.Printf(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() );
569 wxMessageBox( msg,
_(
"Footprint Report" ), wxICON_INFORMATION );
574 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
582 FILE* rptfile = wxFopen( aFullFilename, wxT(
"wt" ) );
584 if( rptfile ==
nullptr )
595 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 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,...
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.
EDA_UNITS GetUserUnits() const
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
wxString output_directory
Definition of file extensions used in Kicad.