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() );
298 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
304 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), filename );
307 msg.Printf(
_(
"Component count: %d." ), fpcount );
320 msg.Printf(
_(
"Failed to create file '%s'." ), filename );
327 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), filename );
330 msg.Printf(
_(
"Component count: %d." ), fpcount );
333 fullcount += fpcount;
334 msg.Printf(
_(
"Full component count: %d." ), fullcount );
352 int bottomSide =
true;
358 ExcludeBOM(), topSide, bottomSide, useCSVfmt, useAuxOrigin,
368 wxMessageBox(
_(
"No footprint for automated placement." ) );
376 std::function<bool( wxString* )> textResolver =
377 [&]( wxString* token ) ->
bool
380 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
387 wxFileName outputDir = wxFileName::DirName(
path );
388 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
393 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
398 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
399 fn.SetPath( outputDir.GetPath() );
403 bottomSide = singleFile;
411 fn.SetExt( wxT(
"csv" ) );
416 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
419 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
426 msg.Printf(
_(
"Placement file: '%s'." ), fn.GetFullPath() );
428 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), fn.GetFullPath() );
432 msg.Printf(
_(
"Component count: %d." ), fpcount );
446 fn.SetPath( outputDir.GetPath() );
453 fn.SetExt( wxT(
"csv" ) );
458 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
462 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
471 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
474 msg.Printf(
_(
"Component count: %d." ), fpcount );
480 fullcount += fpcount;
481 msg.Printf(
_(
"Full component count: %d." ), fullcount );
499 bool aOnlySMD,
bool aNoTHItems,
bool aExcludeDNP,
500 bool aExcludeBOM,
bool aTopSide,
bool aBottomSide,
501 bool aFormatCSV,
bool aUseAuxOrigin,
bool aNegateBottomX )
503 FILE * file =
nullptr;
505 if( !aFullFileName.IsEmpty() )
507 file = wxFopen( aFullFileName, wxT(
"wt" ) );
509 if( file ==
nullptr )
515 aExcludeBOM, aTopSide, aBottomSide, aFormatCSV, aUseAuxOrigin,
531 fputs( data.c_str(), file );
544 wxString boardFilePath = ( (wxFileName)
board->GetFileName() ).GetPath();
545 wxDirDialog dirDialog(
m_frame,
_(
"Select Output Directory" ), boardFilePath );
547 if( dirDialog.ShowModal() == wxID_CANCEL )
550 fn =
board->GetFileName();
551 fn.SetPath( dirDialog.GetPath() );
552 fn.SetExt( wxT(
"rpt" ) );
554 FILE* rptfile = wxFopen( fn.GetFullPath(), wxT(
"wt" ) );
556 if( rptfile ==
nullptr )
558 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
559 _(
"Footprint Report" ), wxICON_INFORMATION );
580 fputs( data.c_str(), rptfile );
583 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
584 _(
"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
wxString GetCurrentVariant() 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
void SetVariant(const wxString &aVariant)
Set the variant name for variant-aware filtering.
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
void SetVariant(const wxString &aVariant)
Set the variant name for variant-aware DNP filtering.
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.