Added STEP Export menu item and supporting code
This commit is contained in:
parent
34fef23bd4
commit
33948e572d
|
@ -965,6 +965,13 @@ public:
|
|||
bool Export_IDF3( BOARD* aPcb, const wxString& aFullFileName,
|
||||
bool aUseThou, double aXRef, double aYRef );
|
||||
|
||||
|
||||
/**
|
||||
* Function OnExportSTEP
|
||||
* Exports the current BOARD to a STEP assembly.
|
||||
*/
|
||||
void OnExportSTEP( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function ExporttoSPECCTRA
|
||||
* Ask for a filename and call ExportSpecctraFile to export the current BOARD
|
||||
|
|
|
@ -68,6 +68,8 @@ set( PCBNEW_DIALOGS
|
|||
dialogs/dialog_export_idf_base.cpp
|
||||
dialogs/dialog_export_vrml_base.cpp
|
||||
dialogs/dialog_export_vrml.cpp
|
||||
dialogs/dialog_export_step_base.cpp
|
||||
dialogs/dialog_export_step.cpp
|
||||
dialogs/dialog_find_base.cpp
|
||||
dialogs/dialog_find.cpp
|
||||
dialogs/dialog_fp_lib_table_base.cpp
|
||||
|
|
|
@ -0,0 +1,310 @@
|
|||
/**
|
||||
* @file dialog_export_step.cpp
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Cirilo Bernardo
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <wx/choicdlg.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
#include "wxPcbStruct.h"
|
||||
#include "kiface_i.h"
|
||||
#include "pcbnew.h"
|
||||
#include "class_board.h"
|
||||
#include "dialog_export_step_base.h"
|
||||
|
||||
#define OPTKEY_STEP_USE_DRILL_ORG wxT( "STEP_UseDrillOrigin" )
|
||||
#define OPTKEY_STEP_USE_AUX_ORG wxT( "STEP_UseAuxOrigin" )
|
||||
#define OPTKEY_STEP_USE_USER_ORG wxT( "STEP_UseUserOrigin" )
|
||||
#define OPTKEY_STEP_UORG_UNITS wxT( "STEP_UserOriginUnits" )
|
||||
#define OPTKEY_STEP_UORG_X wxT( "STEP_UserOriginX" )
|
||||
#define OPTKEY_STEP_UORG_Y wxT( "STEP_UserOriginY" )
|
||||
|
||||
|
||||
class DIALOG_EXPORT_STEP: public DIALOG_EXPORT_STEP_BASE
|
||||
{
|
||||
private:
|
||||
PCB_EDIT_FRAME* m_parent;
|
||||
wxConfigBase* m_config;
|
||||
bool m_useDrillOrg; // remember last preference for Use Drill Origin
|
||||
bool m_useAuxOrg; // remember last preference for Use Aux Origin
|
||||
bool m_useUserOrg; // remember last preference for Use User Origin
|
||||
int m_OrgUnits; // remember last units for User Origin
|
||||
double m_XOrg; // remember last User Origin X value
|
||||
double m_YOrg; // remember last User Origin Y value
|
||||
|
||||
public:
|
||||
DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* parent ) :
|
||||
DIALOG_EXPORT_STEP_BASE( parent )
|
||||
{
|
||||
m_parent = parent;
|
||||
m_config = Kiface().KifaceSettings();
|
||||
SetFocus();
|
||||
m_useDrillOrg = false;
|
||||
m_config->Read( OPTKEY_STEP_USE_DRILL_ORG, &m_useDrillOrg );
|
||||
m_cbDrillOrigin->SetValue( m_useDrillOrg );
|
||||
m_useAuxOrg = false;
|
||||
m_config->Read( OPTKEY_STEP_USE_AUX_ORG, &m_useAuxOrg );
|
||||
m_cbAuxOrigin->SetValue( m_useAuxOrg );
|
||||
m_useUserOrg = false;
|
||||
m_config->Read( OPTKEY_STEP_USE_USER_ORG, &m_useUserOrg );
|
||||
m_cbUserOrigin->SetValue( m_useUserOrg );
|
||||
m_cbUserOrigin->Bind( wxEVT_CHECKBOX, &DIALOG_EXPORT_STEP::OnUserOriginSelect, this );
|
||||
m_config->Read( OPTKEY_STEP_UORG_UNITS, &m_OrgUnits, 0 );
|
||||
m_config->Read( OPTKEY_STEP_UORG_X, &m_XOrg, 0.0 );
|
||||
m_config->Read( OPTKEY_STEP_UORG_Y, &m_YOrg, 0.0 );
|
||||
|
||||
m_STEP_OrgUnitChoice->SetSelection( m_OrgUnits );
|
||||
wxString tmpStr;
|
||||
tmpStr << m_XOrg;
|
||||
m_STEP_Xorg->SetValue( tmpStr );
|
||||
tmpStr = wxT( "" );
|
||||
tmpStr << m_YOrg;
|
||||
m_STEP_Yorg->SetValue( tmpStr );
|
||||
|
||||
if( m_useUserOrg )
|
||||
{
|
||||
m_STEP_OrgUnitChoice->Enable( true );
|
||||
m_STEP_Xorg->Enable( true );
|
||||
m_STEP_Yorg->Enable( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_STEP_OrgUnitChoice->Enable( false );
|
||||
m_STEP_Xorg->Enable( false );
|
||||
m_STEP_Yorg->Enable( false );
|
||||
}
|
||||
|
||||
m_sdbSizerOK->SetDefault();
|
||||
|
||||
FixOSXCancelButtonIssue();
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
FinishDialogSettings();
|
||||
}
|
||||
|
||||
~DIALOG_EXPORT_STEP()
|
||||
{
|
||||
m_config->Write( OPTKEY_STEP_USE_DRILL_ORG, m_cbDrillOrigin->GetValue() );
|
||||
m_config->Write( OPTKEY_STEP_USE_AUX_ORG, m_cbAuxOrigin->GetValue() );
|
||||
m_config->Write( OPTKEY_STEP_USE_USER_ORG, m_cbUserOrigin->GetValue() );
|
||||
|
||||
m_config->Write( OPTKEY_STEP_UORG_UNITS, m_STEP_OrgUnitChoice->GetSelection() );
|
||||
m_config->Write( OPTKEY_STEP_UORG_X, m_STEP_Xorg->GetValue() );
|
||||
m_config->Write( OPTKEY_STEP_UORG_Y, m_STEP_Yorg->GetValue() );
|
||||
}
|
||||
|
||||
wxFilePickerCtrl* FilePicker()
|
||||
{
|
||||
return m_filePickerSTEP;
|
||||
}
|
||||
|
||||
int GetOrgUnitsChoice()
|
||||
{
|
||||
return m_STEP_OrgUnitChoice->GetSelection();
|
||||
}
|
||||
|
||||
double GetXOrg()
|
||||
{
|
||||
return DoubleValueFromString( UNSCALED_UNITS, m_STEP_Xorg->GetValue() );
|
||||
}
|
||||
|
||||
double GetYOrg()
|
||||
{
|
||||
return DoubleValueFromString( UNSCALED_UNITS, m_STEP_Yorg->GetValue() );
|
||||
}
|
||||
|
||||
bool GetDrillOrgOption()
|
||||
{
|
||||
return m_cbDrillOrigin->GetValue();
|
||||
}
|
||||
|
||||
bool GetAuxOrgOption()
|
||||
{
|
||||
return m_cbAuxOrigin->GetValue();
|
||||
}
|
||||
|
||||
bool GetUserOrgOption()
|
||||
{
|
||||
return m_cbUserOrigin->GetValue();
|
||||
}
|
||||
|
||||
void OnUserOriginSelect( wxCommandEvent& event )
|
||||
{
|
||||
if( GetUserOrgOption() )
|
||||
{
|
||||
m_STEP_OrgUnitChoice->Enable( true );
|
||||
m_STEP_Xorg->Enable( true );
|
||||
m_STEP_Yorg->Enable( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_STEP_OrgUnitChoice->Enable( false );
|
||||
m_STEP_Xorg->Enable( false );
|
||||
m_STEP_Yorg->Enable( false );
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::OnExportSTEP( wxCommandEvent& event )
|
||||
{
|
||||
|
||||
wxFileName brdFile = GetBoard()->GetFileName();
|
||||
wxString brdName = brdFile.GetFullPath();
|
||||
|
||||
if( GetScreen()->IsModify() || brdFile.GetFullPath().empty() )
|
||||
{
|
||||
int idx = wxMessageBox( _( "The PCB has been modified; save before proceeding?" ),
|
||||
_( "STEP Export: Modified PCB" ), wxYES_NO | wxCANCEL, this );
|
||||
|
||||
switch( idx )
|
||||
{
|
||||
case wxYES:
|
||||
if( !doAutoSave() )
|
||||
{
|
||||
wxMessageBox( _( "Autosave failed; STEP export cancelled" ),
|
||||
_( "STEP Export" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
brdFile = GetBoard()->GetFileName();
|
||||
brdName = GetAutoSaveFilePrefix();
|
||||
brdName.append( brdFile.GetName() );
|
||||
brdFile.SetName( brdName );
|
||||
break;
|
||||
|
||||
case wxNO:
|
||||
if( brdFile.GetFullPath().empty() )
|
||||
{
|
||||
wxMessageBox( _( "No board file; STEP export cancelled" ),
|
||||
_( "STEP Export" ) );
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
brdName = brdFile.GetFullPath();
|
||||
}
|
||||
|
||||
// Build default output file name
|
||||
brdFile = GetBoard()->GetFileName();
|
||||
wxString brdExt = brdFile.GetExt();
|
||||
brdFile.SetExt( wxT( "stp" ) );
|
||||
|
||||
DIALOG_EXPORT_STEP dlg( this );
|
||||
dlg.FilePicker()->SetPath( brdFile.GetFullPath() );
|
||||
bool fileOverwrite = false;
|
||||
wxString outputFile;
|
||||
|
||||
while( !fileOverwrite )
|
||||
{
|
||||
if ( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
brdFile = dlg.FilePicker()->GetPath();
|
||||
brdFile.SetExt( "stp" );
|
||||
outputFile = brdFile.GetFullPath();
|
||||
|
||||
if( wxFile::Exists( outputFile ) )
|
||||
{
|
||||
wxString msg( _( "File: " ) );
|
||||
msg.append( outputFile );
|
||||
msg.append( "\n" );
|
||||
msg.append( _( "File exists, overwrite?" ) );
|
||||
int resp = wxMessageBox( msg, _( "STEP Export" ), wxYES_NO | wxCANCEL, this );
|
||||
|
||||
switch( resp )
|
||||
{
|
||||
case wxCANCEL:
|
||||
return;
|
||||
|
||||
case wxYES:
|
||||
fileOverwrite = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fileOverwrite = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool aUseDrillOrg = dlg.GetDrillOrgOption();
|
||||
bool aUseAuxOrg = dlg.GetAuxOrgOption();
|
||||
bool aUseUserOrg = dlg.GetUserOrgOption();
|
||||
double aXOrg = 0.0;
|
||||
double aYOrg = 0.0;
|
||||
|
||||
if( aUseUserOrg )
|
||||
{
|
||||
aXOrg = dlg.GetXOrg();
|
||||
aYOrg = dlg.GetYOrg();
|
||||
|
||||
if( dlg.GetOrgUnitsChoice() == 1 )
|
||||
{
|
||||
// selected reference unit is in inches
|
||||
aXOrg *= 25.4;
|
||||
aYOrg *= 25.4;
|
||||
}
|
||||
}
|
||||
|
||||
wxBusyCursor dummy;
|
||||
wxFileName appK2S( wxStandardPaths::Get().GetExecutablePath() );
|
||||
appK2S.SetName( "kicad2step" );
|
||||
|
||||
wxString cmdK2S = appK2S.GetFullPath();
|
||||
|
||||
if( aUseDrillOrg )
|
||||
cmdK2S.Append( " --drill-origin" );
|
||||
|
||||
if( aUseAuxOrg )
|
||||
cmdK2S.Append( " --grid-origin" );
|
||||
|
||||
if( aUseUserOrg )
|
||||
cmdK2S.Append( wxString::Format( " --user-origin %.6fx%.6f", aXOrg, aYOrg ) );
|
||||
|
||||
cmdK2S.Append( " -f -o " );
|
||||
cmdK2S.Append( outputFile );
|
||||
|
||||
cmdK2S.Append( " " );
|
||||
cmdK2S.Append( brdName );
|
||||
|
||||
if( wxExecute( cmdK2S, wxEXEC_SYNC | wxEXEC_HIDE_CONSOLE ) )
|
||||
{
|
||||
wxMessageBox( _( "Unable to create STEP file." ),
|
||||
_( "STEP EXPORT" ), wxOK );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 12 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_export_step_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bSizerSTEPFile;
|
||||
bSizerSTEPFile = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_txtBrdFile = new wxStaticText( this, wxID_ANY, _("File name:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_txtBrdFile->Wrap( -1 );
|
||||
bSizerSTEPFile->Add( m_txtBrdFile, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_filePickerSTEP = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, _("Select a STEP export filename"), wxT("*.stp,*.step"), wxDefaultPosition, wxSize( 450,-1 ), wxFLP_OVERWRITE_PROMPT|wxFLP_SAVE|wxFLP_USE_TEXTCTRL );
|
||||
bSizerSTEPFile->Add( m_filePickerSTEP, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizer7;
|
||||
bSizer7 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText6 = new wxStaticText( this, wxID_ANY, _("Origin Options:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText6->Wrap( -1 );
|
||||
bSizer7->Add( m_staticText6, 0, wxALL, 5 );
|
||||
|
||||
m_cbDrillOrigin = new wxCheckBox( this, wxID_ANY, _("Drill origin"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer7->Add( m_cbDrillOrigin, 0, wxALL, 5 );
|
||||
|
||||
m_cbAuxOrigin = new wxCheckBox( this, wxID_ANY, _("Aux Origin"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer7->Add( m_cbAuxOrigin, 0, wxALL, 5 );
|
||||
|
||||
m_cbUserOrigin = new wxCheckBox( this, wxID_ANY, _("User defined origin"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer7->Add( m_cbUserOrigin, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizer2->Add( bSizer7, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer3;
|
||||
bSizer3 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText2 = new wxStaticText( this, wxID_ANY, _("User Defined Origin:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText2->Wrap( -1 );
|
||||
bSizer3->Add( m_staticText2, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bSizer6;
|
||||
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticText5 = new wxStaticText( this, wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText5->Wrap( -1 );
|
||||
bSizer6->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
wxString m_STEP_OrgUnitChoiceChoices[] = { _("mm"), _("inch") };
|
||||
int m_STEP_OrgUnitChoiceNChoices = sizeof( m_STEP_OrgUnitChoiceChoices ) / sizeof( wxString );
|
||||
m_STEP_OrgUnitChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_STEP_OrgUnitChoiceNChoices, m_STEP_OrgUnitChoiceChoices, 0 );
|
||||
m_STEP_OrgUnitChoice->SetSelection( 0 );
|
||||
bSizer6->Add( m_STEP_OrgUnitChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
|
||||
bSizer3->Add( bSizer6, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticText3 = new wxStaticText( this, wxID_ANY, _("X Position:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText3->Wrap( -1 );
|
||||
bSizer4->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_STEP_Xorg = new wxTextCtrl( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
#ifdef __WXGTK__
|
||||
if ( !m_STEP_Xorg->HasFlag( wxTE_MULTILINE ) )
|
||||
{
|
||||
m_STEP_Xorg->SetMaxLength( 8 );
|
||||
}
|
||||
#else
|
||||
m_STEP_Xorg->SetMaxLength( 8 );
|
||||
#endif
|
||||
bSizer4->Add( m_STEP_Xorg, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
|
||||
bSizer3->Add( bSizer4, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer5;
|
||||
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Y Position:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText4->Wrap( -1 );
|
||||
bSizer5->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_STEP_Yorg = new wxTextCtrl( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
#ifdef __WXGTK__
|
||||
if ( !m_STEP_Yorg->HasFlag( wxTE_MULTILINE ) )
|
||||
{
|
||||
m_STEP_Yorg->SetMaxLength( 8 );
|
||||
}
|
||||
#else
|
||||
m_STEP_Yorg->SetMaxLength( 8 );
|
||||
#endif
|
||||
bSizer5->Add( m_STEP_Yorg, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
|
||||
bSizer3->Add( bSizer5, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer2->Add( bSizer3, 1, wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerSTEPFile->Add( bSizer2, 1, wxEXPAND, 5 );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerSTEPFile->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer->AddButton( m_sdbSizerOK );
|
||||
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizer->AddButton( m_sdbSizerCancel );
|
||||
m_sdbSizer->Realize();
|
||||
|
||||
bSizerSTEPFile->Add( m_sdbSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerSTEPFile );
|
||||
this->Layout();
|
||||
bSizerSTEPFile->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
}
|
||||
|
||||
DIALOG_EXPORT_STEP_BASE::~DIALOG_EXPORT_STEP_BASE()
|
||||
{
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,68 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 12 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_EXPORT_STEP_BASE_H__
|
||||
#define __DIALOG_EXPORT_STEP_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class DIALOG_SHIM;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/filepicker.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/valtext.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_EXPORT_STEP_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_EXPORT_STEP_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_txtBrdFile;
|
||||
wxFilePickerCtrl* m_filePickerSTEP;
|
||||
wxStaticText* m_staticText6;
|
||||
wxCheckBox* m_cbDrillOrigin;
|
||||
wxCheckBox* m_cbAuxOrigin;
|
||||
wxCheckBox* m_cbUserOrigin;
|
||||
wxStaticText* m_staticText2;
|
||||
wxStaticText* m_staticText5;
|
||||
wxChoice* m_STEP_OrgUnitChoice;
|
||||
wxStaticText* m_staticText3;
|
||||
wxTextCtrl* m_STEP_Xorg;
|
||||
wxStaticText* m_staticText4;
|
||||
wxTextCtrl* m_STEP_Yorg;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
wxButton* m_sdbSizerCancel;
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Export STEP"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_EXPORT_STEP_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_EXPORT_STEP_BASE_H__
|
|
@ -221,6 +221,10 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
_( "I&DFv3" ), _( "IDFv3 board and component export" ),
|
||||
KiBitmap( export_idf_xpm ) );
|
||||
|
||||
AddMenuItem( submenuexport, ID_GEN_EXPORT_FILE_STEP,
|
||||
_( "S&TEP" ), _( "STEP export" ),
|
||||
KiBitmap( export_idf_xpm ) );
|
||||
|
||||
AddMenuItem( submenuexport, ID_PCB_GEN_CMP_FILE,
|
||||
_( "&Component (.cmp) File" ),
|
||||
_( "Export component file (*.cmp) for Eeschema footprint field back-annotation" ),
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
#include <pcb_draw_panel_gal.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <functional>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
///@{
|
||||
|
@ -128,6 +129,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT, PCB_EDIT_FRAME::GenFootprintsReport )
|
||||
EVT_MENU( ID_GEN_EXPORT_FILE_VRML, PCB_EDIT_FRAME::OnExportVRML )
|
||||
EVT_MENU( ID_GEN_EXPORT_FILE_IDF3, PCB_EDIT_FRAME::OnExportIDF3 )
|
||||
EVT_MENU( ID_GEN_EXPORT_FILE_STEP, PCB_EDIT_FRAME::OnExportSTEP )
|
||||
|
||||
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION,PCB_EDIT_FRAME::ImportSpecctraSession )
|
||||
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN, PCB_EDIT_FRAME::ImportSpecctraDesign )
|
||||
|
@ -466,6 +468,24 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
}
|
||||
|
||||
enableGALSpecificMenus();
|
||||
|
||||
// disable Export STEP item if kicad2step does not exist
|
||||
wxString strK2S = Pgm().GetExecutablePath();
|
||||
|
||||
#ifdef _WIN32
|
||||
// translate from KiCad's internal UNIX-like path to MSWin paths
|
||||
str2KS.Replace( wxT( "/" ), wxT( "\\" ) );
|
||||
#endif
|
||||
|
||||
wxFileName appK2S( strK2S, "kicad2step" );
|
||||
|
||||
#ifdef _WIN32
|
||||
appK2S.SetExt( ".exe" );
|
||||
#endif
|
||||
|
||||
if( !appK2S.FileExists() )
|
||||
GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -265,6 +265,7 @@ enum pcbnew_ids
|
|||
|
||||
ID_GEN_EXPORT_FILE_IDF3,
|
||||
ID_GEN_EXPORT_FILE_VRML,
|
||||
ID_GEN_EXPORT_FILE_STEP,
|
||||
ID_GEN_EXPORT_SPECCTRA,
|
||||
ID_GEN_EXPORT_FILE_GENCADFORMAT,
|
||||
ID_GEN_EXPORT_FILE_MODULE_REPORT,
|
||||
|
|
Loading…
Reference in New Issue