63 wxString currentVariant =
m_editFrame->GetBoard()->GetCurrentVariant();
65 if( !currentVariant.IsEmpty() )
67 int selection = m_variantChoiceCtrl->FindString( currentVariant );
69 if( selection != wxNOT_FOUND )
70 m_variantChoiceCtrl->SetSelection( selection );
72 m_variantChoiceCtrl->SetSelection( 0 );
76 m_variantChoiceCtrl->SetSelection( 0 );
80 { wxID_CANCEL,
_(
"Close" ) } } );
86 GetSizer()->SetSizeHints(
this );
98 SetTitle(
m_job->GetSettingsDialogTitle() );
115 GetSizer()->SetSizeHints(
this );
137 if( !
m_job->m_variant.IsEmpty() )
141 if( selection != wxNOT_FOUND )
207 event.Enable(
false );
211 event.Enable(
true );
228 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
230 if( dirDialog.ShowModal() == wxID_CANCEL )
233 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
235 if(
IsOK(
this,
_(
"Use a relative path?" ) ) )
237 wxString boardFilePath = ( (wxFileName)
m_editFrame->GetBoard()->GetFileName() ).GetPath();
239 if( !dirName.MakeRelativeTo( boardFilePath ) )
296 std::function<bool( wxString* )> textResolver =
297 [&]( wxString* token ) ->
bool
300 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
307 wxFileName outputDir = wxFileName::DirName(
path );
308 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
313 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
318 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
319 fn.SetPath( outputDir.GetPath() );
335 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
341 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), filename );
344 msg.Printf(
_(
"Component count: %d." ), fpcount );
357 msg.Printf(
_(
"Failed to create file '%s'." ), filename );
364 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), filename );
367 msg.Printf(
_(
"Component count: %d." ), fpcount );
370 fullcount += fpcount;
371 msg.Printf(
_(
"Full component count: %d." ), fullcount );
389 int bottomSide =
true;
395 ExcludeBOM(), topSide, bottomSide, useCSVfmt, useAuxOrigin,
405 wxMessageBox(
_(
"No footprint for automated placement." ) );
413 std::function<bool( wxString* )> textResolver =
414 [&]( wxString* token ) ->
bool
417 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
424 wxFileName outputDir = wxFileName::DirName(
path );
425 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
430 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
435 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
436 fn.SetPath( outputDir.GetPath() );
440 bottomSide = singleFile;
448 fn.SetExt( wxT(
"csv" ) );
453 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
456 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
463 msg.Printf(
_(
"Placement file: '%s'." ), fn.GetFullPath() );
465 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), fn.GetFullPath() );
469 msg.Printf(
_(
"Component count: %d." ), fpcount );
483 fn.SetPath( outputDir.GetPath() );
490 fn.SetExt( wxT(
"csv" ) );
495 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
499 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
508 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
511 msg.Printf(
_(
"Component count: %d." ), fpcount );
517 fullcount += fpcount;
518 msg.Printf(
_(
"Full component count: %d." ), fullcount );
533 if( ( selection != 0 ) && ( selection != wxNOT_FOUND ) )
549 bool aOnlySMD,
bool aNoTHItems,
bool aExcludeDNP,
550 bool aExcludeBOM,
bool aTopSide,
bool aBottomSide,
551 bool aFormatCSV,
bool aUseAuxOrigin,
bool aNegateBottomX )
553 FILE * file =
nullptr;
555 if( !aFullFileName.IsEmpty() )
557 file = wxFopen( aFullFileName, wxT(
"wt" ) );
559 if( file ==
nullptr )
565 aExcludeBOM, aTopSide, aBottomSide, aFormatCSV, aUseAuxOrigin,
581 fputs( data.c_str(), file );
594 wxString boardFilePath = ( (wxFileName)
board->GetFileName() ).GetPath();
595 wxDirDialog dirDialog(
m_frame,
_(
"Select Output Directory" ), boardFilePath );
597 if( dirDialog.ShowModal() == wxID_CANCEL )
600 fn =
board->GetFileName();
601 fn.SetPath( dirDialog.GetPath() );
602 fn.SetExt( wxT(
"rpt" ) );
604 FILE* rptfile = wxFopen( fn.GetFullPath(), wxT(
"wt" ) );
606 if( rptfile ==
nullptr )
608 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
609 _(
"Footprint Report" ), wxICON_INFORMATION );
630 fputs( data.c_str(), rptfile );
633 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
634 _(
"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
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.