61 { wxID_CANCEL,
_(
"Close" ) } } );
67 GetSizer()->SetSizeHints(
this );
79 SetTitle(
m_job->GetSettingsDialogTitle() );
93 GetSizer()->SetSizeHints(
this );
185 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
187 if( dirDialog.ShowModal() == wxID_CANCEL )
190 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
192 if(
IsOK(
this,
_(
"Use a relative path?" ) ) )
194 wxString boardFilePath = ( (wxFileName)
m_editFrame->GetBoard()->GetFileName() ).GetPath();
196 if( !dirName.MakeRelativeTo( boardFilePath ) )
251 std::function<bool( wxString* )> textResolver =
252 [&]( wxString* token ) ->
bool
255 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
262 wxFileName outputDir = wxFileName::DirName(
path );
263 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
268 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
273 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
274 fn.SetPath( outputDir.GetPath() );
286 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
292 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), filename );
295 msg.Printf(
_(
"Component count: %d." ), fpcount );
308 msg.Printf(
_(
"Failed to create file '%s'." ), filename );
315 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), filename );
318 msg.Printf(
_(
"Component count: %d." ), fpcount );
321 fullcount += fpcount;
322 msg.Printf(
_(
"Full component count: %d." ), fullcount );
340 int bottomSide =
true;
346 topSide, bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
351 wxMessageBox(
_(
"No footprint for automated placement." ) );
359 std::function<bool( wxString* )> textResolver =
360 [&]( wxString* token ) ->
bool
363 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
370 wxFileName outputDir = wxFileName::DirName(
path );
371 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
376 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
381 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
382 fn.SetPath( outputDir.GetPath() );
386 bottomSide = singleFile;
394 fn.SetExt( wxT(
"csv" ) );
399 useCSVfmt, useAuxOrigin, negateBottomX );
402 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
409 msg.Printf(
_(
"Placement file: '%s'." ), fn.GetFullPath() );
411 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), fn.GetFullPath() );
415 msg.Printf(
_(
"Component count: %d." ), fpcount );
429 fn.SetPath( outputDir.GetPath() );
436 fn.SetExt( wxT(
"csv" ) );
441 useCSVfmt, useAuxOrigin, negateBottomX );
445 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
454 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
457 msg.Printf(
_(
"Component count: %d." ), fpcount );
463 fullcount += fpcount;
464 msg.Printf(
_(
"Full component count: %d." ), fullcount );
482 bool aOnlySMD,
bool aNoTHItems,
bool aExcludeDNP,
483 bool aTopSide,
bool aBottomSide,
bool aFormatCSV,
484 bool aUseAuxOrigin,
bool aNegateBottomX )
486 FILE * file =
nullptr;
488 if( !aFullFileName.IsEmpty() )
490 file = wxFopen( aFullFileName, wxT(
"wt" ) );
492 if( file ==
nullptr )
498 aBottomSide, aFormatCSV, aUseAuxOrigin, aNegateBottomX );
509 fputs( data.c_str(), file );
522 wxString boardFilePath = ( (wxFileName)
board->GetFileName() ).GetPath();
523 wxDirDialog dirDialog(
m_frame,
_(
"Select Output Directory" ), boardFilePath );
525 if( dirDialog.ShowModal() == wxID_CANCEL )
528 fn =
board->GetFileName();
529 fn.SetPath( dirDialog.GetPath() );
530 fn.SetExt( wxT(
"rpt" ) );
532 FILE* rptfile = wxFopen( fn.GetFullPath(), wxT(
"wt" ) );
534 if( rptfile ==
nullptr )
536 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
537 _(
"Footprint Report" ), wxICON_INFORMATION );
553 fputs( data.c_str(), rptfile );
556 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
557 _(
"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 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)
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.