51 m_editFrame( aEditFrame ),
59 { wxID_CANCEL,
_(
"Close" ) } } );
61 GetSizer()->SetSizeHints(
this );
71 m_editFrame( aEditFrame ),
79 GetSizer()->SetSizeHints(
this );
94 m_units = cfg->m_PlaceFile.units == 0 ? EDA_UNITS::INCH : EDA_UNITS::MM;
100 m_unitsCtrl->SetSelection( cfg->m_PlaceFile.units );
101 m_singleFile->SetValue( cfg->m_PlaceFile.file_options == 1 );
102 m_formatCtrl->SetSelection( cfg->m_PlaceFile.file_format );
105 m_onlySMD->SetValue( cfg->m_PlaceFile.only_SMD );
106 m_negateXcb->SetValue( cfg->m_PlaceFile.negate_xcoord );
107 m_excludeTH->SetValue( cfg->m_PlaceFile.exclude_TH );
139 GetSizer()->SetSizeHints(
this );
239 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
241 if( dirDialog.ShowModal() == wxID_CANCEL )
244 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
246 wxMessageDialog dialog(
this,
_(
"Use a relative path?"),
_(
"Plot Output Directory" ),
247 wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
249 if( dialog.ShowModal() == wxID_YES )
253 if( !dirName.MakeRelativeTo( boardFilePath ) )
255 wxMessageBox(
_(
"Cannot make path relative (target volume different from board "
257 _(
"Plot Output Directory" ), wxOK | wxICON_ERROR );
273 dirStr.Replace( wxT(
"\\" ), wxT(
"/" ) );
279 cfg->m_PlaceFile.output_directory = dirStr;
280 cfg->m_PlaceFile.units =
m_units == EDA_UNITS::INCH ? 0 : 1;
281 cfg->m_PlaceFile.file_options =
m_singleFile->GetValue() ? 1 : 0;
282 cfg->m_PlaceFile.file_format =
m_formatCtrl->GetSelection();
284 cfg->m_PlaceFile.exclude_TH =
m_excludeTH->GetValue();
285 cfg->m_PlaceFile.only_SMD =
m_onlySMD->GetValue();
287 cfg->m_PlaceFile.negate_xcoord =
m_negateXcb->GetValue();
324 std::function<bool( wxString* )> textResolver =
325 [&]( wxString* token ) ->
bool
335 wxFileName outputDir = wxFileName::DirName(
path );
342 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
348 fn.SetPath( outputDir.GetPath() );
360 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
366 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), filename );
369 msg.Printf(
_(
"Component count: %d." ), fpcount );
382 msg.Printf(
_(
"Failed to create file '%s'." ), filename );
389 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), filename );
392 msg.Printf(
_(
"Component count: %d." ), fpcount );
395 fullcount += fpcount;
396 msg.Printf(
_(
"Full component count: %d." ), fullcount );
414 int bottomSide =
true;
420 topSide, bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
425 wxMessageBox(
_(
"No footprint for automated placement." ) );
433 std::function<bool( wxString* )> textResolver =
434 [&]( wxString* token ) ->
bool
444 wxFileName outputDir = wxFileName::DirName(
path );
451 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
457 fn.SetPath( outputDir.GetPath() );
461 bottomSide = singleFile;
469 fn.SetExt( wxT(
"csv" ) );
474 useCSVfmt, useAuxOrigin, negateBottomX );
477 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
484 msg.Printf(
_(
"Placement file: '%s'." ), fn.GetFullPath() );
486 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), fn.GetFullPath() );
490 msg.Printf(
_(
"Component count: %d." ), fpcount );
504 fn.SetPath( outputDir.GetPath() );
511 fn.SetExt( wxT(
"csv" ) );
516 useCSVfmt, useAuxOrigin, negateBottomX );
520 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
529 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
532 msg.Printf(
_(
"Component count: %d." ), fpcount );
538 fullcount += fpcount;
539 msg.Printf(
_(
"Full component count: %d." ), fullcount );
557 bool aOnlySMD,
bool aNoTHItems,
bool aExcludeDNP,
558 bool aTopSide,
bool aBottomSide,
bool aFormatCSV,
559 bool aUseAuxOrigin,
bool aNegateBottomX )
561 FILE * file =
nullptr;
563 if( !aFullFileName.IsEmpty() )
565 file = wxFopen( aFullFileName, wxT(
"wt" ) );
567 if( file ==
nullptr )
573 aBottomSide, aFormatCSV, aUseAuxOrigin, aNegateBottomX );
584 fputs( data.c_str(), file );
598 wxDirDialog dirDialog(
m_frame,
_(
"Select Output Directory" ), boardFilePath );
600 if( dirDialog.ShowModal() == wxID_CANCEL )
604 fn.SetPath( dirDialog.GetPath() );
605 fn.SetExt( wxT(
"rpt" ) );
607 FILE* rptfile = wxFopen( fn.GetFullPath(), wxT(
"wt" ) );
609 if( rptfile ==
nullptr )
611 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
612 _(
"Footprint Report" ), wxICON_INFORMATION );
628 fputs( data.c_str(), rptfile );
631 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
632 _(
"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.
bool ResolveTextVar(wxString *token, int aDepth) const
const wxString & GetFileName() const
void SetupStandardButtons(std::map< int, wxString > aLabels={})
bool m_useDrillPlaceFileOrigin
bool m_excludeFootprintsWithTh
wxString GetSettingsDialogTitle() const override
void SetConfiguredOutputPath(const wxString &aPath)
Sets the configured output path for the job, this path is always saved to file.
wxString GetConfiguredOutputPath() const
Returns the configured output path for the job.
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.
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,...
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)
Report a string with a given severity.
EDA_UNITS GetUserUnits() const
void MsgPanelSetMinSize(const wxSize &aMinSize)
Set the min size of the area which displays html messages.
void SetFileName(const wxString &aReportFileName)
Set the report full file name to the string.
REPORTER & Reporter()
Return the reporter object that reports to this panel.
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)
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.
wxString output_directory
Definition of file extensions used in Kicad.