25 #include <wx/choicdlg.h> 26 #include <wx/stdpaths.h> 27 #include <wx/process.h> 112 cfg->m_ExportStep.origin_x = val;
115 cfg->m_ExportStep.origin_y = val;
139 brdFile.SetExt(
"step" );
140 path = brdFile.GetFullPath();
149 m_STEP_org_opt = static_cast<STEP_ORG_OPT>( cfg->m_ExportStep.origin_mode );
161 m_XOrg = cfg->m_ExportStep.origin_x;
162 m_YOrg = cfg->m_ExportStep.origin_y;
202 if(
GetScreen()->IsModify() || brdFile.GetFullPath().empty() )
207 "Please save the PCB and try again" ) );
242 double tolerance = 0.01;
267 chainingEpsilon, nullptr );
271 _(
"Board outline is missing or not closed using %.3f mm tolerance.\n" 272 "Run DRC for a full analysis." ), tolerance ) );
280 msg.Printf(
_(
"File '%s' already exists. Do you want overwrite this file?" ),
283 if( wxMessageBox( msg,
_(
"STEP Export" ), wxYES_NO | wxICON_QUESTION,
this ) == wxNO )
291 wxFileName appK2S( wxStandardPaths::Get().GetExecutablePath() );
295 if( appK2S.GetPath().Find(
"/Contents/Applications/pcbnew.app/Contents/MacOS" ) != wxNOT_FOUND )
297 appK2S.AppendDir(
".." );
298 appK2S.AppendDir(
".." );
299 appK2S.AppendDir(
".." );
300 appK2S.AppendDir(
".." );
301 appK2S.AppendDir(
"MacOS" );
305 appK2S.SetName(
"kicad2step" );
307 wxString cmdK2S =
"\"";
308 cmdK2S.Append( appK2S.GetFullPath() );
309 cmdK2S.Append(
"\"" );
312 cmdK2S.Append(
" --no-virtual" );
320 cmdK2S.Append(
" --drill-origin" );
324 cmdK2S.Append(
" --grid-origin" );
340 cmdK2S.Append(
wxString::Format(
" --user-origin=\"%.6f x %.6f\"", xOrg, yOrg ) );
347 xOrg = Iu2Millimeter( bbox.
GetCenter().x );
348 yOrg = Iu2Millimeter( bbox.
GetCenter().y );
350 cmdK2S.Append(
wxString::Format(
" --user-origin=\"%.6f x %.6f\"", xOrg, yOrg ) );
357 cmdK2S.Append(
wxString::Format(
" --min-distance=\"%.3f mm\"", tolerance ) );
360 cmdK2S.Append(
" -f -o " );
363 cmdK2S.Append(
" " );
366 wxExecute( cmdK2S, wxEXEC_ASYNC | wxEXEC_SHOW_CONSOLE );
wxRadioButton * m_rbGridOrigin
wxCheckBox * m_cbOverwriteFile
DIALOG_EXPORT_STEP m_ExportStep
wxRadioButton * m_rbBoardCenterOrigin
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
void onUpdateXPos(wxUpdateUIEvent &aEvent) override
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
This file is part of the common library.
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.
wxRadioButton * m_rbDrillAndPlotOrigin
PCB_EDIT_FRAME * m_parent
TEXT_CTRL_EVAL * m_STEP_Yorg
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
const wxString & GetFileName() const
void SetValue(const wxString &aValue) override
Set a new value in evaluator buffer, and display it in the wxTextCtrl.
wxString GetLastPath(LAST_PATH_TYPE aType)
Get the last path for a particular type.
int GetOrgUnitsChoice() const
static bool m_overwriteFile
STEP_ORG_OPT GetOriginOption()
void onExportButton(wxCommandEvent &aEvent) override
wxFilePickerCtrl * m_filePickerSTEP
wxButton * m_sdbSizerCancel
STEP_ORG_OPT m_STEP_org_opt
Represent a set of closed polygons.
bool BuildBoardPolygonOutlines(BOARD *aBoard, SHAPE_POLY_SET &aOutlines, int aErrorMax, int aChainingEpsilon, OUTLINE_ERROR_HANDLER *aErrorHandler)
Extracts the board outlines and build a closed polygon from lines, arcs and circle items on edge cut ...
void onUpdateUnits(wxUpdateUIEvent &aEvent) override
wxStdDialogButtonSizer * m_sdbSizer
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
static wxString GetAutoSaveFilePrefix()
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
TEXT_CTRL_EVAL * m_STEP_Xorg
Class DIALOG_EXPORT_STEP_BASE.
Handle the component boundary box.
The main frame for Pcbnew.
PCBNEW_SETTINGS * GetPcbNewSettings() const
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void onUpdateYPos(wxUpdateUIEvent &aEvent) override
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
const wxPoint GetCenter() const
double DoubleValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function DoubleValueFromString converts aTextValue to a double.
static constexpr int Millimeter2iu(double mm)
void SetLastPath(LAST_PATH_TYPE aType, const wxString &aLastPath)
Set the path of the last file successfully read.
DIALOG_EXPORT_STEP(PCB_EDIT_FRAME *aParent, const wxString &aBoardPath)
wxChoice * m_STEP_OrgUnitChoice
wxRadioButton * m_rbUserDefinedOrigin
wxCheckBox * m_cbRemoveVirtual