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 )
161 static_cast<wxCheckBox*
>( aEvent.GetEventObject() )->SetValue(
false );
163 aEvent.Enable( aSupported );
220 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
222 if( dirDialog.ShowModal() == wxID_CANCEL )
225 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
227 if(
IsOK(
this,
_(
"Use a relative path?" ) ) )
229 wxString boardFilePath = ( (wxFileName)
m_editFrame->GetBoard()->GetFileName() ).GetPath();
231 if( !dirName.MakeRelativeTo( boardFilePath ) )
288 std::function<bool( wxString* )> textResolver =
289 [&]( wxString* token ) ->
bool
292 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
299 wxFileName outputDir = wxFileName::DirName(
path );
300 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
305 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
310 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
311 fn.SetPath( outputDir.GetPath() );
327 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
333 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), filename );
336 msg.Printf(
_(
"Component count: %d." ), fpcount );
349 msg.Printf(
_(
"Failed to create file '%s'." ), filename );
356 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), filename );
359 msg.Printf(
_(
"Component count: %d." ), fpcount );
362 fullcount += fpcount;
363 msg.Printf(
_(
"Full component count: %d." ), fullcount );
381 int bottomSide =
true;
387 ExcludeBOM(), topSide, bottomSide, useCSVfmt, useAuxOrigin,
397 wxMessageBox(
_(
"No footprint for automated placement." ) );
405 std::function<bool( wxString* )> textResolver =
406 [&]( wxString* token ) ->
bool
409 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
416 wxFileName outputDir = wxFileName::DirName(
path );
417 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
422 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
427 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
428 fn.SetPath( outputDir.GetPath() );
432 bottomSide = singleFile;
440 fn.SetExt( wxT(
"csv" ) );
445 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
448 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
455 msg.Printf(
_(
"Placement file: '%s'." ), fn.GetFullPath() );
457 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), fn.GetFullPath() );
461 msg.Printf(
_(
"Component count: %d." ), fpcount );
475 fn.SetPath( outputDir.GetPath() );
482 fn.SetExt( wxT(
"csv" ) );
487 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
491 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
500 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
503 msg.Printf(
_(
"Component count: %d." ), fpcount );
509 fullcount += fpcount;
510 msg.Printf(
_(
"Full component count: %d." ), fullcount );
525 if( ( selection != 0 ) && ( selection != wxNOT_FOUND ) )
541 bool aOnlySMD,
bool aNoTHItems,
bool aExcludeDNP,
542 bool aExcludeBOM,
bool aTopSide,
bool aBottomSide,
543 bool aFormatCSV,
bool aUseAuxOrigin,
bool aNegateBottomX )
545 FILE * file =
nullptr;
547 if( !aFullFileName.IsEmpty() )
549 file = wxFopen( aFullFileName, wxT(
"wt" ) );
551 if( file ==
nullptr )
557 aExcludeBOM, aTopSide, aBottomSide, aFormatCSV, aUseAuxOrigin,
573 fputs( data.c_str(), file );
586 wxString boardFilePath = ( (wxFileName)
board->GetFileName() ).GetPath();
587 wxDirDialog dirDialog(
m_frame,
_(
"Select Output Directory" ), boardFilePath );
589 if( dirDialog.ShowModal() == wxID_CANCEL )
592 fn =
board->GetFileName();
593 fn.SetPath( dirDialog.GetPath() );
594 fn.SetExt( wxT(
"rpt" ) );
596 FILE* rptfile = wxFopen( fn.GetFullPath(), wxT(
"wt" ) );
598 if( rptfile ==
nullptr )
600 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
601 _(
"Footprint Report" ), wxICON_INFORMATION );
622 fputs( data.c_str(), rptfile );
625 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
626 _(
"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={})
FILTER
The footprint selection filters that may be applied while generating position data.
static bool FormatSupportsFilter(FORMAT aFormat, FILTER aFilter)
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,...
A pure virtual class used to derive REPORTER objects from.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject, bool aAllowEscapes)
Replace any environment variable & text variable references with their values.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, RESOLUTION_CONTEXT aContext)
wxString ResolveProjectPath(const wxString &aPath, const PROJECT *aProject, const std::function< bool(wxString *)> *aTextResolver)
Expand a user-entered file path as ExpandPathVariables() does, then anchor a relative result at the p...
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.