KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_gen_footprint_position.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24/*
25 * 1 - create ASCII files for automatic placement of smd components
26 * 2 - create a footprint report (pos and footprint descr) (ascii file)
27 */
28
30
31#include <wx/dirdlg.h>
32#include <wx/msgdlg.h>
33
34#include <board.h>
35#include <confirm.h>
36#include <pcb_edit_frame.h>
38#include <bitmaps.h>
39#include <reporter.h>
42#include <kiface_base.h>
43#include <string_utils.h>
49
50
53 m_editFrame( aEditFrame ),
54 m_job( nullptr )
55{
56 m_messagesPanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
57 m_messagesPanel->MsgPanelSetMinSize( wxSize( -1, 160 ) );
58
60
61 m_variantChoiceCtrl->Append( m_editFrame->GetBoard()->GetVariantNamesForUI() );
62
63 wxString currentVariant = m_editFrame->GetBoard()->GetCurrentVariant();
64
65 if( !currentVariant.IsEmpty() )
66 {
67 int selection = m_variantChoiceCtrl->FindString( currentVariant );
68
69 if( selection != wxNOT_FOUND )
70 m_variantChoiceCtrl->SetSelection( selection );
71 else
72 m_variantChoiceCtrl->SetSelection( 0 );
73 }
74 else
75 {
76 m_variantChoiceCtrl->SetSelection( 0 );
77 }
78
79 SetupStandardButtons( { { wxID_OK, _( "Generate Position File" ) },
80 { wxID_CANCEL, _( "Close" ) } } );
81
82 // DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and
83 // non-job versions.
84 m_hash_key = TO_UTF8( GetTitle() );
85
86 GetSizer()->SetSizeHints( this );
87 Centre();
88}
89
90
92 PCB_EDIT_FRAME* aEditFrame,
93 wxWindow* aParent ) :
95 m_editFrame( aEditFrame ),
96 m_job( aJob )
97{
98 SetTitle( m_job->GetSettingsDialogTitle() );
99
100 m_browseButton->Hide();
102 m_staticTextDir->SetLabel( _( "Output file:" ) );
103
104 if( m_editFrame && m_editFrame->GetBoard() )
105 m_variantChoiceCtrl->Append( m_editFrame->GetBoard()->GetVariantNamesForUI() );
106
107 m_messagesPanel->Hide();
108
110
111 // DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and
112 // non-job versions.
113 m_hash_key = TO_UTF8( GetTitle() );
114
115 GetSizer()->SetSizeHints( this );
116 Centre();
117}
118
119
121{
122 if( m_job )
123 {
124 m_outputDirectoryName->SetValue( m_job->GetConfiguredOutputPath() );
125
126 m_unitsCtrl->SetSelection( static_cast<int>( m_job->m_units ) );
127 m_singleFile->SetValue( m_job->m_singleFile );
128 m_formatCtrl->SetSelection( static_cast<int>( m_job->m_format ) );
129 m_cbIncludeBoardEdge->SetValue( m_job->m_gerberBoardEdge );
130 m_useDrillPlaceOrigin->SetValue( m_job->m_useDrillPlaceFileOrigin );
131 m_onlySMD->SetValue( m_job->m_smdOnly );
132 m_negateXcb->SetValue( m_job->m_negateBottomX );
133 m_excludeTH->SetValue( m_job->m_excludeFootprintsWithTh );
134 m_excludeDNP->SetValue( m_job->m_excludeDNP );
135 m_excludeBOM->SetValue( m_job->m_excludeBOM );
136
137 if( !m_job->m_variant.IsEmpty() )
138 {
139 int selection = m_variantChoiceCtrl->FindString( m_job->m_variant );
140
141 if( selection != wxNOT_FOUND )
142 m_variantChoiceCtrl->SetSelection( selection );
143 else
144 m_variantChoiceCtrl->SetSelection( 0 );
145 }
146 else
147 {
148 m_variantChoiceCtrl->SetSelection( 0 );
149 }
150 }
151
152 return true;
153}
154
155
157{
158 m_unitsLabel->Enable( m_formatCtrl->GetSelection() != 2 );
159 m_unitsCtrl->Enable( m_formatCtrl->GetSelection() != 2 );
160}
161
162
164{
165 m_singleFile->Enable( m_formatCtrl->GetSelection() != 2 );
166}
167
168
170{
171 if( m_formatCtrl->GetSelection() == 2 )
172 {
173 m_onlySMD->SetValue( false );
174 m_onlySMD->Enable( false );
175 }
176 else
177 {
178 m_onlySMD->Enable( true );
179 }
180}
181
182
184{
185 if( m_formatCtrl->GetSelection() == 2 )
186 {
187 m_negateXcb->SetValue( false );
188 m_negateXcb->Enable( false );
189 }
190 else
191 {
192 m_negateXcb->Enable( true );
193 }
194}
195
197{
198 if( m_formatCtrl->GetSelection() == 2 )
199 {
200 if( event.GetEventObject() == m_excludeTH )
201 m_excludeTH->SetValue( false );
202 else if( event.GetEventObject() == m_excludeDNP )
203 m_excludeDNP->SetValue( false );
204 else if( event.GetEventObject() == m_excludeBOM )
205 m_excludeBOM->SetValue( false );
206
207 event.Enable( false );
208 }
209 else
210 {
211 event.Enable( true );
212 }
213}
214
215
217{
218 m_cbIncludeBoardEdge->Enable( m_formatCtrl->GetSelection() == 2 );
219}
220
221
223{
224 // Build the absolute path of current output directory to preselect it in the file browser.
225 wxString path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() );
226 path = Prj().AbsolutePath( path );
227
228 wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
229
230 if( dirDialog.ShowModal() == wxID_CANCEL )
231 return;
232
233 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
234
235 if( IsOK( this, _( "Use a relative path?" ) ) )
236 {
237 wxString boardFilePath = ( (wxFileName) m_editFrame->GetBoard()->GetFileName() ).GetPath();
238
239 if( !dirName.MakeRelativeTo( boardFilePath ) )
240 {
241 DisplayErrorMessage( this, _( "Cannot make path relative (target volume different from board "
242 "file volume)!" ) );
243 }
244 }
245
246 m_outputDirectoryName->SetValue( dirName.GetFullPath() );
247}
248
249
250void DIALOG_GEN_FOOTPRINT_POSITION::onGenerate( wxCommandEvent& event )
251{
252 if( !m_job )
253 {
254 m_units = m_unitsCtrl->GetSelection() == 0 ? EDA_UNITS::INCH : EDA_UNITS::MM;
255
257 // Keep unix directory format convention in cfg files
258 m_outputDirectory.Replace( wxT( "\\" ), wxT( "/" ) );
259
260 if( m_formatCtrl->GetSelection() == 2 )
262 else
264 }
265 else
266 {
267 m_job->SetConfiguredOutputPath( m_outputDirectoryName->GetValue() );
268 m_job->m_units = m_unitsCtrl->GetSelection() == 0 ? JOB_EXPORT_PCB_POS::UNITS::INCH
270 m_job->m_format = static_cast<JOB_EXPORT_PCB_POS::FORMAT>( m_formatCtrl->GetSelection() );
272 m_job->m_singleFile = m_singleFile->GetValue();
273 m_job->m_gerberBoardEdge = m_cbIncludeBoardEdge->GetValue();
274 m_job->m_excludeFootprintsWithTh = m_excludeTH->GetValue();
275 m_job->m_smdOnly = m_onlySMD->GetValue();
276 m_job->m_useDrillPlaceFileOrigin = m_useDrillPlaceOrigin->GetValue();
277 m_job->m_negateBottomX = m_negateXcb->GetValue();
278 m_job->m_excludeDNP = m_excludeDNP->GetValue();
279 m_job->m_excludeBOM = m_excludeBOM->GetValue();
280 m_job->m_variant = getSelectedVariant();
281
282 event.Skip(); // Allow normal close action
283 }
284}
285
286
288{
289 BOARD* brd = m_editFrame->GetBoard();
290 wxString msg;
291 int fullcount = 0;
292
293 // Create output directory if it does not exist (also transform it in absolute form).
294 // Bail if it fails.
295
296 std::function<bool( wxString* )> textResolver =
297 [&]( wxString* token ) -> bool
298 {
299 // Handles board->GetTitleBlock() *and* board->GetProject()
300 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
301 };
302
303 wxString path = m_outputDirectory;
304 path = ExpandTextVars( path, &textResolver );
306
307 wxFileName outputDir = wxFileName::DirName( path );
308 wxString boardFilename = m_editFrame->GetBoard()->GetFileName();
309 REPORTER* reporter = &m_messagesPanel->Reporter();
310
311 if( !EnsureFileDirectoryExists( &outputDir, boardFilename, reporter ) )
312 {
313 msg.Printf( _( "Could not write plot files to folder '%s'." ), outputDir.GetPath() );
314 DisplayError( this, msg );
315 return false;
316 }
317
318 wxFileName fn = m_editFrame->GetBoard()->GetFileName();
319 fn.SetPath( outputDir.GetPath() );
320
321 // Create the Front and Top side placement files. Gerber P&P files are always separated.
322 // Not also they include all footprints
323 PLACEFILE_GERBER_WRITER exporter( brd );
324
325 // Set the selected variant for variant-aware DNP/BOM/position file filtering
326 exporter.SetVariant( getSelectedVariant() );
327
328 wxString filename = exporter.GetPlaceFileName( fn.GetFullPath(), F_Cu );
329
330 int fpcount = exporter.CreatePlaceFile( filename, F_Cu, m_cbIncludeBoardEdge->GetValue(),
331 m_excludeDNP->GetValue(), ExcludeBOM() );
332
333 if( fpcount < 0 )
334 {
335 msg.Printf( _( "Failed to create file '%s'." ), fn.GetFullPath() );
336 wxMessageBox( msg );
337 reporter->Report( msg, RPT_SEVERITY_ERROR );
338 return false;
339 }
340
341 msg.Printf( _( "Front (top side) placement file: '%s'." ), filename );
342 reporter->Report( msg, RPT_SEVERITY_ACTION );
343
344 msg.Printf( _( "Component count: %d." ), fpcount );
345 reporter->Report( msg, RPT_SEVERITY_INFO );
346
347 // Create the Back or Bottom side placement file
348 fullcount = fpcount;
349
350 filename = exporter.GetPlaceFileName( fn.GetFullPath(), B_Cu );
351
352 fpcount = exporter.CreatePlaceFile( filename, B_Cu, m_cbIncludeBoardEdge->GetValue(),
353 m_excludeDNP->GetValue(), ExcludeBOM() );
354
355 if( fpcount < 0 )
356 {
357 msg.Printf( _( "Failed to create file '%s'." ), filename );
358 reporter->Report( msg, RPT_SEVERITY_ERROR );
359 wxMessageBox( msg );
360 return false;
361 }
362
363 // Display results
364 msg.Printf( _( "Back (bottom side) placement file: '%s'." ), filename );
365 reporter->Report( msg, RPT_SEVERITY_ACTION );
366
367 msg.Printf( _( "Component count: %d." ), fpcount );
368 reporter->Report( msg, RPT_SEVERITY_INFO );
369
370 fullcount += fpcount;
371 msg.Printf( _( "Full component count: %d." ), fullcount );
372 reporter->Report( msg, RPT_SEVERITY_INFO );
373
374 reporter->Report( _( "Done." ), RPT_SEVERITY_INFO );
375
376 return true;
377}
378
379
381{
382 BOARD* brd = m_editFrame->GetBoard();
383 wxString msg;
384 bool singleFile = OneFileOnly();
385 bool useCSVfmt = m_formatCtrl->GetSelection() == 1;
386 bool useAuxOrigin = m_useDrillPlaceOrigin->GetValue();
387 int fullcount = 0;
388 int topSide = true;
389 int bottomSide = true;
390 bool negateBottomX = m_negateXcb->GetValue();
391
392 // Test for any footprint candidate in list.
393 {
395 ExcludeBOM(), topSide, bottomSide, useCSVfmt, useAuxOrigin,
396 negateBottomX );
397
398 // Set the selected variant for variant-aware DNP/BOM/position file filtering
399 exporter.SetVariant( getSelectedVariant() );
400
401 exporter.GenPositionData();
402
403 if( exporter.GetFootprintCount() == 0 )
404 {
405 wxMessageBox( _( "No footprint for automated placement." ) );
406 return false;
407 }
408 }
409
410 // Create output directory if it does not exist (also transform it in absolute form).
411 // Bail if it fails.
412
413 std::function<bool( wxString* )> textResolver =
414 [&]( wxString* token ) -> bool
415 {
416 // Handles board->GetTitleBlock() *and* board->GetProject()
417 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
418 };
419
420 wxString path = m_outputDirectory;
421 path = ExpandTextVars( path, &textResolver );
423
424 wxFileName outputDir = wxFileName::DirName( path );
425 wxString boardFilename = m_editFrame->GetBoard()->GetFileName();
426 REPORTER* reporter = &m_messagesPanel->Reporter();
427
428 if( !EnsureFileDirectoryExists( &outputDir, boardFilename, reporter ) )
429 {
430 msg.Printf( _( "Could not write plot files to folder '%s'." ), outputDir.GetPath() );
431 DisplayError( this, msg );
432 return false;
433 }
434
435 wxFileName fn = m_editFrame->GetBoard()->GetFileName();
436 fn.SetPath( outputDir.GetPath() );
437
438 // Create the Front or Top side placement file, or a single file
439 topSide = true;
440 bottomSide = singleFile;
441
442 fn.SetName( PLACE_FILE_EXPORTER::DecorateFilename( fn.GetName(), topSide, bottomSide ) );
444
445 if( useCSVfmt )
446 {
447 fn.SetName( fn.GetName() + wxT( "-" ) + FILEEXT::FootprintPlaceFileExtension );
448 fn.SetExt( wxT( "csv" ) );
449 }
450
451 int fpcount = m_editFrame->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(), OnlySMD(),
452 ExcludeAllTH(), ExcludeDNP(), ExcludeBOM(), topSide,
453 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
454 if( fpcount < 0 )
455 {
456 msg.Printf( _( "Failed to create file '%s'." ), fn.GetFullPath() );
457 wxMessageBox( msg );
458 reporter->Report( msg, RPT_SEVERITY_ERROR );
459 return false;
460 }
461
462 if( singleFile )
463 msg.Printf( _( "Placement file: '%s'." ), fn.GetFullPath() );
464 else
465 msg.Printf( _( "Front (top side) placement file: '%s'." ), fn.GetFullPath() );
466
467 reporter->Report( msg, RPT_SEVERITY_ACTION );
468
469 msg.Printf( _( "Component count: %d." ), fpcount );
470 reporter->Report( msg, RPT_SEVERITY_INFO );
471
472 if( singleFile )
473 {
474 reporter->Report( _( "Done." ), RPT_SEVERITY_INFO );
475 return true;
476 }
477
478 // Create the Back or Bottom side placement file
479 fullcount = fpcount;
480 topSide = false;
481 bottomSide = true;
482 fn = brd->GetFileName();
483 fn.SetPath( outputDir.GetPath() );
484 fn.SetName( PLACE_FILE_EXPORTER::DecorateFilename( fn.GetName(), topSide, bottomSide ) );
486
487 if( useCSVfmt )
488 {
489 fn.SetName( fn.GetName() + wxT( "-" ) + FILEEXT::FootprintPlaceFileExtension );
490 fn.SetExt( wxT( "csv" ) );
491 }
492
493 fpcount = m_editFrame->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(), OnlySMD(),
494 ExcludeAllTH(), ExcludeDNP(), ExcludeBOM(), topSide,
495 bottomSide, useCSVfmt, useAuxOrigin, negateBottomX );
496
497 if( fpcount < 0 )
498 {
499 msg.Printf( _( "Failed to create file '%s'." ), fn.GetFullPath() );
500 reporter->Report( msg, RPT_SEVERITY_ERROR );
501 wxMessageBox( msg );
502 return false;
503 }
504
505 // Display results
506 if( !singleFile )
507 {
508 msg.Printf( _( "Back (bottom side) placement file: '%s'." ), fn.GetFullPath() );
509 reporter->Report( msg, RPT_SEVERITY_ACTION );
510
511 msg.Printf( _( "Component count: %d." ), fpcount );
512 reporter->Report( msg, RPT_SEVERITY_INFO );
513 }
514
515 if( !singleFile )
516 {
517 fullcount += fpcount;
518 msg.Printf( _( "Full component count: %d." ), fullcount );
519 reporter->Report( msg, RPT_SEVERITY_INFO );
520 }
521
522 reporter->Report( _( "Done." ), RPT_SEVERITY_INFO );
523 return true;
524}
525
526
528{
529 wxString variant;
530 int selection = m_variantChoiceCtrl->GetSelection();
531
532 // Selection 0 is the default variant (empty string)
533 if( ( selection != 0 ) && ( selection != wxNOT_FOUND ) )
534 variant = m_variantChoiceCtrl->GetString( selection );
535
536 return variant;
537}
538
539
546
547
548int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, bool aUnitsMM,
549 bool aOnlySMD, bool aNoTHItems, bool aExcludeDNP,
550 bool aExcludeBOM, bool aTopSide, bool aBottomSide,
551 bool aFormatCSV, bool aUseAuxOrigin, bool aNegateBottomX )
552{
553 FILE * file = nullptr;
554
555 if( !aFullFileName.IsEmpty() )
556 {
557 file = wxFopen( aFullFileName, wxT( "wt" ) );
558
559 if( file == nullptr )
560 return -1;
561 }
562
563 std::string data;
564 PLACE_FILE_EXPORTER exporter( GetBoard(), aUnitsMM, aOnlySMD, aNoTHItems, aExcludeDNP,
565 aExcludeBOM, aTopSide, aBottomSide, aFormatCSV, aUseAuxOrigin,
566 aNegateBottomX );
567
568 // Set the current variant for variant-aware DNP/BOM/position file filtering
569 exporter.SetVariant( GetBoard()->GetCurrentVariant() );
570
571 data = exporter.GenPositionData();
572
573 // if aFullFileName is empty, the file is not created, only the
574 // count of footprints to place is returned
575 if( file )
576 {
577 // Creates a footprint position file
578 // aSide = 0 -> Back (bottom) side)
579 // aSide = 1 -> Front (top) side)
580 // aSide = 2 -> both sides
581 fputs( data.c_str(), file );
582 fclose( file );
583 }
584
585 return exporter.GetFootprintCount();
586}
587
588
590{
591 BOARD* board = m_frame->GetBoard();
592 wxFileName fn;
593
594 wxString boardFilePath = ( (wxFileName) board->GetFileName() ).GetPath();
595 wxDirDialog dirDialog( m_frame, _( "Select Output Directory" ), boardFilePath );
596
597 if( dirDialog.ShowModal() == wxID_CANCEL )
598 return 0;
599
600 fn = board->GetFileName();
601 fn.SetPath( dirDialog.GetPath() );
602 fn.SetExt( wxT( "rpt" ) );
603
604 FILE* rptfile = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
605
606 if( rptfile == nullptr )
607 {
608 wxMessageBox( wxString::Format( _( "Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
609 _( "Footprint Report" ), wxICON_INFORMATION );
610
611 return 0;
612 }
613
614 std::string data;
615 PLACE_FILE_EXPORTER exporter( board, m_frame->GetUserUnits() == EDA_UNITS::MM,
616 false, // aOnlySMD
617 false, // aNoTHItems
618 false, // aExcludeDNP
619 false, // aExcludeBOM
620 true, true, // aTopSide, aBottomSide
621 false, // aFormatCSV
622 true, // aUseAuxOrigin
623 false ); // aNegateBottomX
624
625 // Set the current variant for variant-aware filtering
626 exporter.SetVariant( board->GetCurrentVariant() );
627
628 data = exporter.GenReportData();
629
630 fputs( data.c_str(), rptfile );
631 fclose( rptfile );
632
633 wxMessageBox( wxString::Format( _( "Footprint report file created:\n'%s'." ), fn.GetFullPath() ),
634 _( "Footprint Report" ), wxICON_INFORMATION );
635
636 return 0;
637}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:110
int GenFootprintsReport(const TOOL_EVENT &aEvent)
int GeneratePosFile(const TOOL_EVENT &aEvent)
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
const wxString & GetFileName() const
Definition board.h:359
DIALOG_GEN_FOOTPRINT_POSITION_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Generate Placement Files"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
The dialog to create footprint position files and choose options (one or 2 files, units and force all...
void onUpdateUIincludeBoardEdge(wxUpdateUIEvent &event) override
void onUpdateUIExcludeTH(wxUpdateUIEvent &event) override
bool CreateGerberFiles()
Creates placement files in gerber format.
void onGenerate(wxCommandEvent &event) override
void onUpdateUIFileOpt(wxUpdateUIEvent &event) override
void onUpdateUIOnlySMD(wxUpdateUIEvent &event) override
DIALOG_GEN_FOOTPRINT_POSITION(PCB_EDIT_FRAME *aEditFrame)
bool CreateAsciiFiles()
Creates files in text or csv format.
void onUpdateUInegXcoord(wxUpdateUIEvent &event) override
void onOutputDirectoryBrowseClicked(wxCommandEvent &event) override
void onUpdateUIUnits(wxUpdateUIEvent &event) override
EDA_UNITS m_units
void SetupStandardButtons(std::map< int, wxString > aLabels={})
std::string m_hash_key
int ShowModal() override
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
BOARD * GetBoard() const
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.
BOARD * board() const
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.
Definition project.cpp:392
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
Definition reporter.h:102
T * getEditFrame() const
Return the application window object, casted to requested user type.
Definition tool_base.h:186
Generic, UI-independent tool event.
Definition tool_event.h:171
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition common.cpp:558
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
Definition common.cpp:62
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.
Definition common.cpp:579
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
Definition confirm.cpp:259
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:202
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:177
This file is part of the common library.
#define _(s)
Classes used in place file generation.
static const std::string FootprintPlaceFileExtension
@ B_Cu
Definition layer_ids.h:65
@ F_Cu
Definition layer_ids.h:64
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_INFO
@ RPT_SEVERITY_ACTION
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
std::string path
Definition of file extensions used in Kicad.