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 (C) 2016-2024 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>
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>
43#include <pcbnew_settings.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>
52
53
54// Maps m_choiceFormat selection to extension (and kicad-cli command)
55static const std::vector<wxString> c_formatCommand = { FILEEXT::StepFileExtension,
59
60// Maps file extensions to m_choiceFormat selection
61static const std::map<wxString, int> c_formatExtToChoice = { { FILEEXT::StepFileExtension, 0 },
66
67
69{
70public:
72 {
73 STEP_ORIGIN_0, // absolute coordinates
74 STEP_ORIGIN_PLOT_AXIS, // origin is plot/drill axis origin
75 STEP_ORIGIN_GRID_AXIS, // origin is grid origin
76 STEP_ORIGIN_BOARD_CENTER, // origin is board center
77 STEP_ORIGIN_USER, // origin is entered by user
78 };
79
80 DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString& aBoardPath );
82
83protected:
84 void onBrowseClicked( wxCommandEvent& aEvent ) override;
85 void onUpdateUnits( wxUpdateUIEvent& aEvent ) override;
86 void onUpdateXPos( wxUpdateUIEvent& aEvent ) override;
87 void onUpdateYPos( wxUpdateUIEvent& aEvent ) override;
88 void onExportButton( wxCommandEvent& aEvent ) override;
89 void onFormatChoice( wxCommandEvent& event ) override;
90
92 {
93 return m_STEP_OrgUnitChoice->GetSelection();
94 }
95
96 double GetXOrg() const
97 {
99 }
100
101 double GetYOrg()
102 {
104 }
105
107
109 {
110 return m_cbRemoveUnspecified->GetValue();
111 }
112
114 {
115 return m_cbRemoveDNP->GetValue();
116 }
117
119 {
120 return m_cbSubstModels->GetValue();
121 }
122
124 {
125 return m_cbOverwriteFile->GetValue();
126 }
127
128private:
130 STEP_ORIGIN_OPTION m_origin; // The last preference for STEP origin option
131 double m_userOriginX; // remember last User Origin X value
132 double m_userOriginY; // remember last User Origin Y value
133 int m_originUnits; // remember last units for User Origin
134 bool m_noUnspecified; // remember last preference for No Unspecified Component
135 bool m_noDNP; // remember last preference for No DNP Component
136 static bool m_optimizeStep; // remember last preference for Optimize STEP file (stored only for the session)
137 static bool m_exportBoardBody; // remember last preference to export board body (stored only for the session)
138 static bool m_exportComponents; // remember last preference to export components (stored only for the session)
139 static bool m_exportTracks; // remember last preference to export tracks and vias (stored only for the session)
140 static bool m_exportPads; // remember last preference to export pads (stored only for the session)
141 static bool m_exportZones; // remember last preference to export zones (stored only for the session)
142 static bool m_exportInnerCopper; // remember last preference to export inner layers (stored only for the session)
143 static bool m_exportSilkscreen; // remember last preference to export silkscreen (stored only for the session)
144 static bool m_exportSoldermask; // remember last preference to export soldermask (stored only for the session)
145 static bool m_fuseShapes; // remember last preference to fuse shapes (stored only for the session)
146 wxString m_netFilter; // filter copper nets
147 wxString m_boardPath; // path to the exported board file
148 static int m_toleranceLastChoice; // Store m_tolerance option during a session
149 static int m_formatLastChoice; // Store format option during a session
150};
151
152
153int DIALOG_EXPORT_STEP::m_toleranceLastChoice = -1; // Use default
154int DIALOG_EXPORT_STEP::m_formatLastChoice = -1; // Use default
165
166DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString& aBoardPath ) :
167 DIALOG_EXPORT_STEP_BASE( aParent )
168{
169 m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
170
171 m_parent = aParent;
172 m_boardPath = aBoardPath;
173
174 SetupStandardButtons( { { wxID_OK, _( "Export" ) },
175 { wxID_CANCEL, _( "Close" ) } } );
176
177 // Build default output file name
178 // (last saved filename in project or built from board filename)
180
181 if( path.IsEmpty() )
182 {
183 wxFileName brdFile( m_parent->GetBoard()->GetFileName() );
184 brdFile.SetExt( wxT( "step" ) );
185 path = brdFile.GetFullPath();
186 }
187
188 m_outputFileName->SetValue( path );
189
190 Layout();
191 bSizerSTEPFile->Fit( this );
192
193 SetFocus();
194
196
198
199 switch( m_origin )
200 {
201 default:
202 case STEP_ORIGIN_PLOT_AXIS: m_rbDrillAndPlotOrigin->SetValue( true ); break;
203 case STEP_ORIGIN_GRID_AXIS: m_rbGridOrigin->SetValue( true ); break;
204 case STEP_ORIGIN_USER: m_rbUserDefinedOrigin->SetValue( true ); break;
205 case STEP_ORIGIN_BOARD_CENTER: m_rbBoardCenterOrigin->SetValue( true ); break;
206 }
207
213
214 m_txtNetFilter->SetValue( m_netFilter );
215 m_cbOptimizeStep->SetValue( m_optimizeStep );
218 m_cbExportTracks->SetValue( m_exportTracks );
219 m_cbExportPads->SetValue( m_exportPads );
220 m_cbExportZones->SetValue( m_exportZones );
224 m_cbFuseShapes->SetValue( m_fuseShapes );
226 m_cbRemoveDNP->SetValue( m_noDNP );
229
230 m_STEP_OrgUnitChoice->SetSelection( m_originUnits );
231 wxString tmpStr;
232 tmpStr << m_userOriginX;
233 m_STEP_Xorg->SetValue( tmpStr );
234 tmpStr = wxEmptyString;
235 tmpStr << m_userOriginY;
236 m_STEP_Yorg->SetValue( tmpStr );
237
238 wxString bad_scales;
239 size_t bad_count = 0;
240
241 for( FOOTPRINT* fp : aParent->GetBoard()->Footprints() )
242 {
243 for( const FP_3DMODEL& model : fp->Models() )
244 {
245 if( model.m_Scale.x != 1.0 || model.m_Scale.y != 1.0 || model.m_Scale.z != 1.0 )
246 {
247 bad_scales.Append( wxS("\n") );
248 bad_scales.Append( model.m_Filename );
249 bad_count++;
250 }
251 }
252
253 if( bad_count >= 5 )
254 break;
255 }
256
257 if( !bad_scales.empty()
259 {
260 wxString extendedMsg = _( "Non-unity scaled models:" ) + wxT( "\n" ) + bad_scales;
261
262 KIDIALOG msgDlg( m_parent, _( "Scaled models detected. "
263 "Model scaling is not reliable for mechanical export." ),
264 _( "Model Scale Warning" ), wxOK | wxICON_WARNING );
265 msgDlg.SetExtendedMessage( extendedMsg );
266 msgDlg.DoNotShowCheckbox( __FILE__, __LINE__ );
267
268 msgDlg.ShowModal();
269
270 if( msgDlg.DoNotShowAgain() )
272 }
273
274 if( m_toleranceLastChoice >= 0 )
276
277 if( m_formatLastChoice >= 0 )
278 m_choiceFormat->SetSelection( m_formatLastChoice );
279
280 // Now all widgets have the size fixed, call FinishDialogSettings
282}
283
284
286{
287 GetOriginOption(); // Update m_origin member.
288
289 PCBNEW_SETTINGS* cfg = nullptr;
290
291 try
292 {
294 }
295 catch( const std::runtime_error& e )
296 {
297 wxFAIL_MSG( e.what() );
298 }
299
300 if( cfg )
301 {
302 cfg->m_ExportStep.origin_mode = static_cast<int>( m_origin );
303 cfg->m_ExportStep.origin_units = m_STEP_OrgUnitChoice->GetSelection();
306
307 double val = 0.0;
308
309 m_STEP_Xorg->GetValue().ToDouble( &val );
310 cfg->m_ExportStep.origin_x = val;
311
312 m_STEP_Yorg->GetValue().ToDouble( &val );
313 cfg->m_ExportStep.origin_y = val;
314
316 cfg->m_ExportStep.no_dnp = m_cbRemoveDNP->GetValue();
317 }
318
319 m_netFilter = m_txtNetFilter->GetValue();
321 m_formatLastChoice = m_choiceFormat->GetSelection();
322 m_optimizeStep = m_cbOptimizeStep->GetValue();
323 m_exportBoardBody = m_cbExportBody->GetValue();
325 m_exportTracks = m_cbExportTracks->GetValue();
326 m_exportPads = m_cbExportPads->GetValue();
327 m_exportZones = m_cbExportZones->GetValue();
331 m_fuseShapes = m_cbFuseShapes->GetValue();
332}
333
334
336{
338
339 if( m_rbDrillAndPlotOrigin->GetValue() )
341 else if( m_rbGridOrigin->GetValue() )
343 else if( m_rbUserDefinedOrigin->GetValue() )
345 else if( m_rbBoardCenterOrigin->GetValue() )
347
348 return m_origin;
349}
350
351
352void PCB_EDIT_FRAME::OnExportSTEP( wxCommandEvent& event )
353{
354 wxFileName brdFile = GetBoard()->GetFileName();
355
356 // The project filename (.kicad_pro) of the auto saved board filename, if it is created
357 wxFileName autosaveProjFile;
358
359 if( GetScreen()->IsContentModified() || brdFile.GetFullPath().empty() )
360 {
361 if( !doAutoSave() )
362 {
363 DisplayErrorMessage( this, _( "STEP export failed! "
364 "Please save the PCB and try again" ) );
365 return;
366 }
367
368 wxString autosaveFileName = FILEEXT::AutoSaveFilePrefix + brdFile.GetName();
369
370 // Create a dummy .kicad_pro file for this auto saved board file.
371 // this is useful to use some settings (like project path and name)
372 // Because doAutoSave() works, the target directory exists and is writable
373 autosaveProjFile = brdFile;
374 autosaveProjFile.SetName( autosaveFileName );
375 autosaveProjFile.SetExt( "kicad_pro" );
376
377 // Use auto-saved board for export
378 GetSettingsManager()->SaveProjectCopy( autosaveProjFile.GetFullPath(), GetBoard()->GetProject() );
379 brdFile.SetName( autosaveFileName );
380 }
381
382 DIALOG_EXPORT_STEP dlg( this, brdFile.GetFullPath() );
383 dlg.ShowModal();
384
385 // If a dummy .kicad_pro file is created, delete it now it is useless.
386 if( !autosaveProjFile.GetFullPath().IsEmpty() )
387 wxRemoveFile( autosaveProjFile.GetFullPath() );
388}
389
390
391void DIALOG_EXPORT_STEP::onUpdateUnits( wxUpdateUIEvent& aEvent )
392{
393 aEvent.Enable( m_rbUserDefinedOrigin->GetValue() );
394}
395
396
397void DIALOG_EXPORT_STEP::onUpdateXPos( wxUpdateUIEvent& aEvent )
398{
399 aEvent.Enable( m_rbUserDefinedOrigin->GetValue() );
400}
401
402
403void DIALOG_EXPORT_STEP::onUpdateYPos( wxUpdateUIEvent& aEvent )
404{
405 aEvent.Enable( m_rbUserDefinedOrigin->GetValue() );
406}
407
408
409void DIALOG_EXPORT_STEP::onBrowseClicked( wxCommandEvent& aEvent )
410{
411 // clang-format off
412 wxString filter = _( "STEP files" )
414 + _( "Binary glTF files" )
416 + _( "XAO files" )
418 + _( "BREP (OCCT) files" )
420 // clang-format on
421
422 // Build the absolute path of current output directory to preselect it in the file browser.
423 wxString path = ExpandEnvVarSubstitutions( m_outputFileName->GetValue(), &Prj() );
424 wxFileName fn( Prj().AbsolutePath( path ) );
425
426 wxFileDialog dlg( this, _( "3D Model Output File" ), fn.GetPath(), fn.GetFullName(), filter,
427 wxFD_SAVE );
428
429 if( dlg.ShowModal() == wxID_CANCEL )
430 return;
431
432 path = dlg.GetPath();
433 m_outputFileName->SetValue( path );
434
435 fn = wxFileName( path );
436
437 if( auto formatChoice = get_opt( c_formatExtToChoice, fn.GetExt().Lower() ) )
438 m_choiceFormat->SetSelection( *formatChoice );
439}
440
441
442void DIALOG_EXPORT_STEP::onFormatChoice( wxCommandEvent& event )
443{
444 wxString newExt = c_formatCommand[m_choiceFormat->GetSelection()];
445 wxString path = m_outputFileName->GetValue();
446
447 int sepIdx = std::max( path.Find( '/', true ), path.Find( '\\', true ) );
448 int dotIdx = path.Find( '.', true );
449
450 if( dotIdx == -1 || dotIdx < sepIdx )
451 path << '.' << newExt;
452 else
453 path = path.Mid( 0, dotIdx ) << '.' << newExt;
454
455 m_outputFileName->SetValue( path );
456}
457
458
459void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
460{
461 wxString path = m_outputFileName->GetValue();
463
464 // Build the absolute path of current output directory to preselect it in the file browser.
465 std::function<bool( wxString* )> textResolver =
466 [&]( wxString* token ) -> bool
467 {
468 return m_parent->GetBoard()->ResolveTextVar( token, 0 );
469 };
470
471 path = ExpandTextVars( path, &textResolver );
473 path = Prj().AbsolutePath( path );
474
475 if( path.IsEmpty() )
476 {
477 DisplayErrorMessage( this, _( "No filename for output file" ) );
478 return;
479 }
480
481 m_netFilter = m_txtNetFilter->GetValue();
482
483 double tolerance; // default value in mm
485 m_formatLastChoice = m_choiceFormat->GetSelection();
486 m_optimizeStep = m_cbOptimizeStep->GetValue();
487 m_exportBoardBody = m_cbExportBody->GetValue();
489 m_exportTracks = m_cbExportTracks->GetValue();
490 m_exportPads = m_cbExportPads->GetValue();
491 m_exportZones = m_cbExportZones->GetValue();
495 m_fuseShapes = m_cbFuseShapes->GetValue();
496
497 switch( m_choiceTolerance->GetSelection() )
498 {
499 case 0: tolerance = 0.001; break;
500 default:
501 case 1: tolerance = 0.01; break;
502 case 2: tolerance = 0.1; break;
503 }
504
505 SHAPE_POLY_SET outline;
506 wxString msg;
507
508 // Check if the board outline is continuous
509 // max dist from one endPt to next startPt to build a closed shape:
510 int chainingEpsilon = pcbIUScale.mmToIU( tolerance );
511
512 // Arc to segment approx error (not critical here: we do not use the outline shape):
513 int maxError = pcbIUScale.mmToIU( 0.005 );
514 bool success = BuildBoardPolygonOutlines( m_parent->GetBoard(), outline, maxError,
515 chainingEpsilon, nullptr );
516 if( !success )
517 {
518 DisplayErrorMessage( this, wxString::Format(
519 _( "Board outline is missing or not closed using %.3f mm tolerance.\n"
520 "Run DRC for a full analysis." ), tolerance ) );
521 return;
522 }
523
524 wxFileName fn( Prj().AbsolutePath( path ) );
525
526 if( fn.FileExists() && !GetOverwriteFile() )
527 {
528 msg.Printf( _( "File '%s' already exists. Do you want overwrite this file?" ),
529 fn.GetFullPath() );
530
531 if( wxMessageBox( msg, _( "STEP/GLTF Export" ), wxYES_NO | wxICON_QUESTION, this ) == wxNO )
532 return;
533 }
534
535 wxFileName appK2S( wxStandardPaths::Get().GetExecutablePath() );
536#ifdef __WXMAC__
537 // On macOS, we have standalone applications inside the main bundle, so we handle that here:
538 if( appK2S.GetPath().Find( "/Contents/Applications/pcbnew.app/Contents/MacOS" ) != wxNOT_FOUND )
539 {
540 appK2S.AppendDir( wxT( ".." ) );
541 appK2S.AppendDir( wxT( ".." ) );
542 appK2S.AppendDir( wxT( ".." ) );
543 appK2S.AppendDir( wxT( ".." ) );
544 appK2S.AppendDir( wxT( "MacOS" ) );
545 }
546#else
547 if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
548 {
549 appK2S.RemoveLastDir();
550 appK2S.AppendDir( "kicad" );
551 }
552#endif
553
554 appK2S.SetName( wxT( "kicad-cli" ) );
555 appK2S.Normalize( FN_NORMALIZE_FLAGS );
556
557 wxString cmdK2S = wxT( "\"" );
558 cmdK2S.Append( appK2S.GetFullPath() );
559 cmdK2S.Append( wxT( "\"" ) );
560
561 cmdK2S.Append( wxT( " pcb" ) );
562 cmdK2S.Append( wxT( " export" ) );
563
564 cmdK2S.Append( wxT( " " ) );
565 cmdK2S.Append( c_formatCommand[m_choiceFormat->GetSelection()] );
566
568 cmdK2S.Append( wxT( " --no-unspecified" ) );
569
570 if( GetNoDNPOption() )
571 cmdK2S.Append( wxT( " --no-dnp" ) );
572
573 if( GetSubstOption() )
574 cmdK2S.Append( wxT( " --subst-models" ) );
575
576 if( !m_optimizeStep )
577 cmdK2S.Append( wxT( " --no-optimize-step" ) );
578
579 if( !m_exportBoardBody )
580 cmdK2S.Append( wxT( " --no-board-body" ) );
581
582 if( !m_exportComponents )
583 cmdK2S.Append( wxT( " --no-components" ) );
584
585 if( m_exportTracks )
586 cmdK2S.Append( wxT( " --include-tracks" ) );
587
588 if( m_exportPads )
589 cmdK2S.Append( wxT( " --include-pads" ) );
590
591 if( m_exportZones )
592 cmdK2S.Append( wxT( " --include-zones" ) );
593
595 cmdK2S.Append( wxT( " --include-inner-copper" ) );
596
598 cmdK2S.Append( wxT( " --include-silkscreen" ) );
599
601 cmdK2S.Append( wxT( " --include-soldermask" ) );
602
603 if( m_fuseShapes )
604 cmdK2S.Append( wxT( " --fuse-shapes" ) );
605
606 // Note: for some reason, using \" to insert a quote in a format string, under MacOS
607 // wxString::Format does not work. So use a %c format in string
608 int quote = '\'';
609 int dblquote = '"';
610
611 if( !m_netFilter.empty() )
612 {
613 cmdK2S.Append( wxString::Format( wxT( " --net-filter %c%s%c" ), dblquote, m_netFilter,
614 dblquote ) );
615 }
616
617 switch( GetOriginOption() )
618 {
619 case STEP_ORIGIN_0:
620 wxFAIL_MSG( wxT( "Unsupported origin option: how did we get here?" ) );
621 break;
622
624 cmdK2S.Append( wxT( " --drill-origin" ) );
625 break;
626
628 cmdK2S.Append( wxT( " --grid-origin" ) );
629 break;
630
631 case STEP_ORIGIN_USER:
632 {
633 double xOrg = GetXOrg();
634 double yOrg = GetYOrg();
635
636 if( GetOrgUnitsChoice() == 1 )
637 {
638 // selected reference unit is in inches, and STEP units are mm
639 xOrg *= 25.4;
640 yOrg *= 25.4;
641 }
642
644 cmdK2S.Append( wxString::Format( wxT( " --user-origin=%c%.6fx%.6fmm%c" ),
645 quote, xOrg, yOrg, quote ) );
646 break;
647 }
648
650 {
651 BOX2I bbox = m_parent->GetBoard()->ComputeBoundingBox( true, false );
652 double xOrg = pcbIUScale.IUTomm( bbox.GetCenter().x );
653 double yOrg = pcbIUScale.IUTomm( bbox.GetCenter().y );
655
656 cmdK2S.Append( wxString::Format( wxT( " --user-origin=%c%.6fx%.6fmm%c" ),
657 quote, xOrg, yOrg, quote ) );
658 break;
659 }
660 }
661
662 {
664 cmdK2S.Append( wxString::Format( wxT( " --min-distance=%c%.3fmm%c" ),
665 quote, tolerance, quote ) );
666 }
667
668 // Output file path.
669 cmdK2S.Append( wxString::Format( wxT( " -f -o %c%s%c" ),
670 dblquote, fn.GetFullPath(), dblquote ) );
671
672
673 // Input file path.
674 cmdK2S.Append( wxString::Format( wxT( " %c%s%c" ), dblquote, m_boardPath, dblquote ) );
675
676 wxLogTrace( traceKiCad2Step, wxT( "export step command: %s" ), cmdK2S );
677
678 DIALOG_EXPORT_STEP_LOG* log = new DIALOG_EXPORT_STEP_LOG( this, cmdK2S );
679 log->ShowModal();
680}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
BOX2I ComputeBoundingBox(bool aBoardEdgesOnly=false, bool aIncludeHiddenText=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1552
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: board.cpp:421
const FOOTPRINTS & Footprints() const
Definition: board.h:323
const wxString & GetFileName() const
Definition: board.h:319
const Vec GetCenter() const
Definition: box2.h:220
DO_NOT_SHOW_AGAIN m_DoNotShowAgain
Class DIALOG_EXPORT_STEP_BASE.
wxRadioButton * m_rbDrillAndPlotOrigin
STD_BITMAP_BUTTON * m_browseButton
void onFormatChoice(wxCommandEvent &event) override
STEP_ORIGIN_OPTION GetOriginOption()
PCB_EDIT_FRAME * m_parent
void onUpdateXPos(wxUpdateUIEvent &aEvent) override
STEP_ORIGIN_OPTION m_origin
void onExportButton(wxCommandEvent &aEvent) override
DIALOG_EXPORT_STEP(PCB_EDIT_FRAME *aParent, const wxString &aBoardPath)
void onUpdateUnits(wxUpdateUIEvent &aEvent) override
void onUpdateYPos(wxUpdateUIEvent &aEvent) override
void onBrowseClicked(wxCommandEvent &aEvent) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: kidialog.h:43
bool DoNotShowAgain() const
Definition: kidialog.cpp:59
void DoNotShowCheckbox(wxString file, int line)
Checks the 'do not show again' setting for the dialog.
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:49
DIALOG_EXPORT_STEP m_ExportStep
PCBNEW_SETTINGS * GetPcbNewSettings() const
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.
void SetLastPath(LAST_PATH_TYPE aType, const wxString &aLastPath)
Set the path of the last file successfully read.
bool doAutoSave() override
Perform auto save when the board has been modified and not saved within the auto save interval.
void OnExportSTEP(wxCommandEvent &event)
Export the current BOARD to a STEP assembly.
wxString GetLastPath(LAST_PATH_TYPE aType)
Get the last path for a particular type.
bool IsContentModified() const override
Get if the current board has been modified but not saved.
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:678
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:320
void SaveProjectCopy(const wxString &aFullPath, PROJECT *aProject=nullptr)
Saves a copy of the current project under the given path.
Represent a set of closed polygons.
void SetBitmap(const wxBitmapBundle &aBmp)
void SetValue(const wxString &aValue) override
Set a new value in evaluator buffer, and display it in the wxTextCtrl.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition: common.cpp:334
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:58
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:195
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 AutoSaveFilePrefix
static const std::string StepFileExtension
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
KICOMMON_API double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
Definition: eda_units.cpp:576
SETTINGS_MANAGER * GetSettingsManager()
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
see class PGM_BASE
@ LAST_PATH_STEP
Definition: project_file.h:50
std::vector< FAB_LAYER_COLOR > dummy
constexpr double IUTomm(int iu) const
Definition: base_units.h:86
constexpr int mmToIU(double mm) const
Definition: base_units.h:88
wxLogTrace helper definitions.
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