51 m_editFrame( aEditFrame ),
59 { { wxID_OK,
_(
"Generate Position File" ) }, { wxID_CANCEL,
_(
"Close" ) } } );
61 GetSizer()->SetSizeHints(
this );
71 m_editFrame( aEditFrame ),
79 GetSizer()->SetSizeHints(
this );
116 : EDA_UNITS::MILLIMETRES;
134 GetSizer()->SetSizeHints(
this );
233 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
235 if( dirDialog.ShowModal() == wxID_CANCEL )
238 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
240 wxMessageDialog dialog(
this,
_(
"Use a relative path?"),
_(
"Plot Output Directory" ),
241 wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
243 if( dialog.ShowModal() == wxID_YES )
247 if( !dirName.MakeRelativeTo( boardFilePath ) )
249 wxMessageBox(
_(
"Cannot make path relative (target volume different from board "
251 _(
"Plot Output Directory" ), wxOK | wxICON_ERROR );
269 dirStr.Replace( wxT(
"\\" ), wxT(
"/" ) );
315 std::function<bool( wxString* )> textResolver =
316 [&]( wxString* token ) ->
bool
326 wxFileName outputDir = wxFileName::DirName(
path );
333 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
339 fn.SetPath( outputDir.GetPath() );
350 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
356 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), filename );
359 msg.Printf(
_(
"Component count: %d." ), fpcount );
371 msg.Printf(
_(
"Failed to create file '%s'." ), filename );
378 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), filename );
381 msg.Printf(
_(
"Component count: %d." ), fpcount );
384 fullcount += fpcount;
385 msg.Printf(
_(
"Full component count: %d." ), fullcount );
399 bool useCSVfmt =
m_rbFormat->GetSelection() == 1;
403 int bottomSide =
true;
409 topSide, bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
414 wxMessageBox(
_(
"No footprint for automated placement." ) );
422 std::function<bool( wxString* )> textResolver =
423 [&]( wxString* token ) ->
bool
433 wxFileName outputDir = wxFileName::DirName(
path );
440 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
446 fn.SetPath( outputDir.GetPath() );
455 fn.SetName( fn.GetName() + wxT(
"-" ) + wxT(
"all" ) );
466 fn.SetExt( wxT(
"csv" ) );
475 bottomSide, useCSVfmt, useAuxOrigin,
479 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
486 msg.Printf(
_(
"Placement file: '%s'." ), fn.GetFullPath() );
488 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), fn.GetFullPath() );
492 msg.Printf(
_(
"Component count: %d." ), fpcount );
506 fn.SetPath( outputDir.GetPath() );
512 fn.SetExt( wxT(
"csv" ) );
521 bottomSide, useCSVfmt,
522 useAuxOrigin, negateBottomX );
526 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
535 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
538 msg.Printf(
_(
"Component count: %d." ), fpcount );
544 fullcount += fpcount;
545 msg.Printf(
_(
"Full component count: %d." ), fullcount );
563 bool aOnlySMD,
bool aNoTHItems,
bool aExcludeDNP,
564 bool aTopSide,
bool aBottomSide,
bool aFormatCSV,
565 bool aUseAuxOrigin,
bool aNegateBottomX )
567 FILE * file =
nullptr;
569 if( !aFullFileName.IsEmpty() )
571 file = wxFopen( aFullFileName, wxT(
"wt" ) );
573 if( file ==
nullptr )
579 aBottomSide, aFormatCSV, aUseAuxOrigin, aNegateBottomX );
590 fputs( data.c_str(), file );
603 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ), boardFilePath );
605 if( dirDialog.ShowModal() == wxID_CANCEL )
609 fn.SetPath( dirDialog.GetPath() );
610 fn.SetExt( wxT(
"rpt" ) );
619 msg.Printf(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() );
620 wxMessageBox( msg,
_(
"Footprint Report" ), wxICON_INFORMATION );
624 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
632 FILE* rptfile = wxFopen( aFullFilename, wxT(
"wt" ) );
634 if( rptfile ==
nullptr )
646 fputs( data.c_str(), rptfile );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
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={})
bool m_useDrillPlaceFileOrigin
bool m_excludeFootprintsWithTh
void SetOutputPath(const wxString &aPath)
wxString GetOutputPath() const
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(const 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.
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.
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.
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.
static 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.