Add gltf export to step dialog

This commit is contained in:
Marek Roszko 2023-08-19 19:01:05 -04:00
parent 7ef3252064
commit ea3101587a
7 changed files with 27 additions and 7 deletions

View File

@ -192,6 +192,10 @@ const std::string CsvFileExtension( "csv" );
const std::string XmlFileExtension( "xml" );
const std::string JsonFileExtension( "json" );
const std::string StepFileExtension( "step" );
const std::string StepFileAbrvExtension( "stp" );
const std::string GltfBinaryFileExtension( "glb" );
const wxString GerberFileExtensionsRegex( "(gbr|gko|pho|(g[tb][alops])|(gm?\\d\\d*)|(gp[tb]))" );

View File

@ -178,6 +178,10 @@ extern const std::string CsvFileExtension;
extern const std::string XmlFileExtension;
extern const std::string JsonFileExtension;
extern const std::string StepFileExtension;
extern const std::string StepFileAbrvExtension;
extern const std::string GltfBinaryFileExtension;
extern const wxString GerberFileExtensionsRegex;
bool IsGerberFileExtension( const wxString& ext );

View File

@ -148,9 +148,14 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString&
bSizerTop->Hide( widget );
widget->Destroy();
wxString filter = _( "STEP files" )
+ AddFileExtListToFilter( { StepFileExtension, StepFileAbrvExtension } ) + "|"
+ _( "Binary GTLF files" )
+ AddFileExtListToFilter( { GltfBinaryFileExtension } );
m_filePickerSTEP = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString,
_( "Select a STEP export filename" ),
_( "STEP files" ) + AddFileExtListToFilter( { "STEP", "STP" } ),
filter,
wxDefaultPosition,
wxSize( -1, -1 ), wxFLP_SAVE | wxFLP_USE_TEXTCTRL );
bSizerTop->Add( m_filePickerSTEP, 1, wxTOP | wxRIGHT | wxLEFT | wxALIGN_CENTER_VERTICAL, 5 );
@ -368,7 +373,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
msg.Printf( _( "File '%s' already exists. Do you want overwrite this file?" ),
fn.GetFullPath() );
if( wxMessageBox( msg, _( "STEP Export" ), wxYES_NO | wxICON_QUESTION, this ) == wxNO )
if( wxMessageBox( msg, _( "STEP/GLTF Export" ), wxYES_NO | wxICON_QUESTION, this ) == wxNO )
return;
}
@ -400,7 +405,14 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
cmdK2S.Append( wxT( " pcb" ) );
cmdK2S.Append( wxT( " export" ) );
cmdK2S.Append( wxT( " step" ) );
cmdK2S.Append( wxT( " 3d" ) );
cmdK2S.Append( wxT( " --format" ) );
if( fn.GetExt() == GltfBinaryFileExtension )
cmdK2S.Append( wxT( " glb" ) );
else
cmdK2S.Append( wxT( " step" ) );
if( GetNoUnspecifiedOption() )
cmdK2S.Append( wxT( " --no-unspecified" ) );

View File

@ -50,7 +50,7 @@
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Export STEP</property>
<property name="title">Export STEP / GLTF</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>

View File

@ -74,7 +74,7 @@ class DIALOG_EXPORT_STEP_BASE : public DIALOG_SHIM
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( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Export STEP / GLTF"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EXPORT_STEP_BASE();

View File

@ -50,7 +50,7 @@
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">STEP Export</property>
<property name="title">3D Export</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>

View File

@ -43,7 +43,7 @@ class DIALOG_EXPORT_STEP_PROCESS_BASE : public DIALOG_SHIM
public:
DIALOG_EXPORT_STEP_PROCESS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("STEP Export"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_EXPORT_STEP_PROCESS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Export"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EXPORT_STEP_PROCESS_BASE();