61 { wxID_CANCEL,
_(
"Close" ) } } );
67 GetSizer()->SetSizeHints(
this );
79 SetTitle(
m_job->GetSettingsDialogTitle() );
93 GetSizer()->SetSizeHints(
this );
171 event.Enable(
false );
175 event.Enable(
true );
192 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
194 if( dirDialog.ShowModal() == wxID_CANCEL )
197 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
199 if(
IsOK(
this,
_(
"Use a relative path?" ) ) )
201 wxString boardFilePath = ( (wxFileName)
m_editFrame->GetBoard()->GetFileName() ).GetPath();
203 if( !dirName.MakeRelativeTo( boardFilePath ) )
259 std::function<bool( wxString* )> textResolver =
260 [&]( wxString* token ) ->
bool
263 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
270 wxFileName outputDir = wxFileName::DirName(
path );
271 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
276 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
281 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
282 fn.SetPath( outputDir.GetPath() );
294 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
300 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), filename );
303 msg.Printf(
_(
"Component count: %d." ), fpcount );
316 msg.Printf(
_(
"Failed to create file '%s'." ), filename );
323 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), filename );
326 msg.Printf(
_(
"Component count: %d." ), fpcount );
329 fullcount += fpcount;
330 msg.Printf(
_(
"Full component count: %d." ), fullcount );
348 int bottomSide =
true;
354 ExcludeBOM(), topSide, bottomSide, useCSVfmt, useAuxOrigin,
360 wxMessageBox(
_(
"No footprint for automated placement." ) );
368 std::function<bool( wxString* )> textResolver =
369 [&]( wxString* token ) ->
bool
372 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
379 wxFileName outputDir = wxFileName::DirName(
path );
380 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
385 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
390 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
391 fn.SetPath( outputDir.GetPath() );
395 bottomSide = singleFile;
403 fn.SetExt( wxT(
"csv" ) );
408 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
411 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
418 msg.Printf(
_(
"Placement file: '%s'." ), fn.GetFullPath() );
420 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), fn.GetFullPath() );
424 msg.Printf(
_(
"Component count: %d." ), fpcount );
438 fn.SetPath( outputDir.GetPath() );
445 fn.SetExt( wxT(
"csv" ) );
450 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
454 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
463 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
466 msg.Printf(
_(
"Component count: %d." ), fpcount );
472 fullcount += fpcount;
473 msg.Printf(
_(
"Full component count: %d." ), fullcount );
491 bool aOnlySMD,
bool aNoTHItems,
bool aExcludeDNP,
492 bool aExcludeBOM,
bool aTopSide,
bool aBottomSide,
493 bool aFormatCSV,
bool aUseAuxOrigin,
bool aNegateBottomX )
495 FILE * file =
nullptr;
497 if( !aFullFileName.IsEmpty() )
499 file = wxFopen( aFullFileName, wxT(
"wt" ) );
501 if( file ==
nullptr )
507 aExcludeBOM, aTopSide, aBottomSide, aFormatCSV, aUseAuxOrigin,
519 fputs( data.c_str(), file );
532 wxString boardFilePath = ( (wxFileName)
board->GetFileName() ).GetPath();
533 wxDirDialog dirDialog(
m_frame,
_(
"Select Output Directory" ), boardFilePath );
535 if( dirDialog.ShowModal() == wxID_CANCEL )
538 fn =
board->GetFileName();
539 fn.SetPath( dirDialog.GetPath() );
540 fn.SetExt( wxT(
"rpt" ) );
542 FILE* rptfile = wxFopen( fn.GetFullPath(), wxT(
"wt" ) );
544 if( rptfile ==
nullptr )
546 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
547 _(
"Footprint Report" ), wxICON_INFORMATION );
564 fputs( data.c_str(), rptfile );
567 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
568 _(
"Footprint Report" ), wxICON_INFORMATION );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
int GenFootprintsReport(const TOOL_EVENT &aEvent)
int GeneratePosFile(const TOOL_EVENT &aEvent)
Information pertinent to a Pcbnew printed circuit board.
const wxString & GetFileName() const
void SetupStandardButtons(std::map< int, wxString > aLabels={})
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
The main frame for Pcbnew.
int DoGenFootprintsPositionFile(const wxString &aFullFileName, bool aUnitsMM, bool aOnlySMD, bool aNoTHItems, bool aExcludeDNP, bool aExcludeBOM, bool aTopSide, bool aBottomSide, bool aFormatCSV, bool aUseAuxOrigin, bool aNegateBottomX)
Create an ASCII footprint position file.
Used to create Gerber drill files.
const wxString GetPlaceFileName(const wxString &aFullBaseFilename, PCB_LAYER_ID aLayer) const
int CreatePlaceFile(const wxString &aFullFilename, PCB_LAYER_ID aLayer, bool aIncludeBrdEdges, bool aExcludeDNP, bool aExcludeBOM)
Create an pnp gerber file.
The ASCII format of the kicad place file is:
static wxString DecorateFilename(const wxString &aBaseName, bool aFront, bool aBack)
std::string GenPositionData()
build a string filled with the position data
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)
Report a string with a given severity.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
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.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
Classes used in place file generation.
static const std::string FootprintPlaceFileExtension
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition of file extensions used in Kicad.