KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_export_step.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 (C) 2016 Cirilo Bernardo
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <wx/log.h>
26#include <wx/stdpaths.h>
27#include <wx/process.h>
28#include <wx/string.h>
29#include <wx/filedlg.h>
30
31#include <pgm_base.h>
32#include <board.h>
33#include <confirm.h>
34#include <kidialog.h>
36#include "dialog_export_step.h"
38#include <footprint.h>
39#include <kiface_base.h>
40#include <locale_io.h>
41#include <math/vector3.h>
42#include <pcb_edit_frame.h>
44#include <project/project_file.h> // LAST_PATH_TYPE
45#include <reporter.h>
46#include <trace_helpers.h>
49#include <filename_resolver.h>
50#include <core/map_helpers.h>
53
54
55// Maps m_choiceFormat selection to extension (and kicad-cli command)
56static const std::vector<wxString> c_formatCommand = { FILEEXT::StepFileExtension,
63
64// Maps file extensions to m_choiceFormat selection
65static const std::map<wxString, int> c_formatExtToChoice = { { FILEEXT::StepFileExtension, 0 },
73
74
75DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aEditFrame, const wxString& aBoardPath ) :
76 DIALOG_EXPORT_STEP( aEditFrame, aEditFrame, aBoardPath )
77{
78}
79
80
82 const wxString& aBoardPath, JOB_EXPORT_PCB_3D* aJob ) :
83 DIALOG_EXPORT_STEP_BASE( aEditFrame ),
84 m_editFrame( aEditFrame ),
85 m_job( aJob ),
86 m_originX( aEditFrame, m_originXLabel, m_originXCtrl, m_originXUnits ),
87 m_originY( aEditFrame, m_originYLabel, m_originYCtrl, m_originYUnits ),
88 m_boardPath( aBoardPath )
89{
90 if( !m_job )
91 {
92 m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
93 SetupStandardButtons( { { wxID_OK, _( "Export" ) },
94 { wxID_CANCEL, _( "Close" ) } } );
95 }
96 else
97 {
98 SetTitle( m_job->GetSettingsDialogTitle() );
99
100 m_browseButton->Hide();
102 }
103
104 // DIALOG_SHIM needs a unique hash_key because classname will be the same for both job and
105 // non-job versions.
106 m_hash_key = TO_UTF8( GetTitle() );
107
108 Layout();
109 bSizerSTEPFile->Fit( this );
110
111 SetFocus();
112
113 wxString bad_scales;
114 size_t bad_count = 0;
115
116 for( FOOTPRINT* fp : m_editFrame->GetBoard()->Footprints() )
117 {
118 for( const FP_3DMODEL& model : fp->Models() )
119 {
120 if( model.m_Scale.x != 1.0 || model.m_Scale.y != 1.0 || model.m_Scale.z != 1.0 )
121 {
122 bad_scales.Append( wxS("\n") );
123 bad_scales.Append( model.m_Filename );
124 bad_count++;
125 }
126 }
127
128 if( bad_count >= 5 )
129 break;
130 }
131
132 if( !bad_scales.empty() && !Pgm().GetCommonSettings()->m_DoNotShowAgain.scaled_3d_models_warning )
133 {
134 wxString extendedMsg = _( "Non-unity scaled models:" ) + wxT( "\n" ) + bad_scales;
135
136 KIDIALOG msgDlg( m_editFrame, _( "Scaled models detected. Model scaling is not reliable for "
137 "mechanical export." ),
138 _( "Model Scale Warning" ), wxOK | wxICON_WARNING );
139 msgDlg.SetExtendedMessage( extendedMsg );
140 msgDlg.DoNotShowCheckbox( __FILE__, __LINE__ );
141
142 msgDlg.ShowModal();
143
144 if( msgDlg.DoNotShowAgain() )
146 }
147
149
150 // Now all widgets have the size fixed, call FinishDialogSettings
152}
153
154
156{
157 if( !m_job )
158 {
159 if( m_outputFileName->GetValue().IsEmpty() )
160 {
161 wxFileName brdFile( m_editFrame->GetBoard()->GetFileName() );
162 brdFile.SetExt( wxT( "step" ) );
163 m_outputFileName->SetValue( brdFile.GetFullPath() );
164 }
165 }
166 else
167 {
168 m_rbBoardCenterOrigin->SetValue( true ); // Default
169
171 m_rbDrillAndPlotOrigin->SetValue( true );
173 m_rbGridOrigin->SetValue( true );
175 m_rbUserDefinedOrigin->SetValue( true );
177 m_rbBoardCenterOrigin->SetValue( true );
178
181
199
201 m_choiceTolerance->SetSelection( 2 );
203 m_choiceTolerance->SetSelection( 0 );
204 else
205 m_choiceTolerance->SetSelection( 1 );
206
209 }
210
211 // Sync the enabled states
212 wxCommandEvent dummy;
214
215 return true;
216}
217
218
220{
222 wxFileName brdFile = board->GetFileName();
223
224 // The project filename (.kicad_pro) of the auto saved board filename, if it is created
225 wxFileName autosaveProjFile;
226
227 if( m_frame->GetScreen()->IsContentModified() || brdFile.GetFullPath().empty() )
228 {
229 if( !m_frame->DoAutoSave() )
230 {
231 DisplayErrorMessage( m_frame, _( "STEP export failed! Please save the PCB and try again" ) );
232 return 0;
233 }
234
235 wxString autosaveFileName = FILEEXT::AutoSaveFilePrefix + brdFile.GetName();
236
237 // Create a dummy .kicad_pro file for this auto saved board file.
238 // this is useful to use some settings (like project path and name)
239 // Because DoAutoSave() works, the target directory exists and is writable
240 autosaveProjFile = brdFile;
241 autosaveProjFile.SetName( autosaveFileName );
242 autosaveProjFile.SetExt( "kicad_pro" );
243
244 // Use auto-saved board for export
245 m_frame->GetSettingsManager()->SaveProjectCopy( autosaveProjFile.GetFullPath(), board->GetProject() );
246 brdFile.SetName( autosaveFileName );
247 }
248
249 DIALOG_EXPORT_STEP dlg( m_frame, brdFile.GetFullPath() );
250 dlg.ShowModal();
251
252 // If a dummy .kicad_pro file is created, delete it now it is useless.
253 if( !autosaveProjFile.GetFullPath().IsEmpty() )
254 wxRemoveFile( autosaveProjFile.GetFullPath() );
255
256 return 0;
257}
258
259
260void DIALOG_EXPORT_STEP::onUpdateXPos( wxUpdateUIEvent& aEvent )
261{
262 aEvent.Enable( m_rbUserDefinedOrigin->GetValue() );
263}
264
265
266void DIALOG_EXPORT_STEP::onUpdateYPos( wxUpdateUIEvent& aEvent )
267{
268 aEvent.Enable( m_rbUserDefinedOrigin->GetValue() );
269}
270
271
272void DIALOG_EXPORT_STEP::onBrowseClicked( wxCommandEvent& aEvent )
273{
274 // clang-format off
275 wxString filter = _( "STEP files" )
277 + _( "Binary glTF files" )
279 + _( "XAO files" )
281 + _( "BREP (OCCT) files" )
283 + _( "PLY files" )
285 + _( "STL files" )
287 // clang-format on
288
289 // Build the absolute path of current output directory to preselect it in the file browser.
290 wxString path = ExpandEnvVarSubstitutions( m_outputFileName->GetValue(), &Prj() );
291 wxFileName fn( Prj().AbsolutePath( path ) );
292
293 wxFileDialog dlg( this, _( "3D Model Output File" ), fn.GetPath(), fn.GetFullName(), filter, wxFD_SAVE );
294
295 if( dlg.ShowModal() == wxID_CANCEL )
296 return;
297
298 path = dlg.GetPath();
299 m_outputFileName->SetValue( path );
300
301 fn = wxFileName( path );
302
303 if( auto formatChoice = get_opt( c_formatExtToChoice, fn.GetExt().Lower() ) )
304 m_choiceFormat->SetSelection( *formatChoice );
305}
306
307
308void DIALOG_EXPORT_STEP::onFormatChoice( wxCommandEvent& event )
309{
311}
312
313
315{
316 const wxString& newExt = c_formatCommand[m_choiceFormat->GetSelection()];
317 wxString path = m_outputFileName->GetValue();
318
319 int sepIdx = std::max( path.Find( '/', true ), path.Find( '\\', true ) );
320 int dotIdx = path.Find( '.', true );
321
322 if( dotIdx == -1 || dotIdx < sepIdx )
323 path << '.' << newExt;
324 else
325 path = path.Mid( 0, dotIdx ) << '.' << newExt;
326
327 m_outputFileName->SetValue( path );
328}
329
330
331void DIALOG_EXPORT_STEP::onCbExportComponents( wxCommandEvent& event )
332{
333 bool enable = m_cbExportComponents->GetValue();
334
335 m_rbAllComponents->Enable( enable );
336 m_rbOnlySelected->Enable( enable );
337 m_rbFilteredComponents->Enable( enable );
338 m_txtComponentFilter->Enable( enable && m_rbFilteredComponents->GetValue() );
339}
340
341
342void DIALOG_EXPORT_STEP::OnComponentModeChange( wxCommandEvent& event )
343{
344 m_txtComponentFilter->Enable( m_rbFilteredComponents->GetValue() );
345}
346
347
348void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
349{
350 wxString path = m_outputFileName->GetValue();
351 double tolerance; // default value in mm
352
353 switch( m_choiceTolerance->GetSelection() )
354 {
355 case 0: tolerance = 0.001; break;
356 default:
357 case 1: tolerance = 0.01; break;
358 case 2: tolerance = 0.1; break;
359 }
360
361 if( !m_job )
362 {
363 // Build the absolute path of current output directory to preselect it in the file browser.
364 std::function<bool( wxString* )> textResolver =
365 [&]( wxString* token ) -> bool
366 {
367 return m_editFrame->GetBoard()->ResolveTextVar( token, 0 );
368 };
369
370 path = ExpandTextVars( path, &textResolver );
372 path = Prj().AbsolutePath( path );
373
374 if( path.IsEmpty() )
375 {
376 DisplayErrorMessage( this, _( "No filename for output file" ) );
377 return;
378 }
379
380 SHAPE_POLY_SET outline;
381 wxString msg;
382
383 // Check if the board outline is continuous
384 // max dist from one endPt to next startPt to build a closed shape:
385 int chainingEpsilon = pcbIUScale.mmToIU( tolerance );
386
387 // Arc to segment approximation error (not critical here: we do not use the outline shape):
388 int maxError = pcbIUScale.mmToIU( 0.05 );
389
390 if( !BuildBoardPolygonOutlines( m_editFrame->GetBoard(), outline, maxError, chainingEpsilon ) )
391 {
392 DisplayErrorMessage( this, wxString::Format( _( "Board outline is missing or not closed using "
393 "%.3f mm tolerance.\n"
394 "Run DRC for a full analysis." ),
395 tolerance ) );
396 return;
397 }
398
399 wxFileName fn( Prj().AbsolutePath( path ) );
400
401 if( fn.FileExists() && !m_cbOverwriteFile->GetValue() )
402 {
403 msg.Printf( _( "File '%s' already exists. Do you want overwrite this file?" ), fn.GetFullPath() );
404
405 if( wxMessageBox( msg, _( "STEP/GLTF Export" ), wxYES_NO | wxICON_QUESTION, this ) == wxNO )
406 return;
407 }
408
409 wxFileName appK2S( wxStandardPaths::Get().GetExecutablePath() );
410 #ifdef __WXMAC__
411 // On macOS, we have standalone applications inside the main bundle, so we handle that here:
412 if( appK2S.GetPath().Find( "/Contents/Applications/pcbnew.app/Contents/MacOS" ) != wxNOT_FOUND )
413 {
414 appK2S.AppendDir( wxT( ".." ) );
415 appK2S.AppendDir( wxT( ".." ) );
416 appK2S.AppendDir( wxT( ".." ) );
417 appK2S.AppendDir( wxT( ".." ) );
418 appK2S.AppendDir( wxT( "MacOS" ) );
419 }
420 #else
421 if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
422 {
423 appK2S.RemoveLastDir();
424 appK2S.AppendDir( "kicad" );
425 }
426 #endif
427
428 appK2S.SetName( wxT( "kicad-cli" ) );
429 appK2S.Normalize( FN_NORMALIZE_FLAGS );
430
431 wxString cmdK2S = wxT( "\"" );
432 cmdK2S.Append( appK2S.GetFullPath() );
433 cmdK2S.Append( wxT( "\"" ) );
434
435 cmdK2S.Append( wxT( " pcb" ) );
436 cmdK2S.Append( wxT( " export" ) );
437
438 cmdK2S.Append( wxT( " " ) );
439 cmdK2S.Append( c_formatCommand[m_choiceFormat->GetSelection()] );
440
441 if( m_cbRemoveUnspecified->GetValue() )
442 cmdK2S.Append( wxT( " --no-unspecified" ) );
443
444 if( m_cbRemoveDNP->GetValue() )
445 cmdK2S.Append( wxT( " --no-dnp" ) );
446
447 if( m_cbSubstModels->GetValue() )
448 cmdK2S.Append( wxT( " --subst-models" ) );
449
450 if( !m_cbOptimizeStep->GetValue() )
451 cmdK2S.Append( wxT( " --no-optimize-step" ) );
452
453 if( !m_cbExportBody->GetValue() )
454 cmdK2S.Append( wxT( " --no-board-body" ) );
455
456 if( !m_cbExportComponents->GetValue() )
457 cmdK2S.Append( wxT( " --no-components" ) );
458
459 if( m_cbExportTracks->GetValue() )
460 cmdK2S.Append( wxT( " --include-tracks" ) );
461
462 if( m_cbExportPads->GetValue() )
463 cmdK2S.Append( wxT( " --include-pads" ) );
464
465 if( m_cbExportZones->GetValue() )
466 cmdK2S.Append( wxT( " --include-zones" ) );
467
468 if( m_cbExportInnerCopper->GetValue() )
469 cmdK2S.Append( wxT( " --include-inner-copper" ) );
470
471 if( m_cbExportSilkscreen->GetValue() )
472 cmdK2S.Append( wxT( " --include-silkscreen" ) );
473
474 if( m_cbExportSoldermask->GetValue() )
475 cmdK2S.Append( wxT( " --include-soldermask" ) );
476
477 if( m_cbFuseShapes->GetValue() )
478 cmdK2S.Append( wxT( " --fuse-shapes" ) );
479
480 if( m_cbCutViasInBody->GetValue() )
481 cmdK2S.Append( wxT( " --cut-vias-in-body" ) );
482
483 if( m_cbFillAllVias->GetValue() )
484 cmdK2S.Append( wxT( " --fill-all-vias" ) );
485
486 // Note: for some reason, using \" to insert a quote in a format string, under MacOS
487 // wxString::Format does not work. So use a %c format in string
488 int quote = '\'';
489 int dblquote = '"';
490
491 if( !m_txtNetFilter->GetValue().empty() )
492 {
493 cmdK2S.Append( wxString::Format( wxT( " --net-filter %c%s%c" ),
494 dblquote, m_txtNetFilter->GetValue(), dblquote ) );
495 }
496
497 if( m_rbOnlySelected->GetValue() )
498 {
499 wxArrayString components;
501
502 std::for_each( selection.begin(), selection.end(),
503 [&components]( EDA_ITEM* item )
504 {
505 if( item->Type() == PCB_FOOTPRINT_T )
506 components.push_back( static_cast<FOOTPRINT*>( item )->GetReference() );
507 } );
508
509 cmdK2S.Append( wxString::Format( wxT( " --component-filter %c%s%c" ),
510 dblquote, wxJoin( components, ',' ), dblquote ) );
511 }
512 else if( m_rbFilteredComponents->GetValue() )
513 {
514 cmdK2S.Append( wxString::Format( wxT( " --component-filter %c%s%c" ),
515 dblquote, m_txtComponentFilter->GetValue(), dblquote ) );
516 }
517
518 if( m_rbDrillAndPlotOrigin->GetValue() )
519 {
520 cmdK2S.Append( wxT( " --drill-origin" ) );
521 }
522 else if( m_rbGridOrigin->GetValue() )
523 {
524 cmdK2S.Append( wxT( " --grid-origin" ) );
525 }
526 else if( m_rbUserDefinedOrigin->GetValue() )
527 {
528 double xOrg = pcbIUScale.IUTomm( m_originX.GetIntValue() );
529 double yOrg = pcbIUScale.IUTomm( m_originY.GetIntValue() );
530
532 cmdK2S.Append( wxString::Format( wxT( " --user-origin=%c%.6fx%.6fmm%c" ),
533 quote, xOrg, yOrg, quote ) );
534 }
535 else if( m_rbBoardCenterOrigin->GetValue() )
536 {
537 BOX2I bbox = m_editFrame->GetBoard()->ComputeBoundingBox( true );
538 double xOrg = pcbIUScale.IUTomm( bbox.GetCenter().x );
539 double yOrg = pcbIUScale.IUTomm( bbox.GetCenter().y );
541
542 cmdK2S.Append( wxString::Format( wxT( " --user-origin=%c%.6fx%.6fmm%c" ),
543 quote, xOrg, yOrg, quote ) );
544 }
545 else
546 {
547 wxFAIL_MSG( wxT( "Unsupported origin option: how did we get here?" ) );
548 }
549
550 {
552 cmdK2S.Append( wxString::Format( wxT( " --min-distance=%c%.3fmm%c" ),
553 quote, tolerance, quote ) );
554 }
555
556 // Output file path.
557 cmdK2S.Append( wxString::Format( wxT( " -f -o %c%s%c" ),
558 dblquote, fn.GetFullPath(), dblquote ) );
559
560
561 // Input file path.
562 cmdK2S.Append( wxString::Format( wxT( " %c%s%c" ), dblquote, m_boardPath, dblquote ) );
563
564 wxLogTrace( traceKiCad2Step, wxT( "export step command: %s" ), cmdK2S );
565
566 DIALOG_EXPORT_STEP_LOG* log = new DIALOG_EXPORT_STEP_LOG( this, cmdK2S );
567 log->ShowModal();
568 }
569 else
570 {
591
592 m_job->SetStepFormat( static_cast<EXPORTER_STEP_PARAMS::FORMAT>( m_choiceFormat->GetSelection() ) );
593
594 // ensure the main format on the job is populated
595 switch( m_job->m_3dparams.m_Format )
596 {
604 }
605
610
611 if( m_rbDrillAndPlotOrigin->GetValue() )
612 {
614 }
615 else if( m_rbGridOrigin->GetValue() )
616 {
618 }
619 else if( m_rbUserDefinedOrigin->GetValue() )
620 {
621 double xOrg = pcbIUScale.IUTomm( m_originX.GetIntValue() );
622 double yOrg = pcbIUScale.IUTomm( m_originY.GetIntValue() );
623
625 m_job->m_3dparams.m_Origin = VECTOR2D( xOrg, yOrg );
626 }
627 else if( m_rbBoardCenterOrigin->GetValue() )
628 {
629 BOX2I bbox = m_editFrame->GetBoard()->ComputeBoundingBox( true );
630 double xOrg = pcbIUScale.IUTomm( bbox.GetCenter().x );
631 double yOrg = pcbIUScale.IUTomm( bbox.GetCenter().y );
633
635 m_job->m_3dparams.m_Origin = VECTOR2D( xOrg, yOrg );
636 }
637
638 EndModal( wxID_OK );
639 }
640}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:112
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition: bitmap.cpp:110
bool IsContentModified() const
Definition: base_screen.h:60
int ExportSTEP(const TOOL_EVENT &aEvent)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:317
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: board.cpp:500
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1851
const FOOTPRINTS & Footprints() const
Definition: board.h:358
const wxString & GetFileName() const
Definition: board.h:354
PROJECT * GetProject() const
Definition: board.h:538
constexpr const Vec GetCenter() const
Definition: box2.h:230
DO_NOT_SHOW_AGAIN m_DoNotShowAgain
Class DIALOG_EXPORT_STEP_BASE.
wxRadioButton * m_rbFilteredComponents
wxRadioButton * m_rbDrillAndPlotOrigin
STD_BITMAP_BUTTON * m_browseButton
void onFormatChoice(wxCommandEvent &event) override
void onCbExportComponents(wxCommandEvent &event) override
PCB_EDIT_FRAME * m_editFrame
void OnComponentModeChange(wxCommandEvent &event) override
DIALOG_EXPORT_STEP(PCB_EDIT_FRAME *aEditFrame, const wxString &aBoardPath)
void onUpdateXPos(wxUpdateUIEvent &aEvent) override
JOB_EXPORT_PCB_3D * m_job
bool TransferDataToWindow() override
void onExportButton(wxCommandEvent &aEvent) override
void onUpdateYPos(wxUpdateUIEvent &aEvent) override
void onBrowseClicked(wxCommandEvent &aEvent) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
std::string m_hash_key
Definition: dialog_shim.h:236
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
int ShowModal() override
SETTINGS_MANAGER * GetSettingsManager() const
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:98
JOB_EXPORT_PCB_3D::FORMAT m_format
wxString GetSettingsDialogTitle() const override
void SetStepFormat(EXPORTER_STEP_PARAMS::FORMAT aFormat)
EXPORTER_STEP_PARAMS m_3dparams
Despite the name; also used for other formats.
void SetConfiguredOutputPath(const wxString &aPath)
Sets the configured output path for the job, this path is always saved to file.
Definition: job.cpp:153
wxString GetConfiguredOutputPath() const
Returns the configured output path for the job.
Definition: job.h:232
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: kidialog.h:50
bool DoNotShowAgain() const
Checks the 'do not show again' setting for the dialog.
Definition: kidialog.cpp:59
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
Definition: kidialog.cpp:51
int ShowModal() override
Definition: kidialog.cpp:95
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:41
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
BOARD * GetBoard() const
The main frame for Pcbnew.
bool DoAutoSave()
Perform auto save when the board has been modified and not saved within the auto save interval.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
BOARD * board() const
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:565
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:373
ITER end()
Definition: selection.h:80
ITER begin()
Definition: selection.h:79
void SaveProjectCopy(const wxString &aFullPath, PROJECT *aProject=nullptr)
Save a copy of the current project under the given path.
Represent a set of closed polygons.
void SetBitmap(const wxBitmapBundle &aBmp)
Generic, UI-independent tool event.
Definition: tool_event.h:168
int GetIntValue()
Definition: unit_binder.h:134
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition: common.cpp:355
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
Definition: common.cpp:59
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:194
This file is part of the common library.
bool BuildBoardPolygonOutlines(BOARD *aBoard, SHAPE_POLY_SET &aOutlines, int aErrorMax, int aChainingEpsilon, OUTLINE_ERROR_HANDLER *aErrorHandler, bool aAllowUseArcsInPolygons)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
static const std::map< wxString, int > c_formatExtToChoice
static const std::vector< wxString > c_formatCommand
#define _(s)
static const std::string BrepFileExtension
static const std::string StepFileAbrvExtension
static const std::string XaoFileExtension
static const std::string GltfBinaryFileExtension
static const std::string StlFileExtension
static const std::string AutoSaveFilePrefix
static const std::string PlyFileExtension
static const std::string StepFileExtension
static const std::string StepZFileAbrvExtension
const wxChar *const traceKiCad2Step
Flag to enable KiCad2Step debug tracing.
This file is part of the common library.
std::optional< V > get_opt(const std::map< wxString, V > &aMap, const wxString &aKey)
Definition: map_helpers.h:34
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:902
see class PGM_BASE
std::vector< FAB_LAYER_COLOR > dummy
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: string_utils.h:429
constexpr double IUTomm(int iu) const
Definition: base_units.h:90
constexpr int mmToIU(double mm) const
Definition: base_units.h:92
wxLogTrace helper definitions.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:694
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
Definition of file extensions used in Kicad.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().
Definition: wx_filename.h:39