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 );
221 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
223 if( dirDialog.ShowModal() == wxID_CANCEL )
226 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
228 if(
IsOK(
this,
_(
"Use a relative path?" ) ) )
230 wxString boardFilePath = ( (wxFileName)
m_editFrame->GetBoard()->GetFileName() ).GetPath();
232 if( !dirName.MakeRelativeTo( boardFilePath ) )
289 std::function<bool( wxString* )> textResolver =
290 [&]( wxString* token ) ->
bool
293 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
300 wxFileName outputDir = wxFileName::DirName(
path );
301 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
306 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
311 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
312 fn.SetPath( outputDir.GetPath() );
328 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
334 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), filename );
337 msg.Printf(
_(
"Component count: %d." ), fpcount );
350 msg.Printf(
_(
"Failed to create file '%s'." ), filename );
357 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), filename );
360 msg.Printf(
_(
"Component count: %d." ), fpcount );
363 fullcount += fpcount;
364 msg.Printf(
_(
"Full component count: %d." ), fullcount );
382 int bottomSide =
true;
388 ExcludeBOM(), topSide, bottomSide, useCSVfmt, useAuxOrigin,
398 wxMessageBox(
_(
"No footprint for automated placement." ) );
406 std::function<bool( wxString* )> textResolver =
407 [&]( wxString* token ) ->
bool
410 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
417 wxFileName outputDir = wxFileName::DirName(
path );
418 wxString boardFilename =
m_editFrame->GetBoard()->GetFileName();
423 msg.Printf(
_(
"Could not write plot files to folder '%s'." ), outputDir.GetPath() );
428 wxFileName fn =
m_editFrame->GetBoard()->GetFileName();
429 fn.SetPath( outputDir.GetPath() );
433 bottomSide = singleFile;
441 fn.SetExt( wxT(
"csv" ) );
446 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
449 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
456 msg.Printf(
_(
"Placement file: '%s'." ), fn.GetFullPath() );
458 msg.Printf(
_(
"Front (top side) placement file: '%s'." ), fn.GetFullPath() );
462 msg.Printf(
_(
"Component count: %d." ), fpcount );
476 fn.SetPath( outputDir.GetPath() );
483 fn.SetExt( wxT(
"csv" ) );
488 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
492 msg.Printf(
_(
"Failed to create file '%s'." ), fn.GetFullPath() );
501 msg.Printf(
_(
"Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
504 msg.Printf(
_(
"Component count: %d." ), fpcount );
510 fullcount += fpcount;
511 msg.Printf(
_(
"Full component count: %d." ), fullcount );
526 if( ( selection != 0 ) && ( selection != wxNOT_FOUND ) )
542 bool aOnlySMD,
bool aNoTHItems,
bool aExcludeDNP,
543 bool aExcludeBOM,
bool aTopSide,
bool aBottomSide,
544 bool aFormatCSV,
bool aUseAuxOrigin,
bool aNegateBottomX )
546 FILE * file =
nullptr;
548 if( !aFullFileName.IsEmpty() )
550 file = wxFopen( aFullFileName, wxT(
"wt" ) );
552 if( file ==
nullptr )
558 aExcludeBOM, aTopSide, aBottomSide, aFormatCSV, aUseAuxOrigin,
574 fputs( data.c_str(), file );
587 wxString boardFilePath = ( (wxFileName)
board->GetFileName() ).GetPath();
588 wxDirDialog dirDialog(
m_frame,
_(
"Select Output Directory" ), boardFilePath );
590 if( dirDialog.ShowModal() == wxID_CANCEL )
593 fn =
board->GetFileName();
594 fn.SetPath( dirDialog.GetPath() );
595 fn.SetExt( wxT(
"rpt" ) );
597 FILE* rptfile = wxFopen( fn.GetFullPath(), wxT(
"wt" ) );
599 if( rptfile ==
nullptr )
601 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
602 _(
"Footprint Report" ), wxICON_INFORMATION );
623 fputs( data.c_str(), rptfile );
626 wxMessageBox( wxString::Format(
_(
"Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
627 _(
"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,...
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, RESOLUTION_CONTEXT aContext)
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.