59 wxString currentVariant =
m_editFrame->GetBoard()->GetCurrentVariant();
61 if( !currentVariant.IsEmpty() )
63 int selection = m_variantChoiceCtrl->FindString( currentVariant );
65 if( selection != wxNOT_FOUND )
66 m_variantChoiceCtrl->SetSelection( selection );
68 m_variantChoiceCtrl->SetSelection( 0 );
72 m_variantChoiceCtrl->SetSelection( 0 );
76 { wxID_CANCEL,
_(
"Close" ) } } );
82 GetSizer()->SetSizeHints(
this );
94 SetTitle(
m_job->GetSettingsDialogTitle() );
111 GetSizer()->SetSizeHints(
this );
133 if( !
m_job->m_variant.IsEmpty() )
137 if( selection != wxNOT_FOUND )
203 event.Enable(
false );
207 event.Enable(
true );
224 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
226 if( dirDialog.ShowModal() == wxID_CANCEL )
229 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
231 if(
IsOK(
this,
_(
"Use a relative path?" ) ) )
233 wxString boardFilePath = ( (wxFileName)
m_editFrame->GetBoard()->GetFileName() ).GetPath();
235 if( !dirName.MakeRelativeTo( boardFilePath ) )
292 std::function<bool( wxString* )> textResolver =
293 [&]( wxString* token ) ->
bool
296 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
303 wxFileName outputDir = wxFileName::DirName(
path );
304 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
309 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
314 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
315 fn.SetPath( outputDir.GetPath() );
331 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
337 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), filename );
340 msg.Printf(
_(
"Component count: %d." ), fpcount );
353 msg.Printf(
_(
"Failed to create file '%s'." ), filename );
360 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), filename );
363 msg.Printf(
_(
"Component count: %d." ), fpcount );
366 fullcount += fpcount;
367 msg.Printf(
_(
"Full component count: %d." ), fullcount );
385 int bottomSide =
true;
391 ExcludeBOM(), topSide, bottomSide, useCSVfmt, useAuxOrigin,
401 wxMessageBox(
_(
"No footprint for automated placement." ) );
409 std::function<bool( wxString* )> textResolver =
410 [&]( wxString* token ) ->
bool
413 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
420 wxFileName outputDir = wxFileName::DirName(
path );
421 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
426 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
431 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
432 fn.SetPath( outputDir.GetPath() );
436 bottomSide = singleFile;
444 fn.SetExt( wxT(
"csv" ) );
449 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
452 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
459 msg.Printf(
_(
"Placement file: '%s'." ), fn.GetFullPath() );
461 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), fn.GetFullPath() );
465 msg.Printf(
_(
"Component count: %d." ), fpcount );
479 fn.SetPath( outputDir.GetPath() );
486 fn.SetExt( wxT(
"csv" ) );
491 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
495 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
504 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
507 msg.Printf(
_(
"Component count: %d." ), fpcount );
513 fullcount += fpcount;
514 msg.Printf(
_(
"Full component count: %d." ), fullcount );
529 if( ( selection != 0 ) && ( selection != wxNOT_FOUND ) )
545 bool aOnlySMD,
bool aNoTHItems,
bool aExcludeDNP,
546 bool aExcludeBOM,
bool aTopSide,
bool aBottomSide,
547 bool aFormatCSV,
bool aUseAuxOrigin,
bool aNegateBottomX )
549 FILE * file =
nullptr;
551 if( !aFullFileName.IsEmpty() )
553 file = wxFopen( aFullFileName, wxT(
"wt" ) );
555 if( file ==
nullptr )
561 aExcludeBOM, aTopSide, aBottomSide, aFormatCSV, aUseAuxOrigin,
577 fputs( data.c_str(), file );
590 wxString boardFilePath = ( (wxFileName)
board->GetFileName() ).GetPath();
591 wxDirDialog dirDialog(
m_frame,
_(
"Select Output Directory" ), boardFilePath );
593 if( dirDialog.ShowModal() == wxID_CANCEL )
596 fn =
board->GetFileName();
597 fn.SetPath( dirDialog.GetPath() );
598 fn.SetExt( wxT(
"rpt" ) );
600 FILE* rptfile = wxFopen( fn.GetFullPath(), wxT(
"wt" ) );
602 if( rptfile ==
nullptr )
604 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
605 _(
"Footprint Report" ), wxICON_INFORMATION );
626 fputs( data.c_str(), rptfile );
629 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
630 _(
"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 export.
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.
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.
IbisParser parser & reporter
Definition of file extensions used in Kicad.