From d98d7f90173420cb340bf201e927a8674a2a81bc Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Wed, 17 Apr 2024 17:31:07 +0300 Subject: [PATCH] ADDED: Support 3D shape export in BREP format. BREP doesn't support colors or label names, but is much faster to write/read compared to STEP. --- common/jobs/job_export_pcb_3d.h | 1 + common/wildcards_and_files_ext.cpp | 1 + include/wildcards_and_files_ext.h | 1 + kicad/cli/command_pcb_export_3d.cpp | 14 +- kicad/kicad_cli.cpp | 2 + pcbnew/dialogs/dialog_export_step.cpp | 2 + pcbnew/dialogs/dialog_export_step_base.cpp | 2 +- pcbnew/dialogs/dialog_export_step_base.fbp | 4034 ++++++++++---------- pcbnew/dialogs/dialog_export_step_base.h | 4 +- pcbnew/exporters/step/exporter_step.cpp | 6 +- pcbnew/exporters/step/exporter_step.h | 1 + pcbnew/exporters/step/step_pcb_model.cpp | 41 + pcbnew/exporters/step/step_pcb_model.h | 3 + pcbnew/pcbnew_jobs_handler.cpp | 5 + 14 files changed, 2107 insertions(+), 2010 deletions(-) diff --git a/common/jobs/job_export_pcb_3d.h b/common/jobs/job_export_pcb_3d.h index f2cdf5cbab..7b5e4a3b9c 100644 --- a/common/jobs/job_export_pcb_3d.h +++ b/common/jobs/job_export_pcb_3d.h @@ -34,6 +34,7 @@ public: { UNKNOWN, // defefer to arg STEP, + BREP, GLB, VRML }; diff --git a/common/wildcards_and_files_ext.cpp b/common/wildcards_and_files_ext.cpp index 2946263abe..fcae910376 100644 --- a/common/wildcards_and_files_ext.cpp +++ b/common/wildcards_and_files_ext.cpp @@ -196,6 +196,7 @@ const std::string FILEEXT::JsonFileExtension( "json" ); const std::string FILEEXT::StepFileExtension( "step" ); const std::string FILEEXT::StepFileAbrvExtension( "stp" ); const std::string FILEEXT::GltfBinaryFileExtension( "glb" ); +const std::string FILEEXT::BrepFileExtension( "brep" ); const wxString FILEEXT::GerberFileExtensionsRegex( "(gbr|gko|pho|(g[tb][alops])|(gm?\\d\\d*)|(gp[tb]))" ); diff --git a/include/wildcards_and_files_ext.h b/include/wildcards_and_files_ext.h index 43c4da0829..6a474f76b2 100644 --- a/include/wildcards_and_files_ext.h +++ b/include/wildcards_and_files_ext.h @@ -186,6 +186,7 @@ public: static const std::string StepFileExtension; static const std::string StepFileAbrvExtension; static const std::string GltfBinaryFileExtension; + static const std::string BrepFileExtension; static const wxString GerberFileExtensionsRegex; diff --git a/kicad/cli/command_pcb_export_3d.cpp b/kicad/cli/command_pcb_export_3d.cpp index f509c54f65..f822376011 100644 --- a/kicad/cli/command_pcb_export_3d.cpp +++ b/kicad/cli/command_pcb_export_3d.cpp @@ -63,7 +63,8 @@ CLI::PCB_EXPORT_3D_COMMAND::PCB_EXPORT_3D_COMMAND( const std::string& aNa { m_argParser.add_argument( ARG_FORMAT ) .default_value( std::string( "step" ) ) - .help( UTF8STDSTR( _( "Output file format, options: step, glb (binary glTF)" ) ) ); + .help( UTF8STDSTR( + _( "Output file format, options: step, brep, glb (binary glTF)" ) ) ); } m_argParser.add_argument( ARG_FORCE, "-f" ) @@ -81,7 +82,8 @@ CLI::PCB_EXPORT_3D_COMMAND::PCB_EXPORT_3D_COMMAND( const std::string& aNa _( "Exclude 3D models for components with 'Do not populate' attribute" ) ) ) .flag(); - if( m_format == JOB_EXPORT_PCB_3D::FORMAT::STEP || m_format == JOB_EXPORT_PCB_3D::FORMAT::GLB ) + if( m_format == JOB_EXPORT_PCB_3D::FORMAT::STEP || m_format == JOB_EXPORT_PCB_3D::FORMAT::BREP + || m_format == JOB_EXPORT_PCB_3D::FORMAT::GLB ) { m_argParser.add_argument( ARG_GRID_ORIGIN ) .help( UTF8STDSTR( _( "Use Grid Origin for output origin" ) ) ) @@ -153,7 +155,8 @@ int CLI::PCB_EXPORT_3D_COMMAND::doPerform( KIWAY& aKiway ) { std::unique_ptr step( new JOB_EXPORT_PCB_3D( true ) ); - if( m_format == JOB_EXPORT_PCB_3D::FORMAT::STEP || m_format == JOB_EXPORT_PCB_3D::FORMAT::GLB ) + if( m_format == JOB_EXPORT_PCB_3D::FORMAT::STEP || m_format == JOB_EXPORT_PCB_3D::FORMAT::BREP + || m_format == JOB_EXPORT_PCB_3D::FORMAT::GLB ) { step->m_useDrillOrigin = m_argParser.get( ARG_DRILL_ORIGIN ); step->m_useGridOrigin = m_argParser.get( ARG_GRID_ORIGIN ); @@ -182,6 +185,8 @@ int CLI::PCB_EXPORT_3D_COMMAND::doPerform( KIWAY& aKiway ) if( format == wxS( "step" ) ) step->m_format = JOB_EXPORT_PCB_3D::FORMAT::STEP; + else if( format == wxS( "brep" ) ) + step->m_format = JOB_EXPORT_PCB_3D::FORMAT::BREP; else if( format == wxS( "glb" ) ) step->m_format = JOB_EXPORT_PCB_3D::FORMAT::GLB; else @@ -260,7 +265,8 @@ int CLI::PCB_EXPORT_3D_COMMAND::doPerform( KIWAY& aKiway ) step->m_hasUserOrigin = true; } - if( m_format == JOB_EXPORT_PCB_3D::FORMAT::STEP || m_format == JOB_EXPORT_PCB_3D::FORMAT::GLB ) + if( m_format == JOB_EXPORT_PCB_3D::FORMAT::STEP || m_format == JOB_EXPORT_PCB_3D::FORMAT::BREP + || m_format == JOB_EXPORT_PCB_3D::FORMAT::GLB ) { wxString minDistance = From_UTF8( m_argParser.get( ARG_MIN_DISTANCE ).c_str() ); diff --git a/kicad/kicad_cli.cpp b/kicad/kicad_cli.cpp index 4332863e21..d3b5895184 100644 --- a/kicad/kicad_cli.cpp +++ b/kicad/kicad_cli.cpp @@ -112,6 +112,7 @@ static CLI::PCB_EXPORT_DRILL_COMMAND exportPcbDrillCmd{}; static CLI::PCB_EXPORT_DXF_COMMAND exportPcbDxfCmd{}; static CLI::PCB_EXPORT_3D_COMMAND exportPcbGlbCmd{ "glb", UTF8STDSTR( _( "Export GLB (binary GLTF)" ) ), JOB_EXPORT_PCB_3D::FORMAT::GLB }; static CLI::PCB_EXPORT_3D_COMMAND exportPcbStepCmd{ "step", UTF8STDSTR( _( "Export STEP" ) ), JOB_EXPORT_PCB_3D::FORMAT::STEP }; +static CLI::PCB_EXPORT_3D_COMMAND exportPcbBrepCmd{ "brep", UTF8STDSTR( _( "Export BREP" ) ), JOB_EXPORT_PCB_3D::FORMAT::BREP }; static CLI::PCB_EXPORT_3D_COMMAND exportPcbVrmlCmd{ "vrml", UTF8STDSTR( _( "Export VRML" ) ), JOB_EXPORT_PCB_3D::FORMAT::VRML }; static CLI::PCB_EXPORT_SVG_COMMAND exportPcbSvgCmd{}; static CLI::PCB_EXPORT_PDF_COMMAND exportPcbPdfCmd{}; @@ -169,6 +170,7 @@ static std::vector commandStack = { { &exportPcbCmd, { + &exportPcbBrepCmd, &exportPcbDrillCmd, &exportPcbDxfCmd, &exportPcbGerberCmd, diff --git a/pcbnew/dialogs/dialog_export_step.cpp b/pcbnew/dialogs/dialog_export_step.cpp index 7a6e664a6b..e432de0e68 100644 --- a/pcbnew/dialogs/dialog_export_step.cpp +++ b/pcbnew/dialogs/dialog_export_step.cpp @@ -444,6 +444,8 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent ) if( fn.GetExt() == FILEEXT::GltfBinaryFileExtension ) cmdK2S.Append( wxT( " glb" ) ); + else if( fn.GetExt() == FILEEXT::BrepFileExtension ) + cmdK2S.Append( wxT( " brep" ) ); else cmdK2S.Append( wxT( " step" ) ); diff --git a/pcbnew/dialogs/dialog_export_step_base.cpp b/pcbnew/dialogs/dialog_export_step_base.cpp index b4ca0422b5..6422db236b 100644 --- a/pcbnew/dialogs/dialog_export_step_base.cpp +++ b/pcbnew/dialogs/dialog_export_step_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! diff --git a/pcbnew/dialogs/dialog_export_step_base.fbp b/pcbnew/dialogs/dialog_export_step_base.fbp index 61ea42d241..9c79154389 100644 --- a/pcbnew/dialogs/dialog_export_step_base.fbp +++ b/pcbnew/dialogs/dialog_export_step_base.fbp @@ -1,2021 +1,2051 @@ - + - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_export_step_base - 1000 - none - - - 1 - dialog_export_step_base - - . - - 1 - 1 - 1 - 1 - UI - 0 - 1 - 0 - - 0 - wxAUI_MGR_DEFAULT - - wxBOTH - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_export_step_base + 1000 + none + + + 1 + dialog_export_step_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 1 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_EXPORT_STEP_BASE + + -1,-1 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Export STEP / BREP / GLTF + + 0 + + + + + -1,-1 + bSizerSTEPFile + wxVERTICAL + protected + + 10 + wxEXPAND|wxALL + 0 + - DIALOG_EXPORT_STEP_BASE - - -1,-1 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h - Export STEP / GLTF - - 0 - - - - + bSizerTop + wxHORIZONTAL + protected + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + File: + 0 + + 0 + + + 0 + + 1 + m_txtBrdFile + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + 450,-1 + 1 + m_outputFileName + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Enter a filename if you do not want to use default file names Can be used only when printing the current sheet + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + MyButton + + 0 + + 0 + + + 0 -1,-1 - bSizerSTEPFile - wxVERTICAL + 1 + m_browseButton + 1 + + protected - - 10 - wxEXPAND|wxALL - 0 - + 1 + + + + Resizable + 1 + -1,-1 + + STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onBrowseClicked + + + + + + 5 + wxBOTTOM|wxEXPAND|wxTOP + 1 + + + bSizer2 + wxHORIZONTAL + none + + 10 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + wxID_ANY + Coordinates + + sbCoordinates + wxVERTICAL + 1 + none + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Drill/place file origin + + 0 + + + 0 + + 1 + m_rbDrillAndPlotOrigin + 1 + + + protected + 1 + + Resizable + 1 + + wxRB_GROUP + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Grid origin + + 0 + + + 0 + + 1 + m_rbGridOrigin + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + User defined origin + + 0 + + + 0 + + 1 + m_rbUserDefinedOrigin + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Board center origin + + 0 + + + 0 + + 1 + m_rbBoardCenterOrigin + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + + + 10 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + wxID_ANY + User Defined Origin + + sbUserDefinedOrigin + wxVERTICAL + 1 + none + + 5 + wxEXPAND + 1 + + 2 + wxBOTH + + + 0 + + fgSizer1 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 5 + + 5 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Units: + 0 + + 0 + + + 0 - bSizerTop - wxHORIZONTAL + 1 + m_staticTextUnits + 1 + + protected - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - File: - 0 - - 0 - - - 0 - - 1 - m_txtBrdFile - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - 450,-1 - 1 - m_outputFileName - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Enter a filename if you do not want to use default file names Can be used only when printing the current sheet - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - MyButton - - 0 - - 0 - - - 0 - -1,-1 - 1 - m_browseButton - 1 - - - protected - 1 - - - - Resizable - 1 - -1,-1 - - STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - onBrowseClicked - - + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + - - - 5 - wxBOTTOM|wxEXPAND|wxTOP - 1 - + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "mm" "inch" + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 - bSizer2 - wxHORIZONTAL - none - - 10 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - wxID_ANY - Coordinates - - sbCoordinates - wxVERTICAL - 1 - none - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Drill/place file origin - - 0 - - - 0 - - 1 - m_rbDrillAndPlotOrigin - 1 - - - protected - 1 - - Resizable - 1 - - wxRB_GROUP - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Grid origin - - 0 - - - 0 - - 1 - m_rbGridOrigin - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - User defined origin - - 0 - - - 0 - - 1 - m_rbUserDefinedOrigin - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Board center origin - - 0 - - - 0 - - 1 - m_rbBoardCenterOrigin - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - 10 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - wxID_ANY - User Defined Origin - - sbUserDefinedOrigin - wxVERTICAL - 1 - none - - 5 - wxEXPAND - 1 - - 2 - wxBOTH - - - 0 - - fgSizer1 - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 5 - - 5 - wxALIGN_CENTER_VERTICAL|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Units: - 0 - - 0 - - - 0 - - 1 - m_staticTextUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "mm" "inch" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_STEP_OrgUnitChoice - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - onUpdateUnits - - - - 5 - wxALIGN_CENTER_VERTICAL|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - X position: - 0 - - 0 - - - 0 - - 1 - m_staticTextXpos - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 8 - - 0 - - 1 - m_STEP_Xorg - 1 - - - protected - 1 - - Resizable - 1 - - - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h - 0 - - - wxFILTER_NUMERIC - wxTextValidator - - 0 - - - - onUpdateXPos - - - - 5 - wxALIGN_CENTER_VERTICAL|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Y position: - 0 - - 0 - - - 0 - - 1 - m_staticTextYpos - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 8 - - 0 - - 1 - m_STEP_Yorg - 1 - - - protected - 1 - - Resizable - 1 - - - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h - 0 - - - wxFILTER_NUMERIC - wxTextValidator - - 0 - - - - onUpdateYPos - - - - - - - - 10 - wxEXPAND|wxRIGHT|wxLEFT - 1 - - wxID_ANY - Other Options - - sbOtherOptions - wxVERTICAL - 1 - none - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Ignore 'Do not populate' components - - 0 - - - 0 - - 1 - m_cbRemoveDNP - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Do not show components marked 'Do not populate' - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Ignore 'Unspecified' components - - 0 - - - 0 - - 1 - m_cbRemoveUnspecified - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Do not show components with Footprint Type 'Unspecified' - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Substitute similarly named models - - 0 - - - 0 - - 1 - m_cbSubstModels - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Replace VRML models with STEP models of the same name - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Overwrite old file - - 0 - - - 0 - - 1 - m_cbOverwriteFile - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxEXPAND|wxTOP|wxBOTTOM - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 1 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline11_hidden - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - ; ; forward_declare - 0 - - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Optimize STEP file - - 0 - - - 0 - - 1 - m_cbOptimizeStep - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Disables writing parametric curves. Optimizes file size and write/read times, but may reduce compatibility with other software. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 1 - wxID_ANY - Fuse shapes (time consuming) - - 0 - - - 0 - - 1 - m_cbFuseShapes_hidden - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Combine intersecting geometry into one shape. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 1 - wxID_ANY - Export as Compound shape - - 0 - - - 0 - - 1 - m_cbExportCompound_hidden - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Merges all shapes into a single Compound shape. Useful for external software that does de-duplication based on shape names. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxEXPAND|wxTOP|wxBOTTOM - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline1 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - ; ; forward_declare - 0 - - - - - - - - 5 - wxTOP|wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Export tracks, pads and vias - - 0 - - - 0 - - 1 - m_cbExportTracks - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - Export tracks, pads and vias on external copper layers. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Export zones - - 0 - - - 0 - - 1 - m_cbExportZones - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - Export zones on external copper layers. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 1 - wxID_ANY - Export silkscreen - - 0 - - - 0 - - 1 - m_cbExportSilkscreen_hidden - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - Export silkscreen graphics. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 1 - wxID_ANY - Export solder mask - - 0 - - - 0 - - 1 - m_cbExportSoldermask_hidden - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - Export solder mask graphics. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 1 - wxID_ANY - Export solder paste - - 0 - - - 0 - - 1 - m_cbExportSolderpaste_hidden - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - Export solder paste graphics. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Board outline chaining tolerance: - 0 - - 0 - - - 0 - - 1 - m_staticTextTolerance - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Tight (0.001 mm)" "Standard (0.01 mm)" "Loose (0.1 mm)" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_choiceTolerance - 1 - - - protected - 1 - - Resizable - 1 - 1 - - - ; ; forward_declare - 0 - Tolerance sets the distance between two points that are considered joined when building the board outlines. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - + 1 + m_STEP_OrgUnitChoice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onUpdateUnits + - - - 10 - wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 0 - + + 5 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + X position: + 0 + + 0 + + + 0 - bSizer81 - wxHORIZONTAL - none + 1 + m_staticTextXpos + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + - - - 5 - wxBOTTOM|wxEXPAND|wxRIGHT|wxTOP - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 8 + + 0 + + 1 + m_STEP_Xorg + 1 + + + protected + 1 + + Resizable + 1 + + + TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h + 0 + + + wxFILTER_NUMERIC + wxTextValidator + + 0 + + + + onUpdateXPos + + + + 5 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Y position: + 0 + + 0 + + + 0 + + 1 + m_staticTextYpos + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 8 + + 0 - m_sdbSizer + 1 + m_STEP_Yorg + 1 + + protected - onExportButton + 1 + + Resizable + 1 + + + TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h + 0 + + + wxFILTER_NUMERIC + wxTextValidator + + 0 + + + + onUpdateYPos + + + + + + + 10 + wxEXPAND|wxRIGHT|wxLEFT + 1 + + wxID_ANY + Other Options + + sbOtherOptions + wxVERTICAL + 1 + none + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Ignore 'Do not populate' components + + 0 + + + 0 + + 1 + m_cbRemoveDNP + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Do not show components marked 'Do not populate' + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Ignore 'Unspecified' components + + 0 + + + 0 + + 1 + m_cbRemoveUnspecified + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Do not show components with Footprint Type 'Unspecified' + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Substitute similarly named models + + 0 + + + 0 + + 1 + m_cbSubstModels + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Replace VRML models with STEP models of the same name + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Overwrite old file + + 0 + + + 0 + + 1 + m_cbOverwriteFile + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 1 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline11_hidden + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Optimize STEP file + + 0 + + + 0 + + 1 + m_cbOptimizeStep + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Disables writing parametric curves. Optimizes file size and write/read times, but may reduce compatibility with other software. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 1 + wxID_ANY + Fuse shapes (time consuming) + + 0 + + + 0 + + 1 + m_cbFuseShapes_hidden + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Combine intersecting geometry into one shape. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 1 + wxID_ANY + Export as Compound shape + + 0 + + + 0 + + 1 + m_cbExportCompound_hidden + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Merges all shapes into a single Compound shape. Useful for external software that does de-duplication based on shape names. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 5 + wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Export tracks, pads and vias + + 0 + + + 0 + + 1 + m_cbExportTracks + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + Export tracks, pads and vias on external copper layers. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Export zones + + 0 + + + 0 + + 1 + m_cbExportZones + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + Export zones on external copper layers. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 1 + wxID_ANY + Export silkscreen + + 0 + + + 0 + + 1 + m_cbExportSilkscreen_hidden + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + Export silkscreen graphics. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 1 + wxID_ANY + Export solder mask + + 0 + + + 0 + + 1 + m_cbExportSoldermask_hidden + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + Export solder mask graphics. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 1 + wxID_ANY + Export solder paste + + 0 + + + 0 + + 1 + m_cbExportSolderpaste_hidden + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + Export solder paste graphics. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Board outline chaining tolerance: + 0 + + 0 + + + 0 + + 1 + m_staticTextTolerance + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Tight (0.001 mm)" "Standard (0.01 mm)" "Loose (0.1 mm)" + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceTolerance + 1 + + + protected + 1 + + Resizable + 1 + 1 + + + ; ; forward_declare + 0 + Tolerance sets the distance between two points that are considered joined when building the board outlines. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + 10 + wxEXPAND|wxLEFT|wxRIGHT|wxTOP + 0 + + + bSizer81 + wxHORIZONTAL + none + + + + 5 + wxBOTTOM|wxEXPAND|wxRIGHT|wxTOP + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + onExportButton + + + diff --git a/pcbnew/dialogs/dialog_export_step_base.h b/pcbnew/dialogs/dialog_export_step_base.h index f0d1bbeeac..93821febcd 100644 --- a/pcbnew/dialogs/dialog_export_step_base.h +++ b/pcbnew/dialogs/dialog_export_step_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) +// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -90,7 +90,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 / GLTF"), 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 / BREP / GLTF"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_EXPORT_STEP_BASE(); diff --git a/pcbnew/exporters/step/exporter_step.cpp b/pcbnew/exporters/step/exporter_step.cpp index d9b0ada7bf..820e0766d3 100644 --- a/pcbnew/exporters/step/exporter_step.cpp +++ b/pcbnew/exporters/step/exporter_step.cpp @@ -118,6 +118,7 @@ wxString EXPORTER_STEP_PARAMS::GetDefaultExportExtension() switch( m_format ) { case EXPORTER_STEP_PARAMS::FORMAT::STEP: return wxS( "step" ); + case EXPORTER_STEP_PARAMS::FORMAT::BREP: return wxS( "brep" ); case EXPORTER_STEP_PARAMS::FORMAT::GLB: return wxS( "glb" ); default: return wxEmptyString; // shouldn't happen } @@ -129,7 +130,8 @@ wxString EXPORTER_STEP_PARAMS::GetFormatName() { // honestly these names shouldn't be translated since they are mostly industry standard acronyms case EXPORTER_STEP_PARAMS::FORMAT::STEP: return wxS( "STEP" ); - case EXPORTER_STEP_PARAMS::FORMAT::GLB: return wxS("Binary GLTF" ); + case EXPORTER_STEP_PARAMS::FORMAT::BREP: return wxS( "BREP" ); + case EXPORTER_STEP_PARAMS::FORMAT::GLB: return wxS( "Binary GLTF" ); default: return wxEmptyString; // shouldn't happen } } @@ -529,6 +531,8 @@ bool EXPORTER_STEP::Export() bool success = true; if( m_params.m_format == EXPORTER_STEP_PARAMS::FORMAT::STEP ) success = m_pcbModel->WriteSTEP( m_outputFile, m_params.m_optimizeStep ); + else if( m_params.m_format == EXPORTER_STEP_PARAMS::FORMAT::BREP ) + success = m_pcbModel->WriteBREP( m_outputFile ); else if( m_params.m_format == EXPORTER_STEP_PARAMS::FORMAT::GLB ) success = m_pcbModel->WriteGLTF( m_outputFile ); diff --git a/pcbnew/exporters/step/exporter_step.h b/pcbnew/exporters/step/exporter_step.h index 202bfc0cc7..29e41ed7c7 100644 --- a/pcbnew/exporters/step/exporter_step.h +++ b/pcbnew/exporters/step/exporter_step.h @@ -63,6 +63,7 @@ public: enum class FORMAT { STEP, + BREP, GLB }; diff --git a/pcbnew/exporters/step/step_pcb_model.cpp b/pcbnew/exporters/step/step_pcb_model.cpp index 15809a3645..1011b57063 100644 --- a/pcbnew/exporters/step/step_pcb_model.cpp +++ b/pcbnew/exporters/step/step_pcb_model.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -77,6 +78,7 @@ #include #include #include +#include #include #include @@ -1230,6 +1232,45 @@ bool STEP_PCB_MODEL::WriteSTEP( const wxString& aFileName, bool aOptimize ) } +bool STEP_PCB_MODEL::WriteBREP( const wxString& aFileName ) +{ + if( !isBoardOutlineValid() ) + { + ReportMessage( wxString::Format( wxT( "No valid PCB assembly; cannot create output file " + "'%s'.\n" ), + aFileName ) ); + return false; + } + + wxFileName fn( aFileName ); + + // s_assy = shape tool for the source + Handle( XCAFDoc_ShapeTool ) s_assy = XCAFDoc_DocumentTool::ShapeTool( m_doc->Main() ); + + // retrieve all free shapes within the assembly + TDF_LabelSequence freeShapes; + s_assy->GetFreeShapes( freeShapes ); + + for( Standard_Integer i = 1; i <= freeShapes.Length(); ++i ) + { + TDF_Label label = freeShapes.Value( i ); + TopoDS_Shape shape; + m_assy->GetShape( label, shape ); + + wxFileName fn( aFileName ); + + if( freeShapes.Length() > 1 ) + fn.SetName( wxString::Format( "%s_%s", fn.GetName(), i ) ); + + wxFFileOutputStream ffStream( fn.GetFullPath() ); + wxStdOutputStream stdStream( ffStream ); + BRepTools::Write( shape, stdStream, false, false, TopTools_FormatVersion_VERSION_1 ); + } + + return true; +} + + bool STEP_PCB_MODEL::getModelLabel( const std::string& aFileNameUTF8, VECTOR3D aScale, TDF_Label& aLabel, bool aSubstituteModels, wxString* aErrorMessage ) { diff --git a/pcbnew/exporters/step/step_pcb_model.h b/pcbnew/exporters/step/step_pcb_model.h index eb6c03938d..37a7dbfa76 100644 --- a/pcbnew/exporters/step/step_pcb_model.h +++ b/pcbnew/exporters/step/step_pcb_model.h @@ -168,6 +168,9 @@ public: // write the assembly model in STEP format bool WriteSTEP( const wxString& aFileName, bool aOptimize ); + // write the assembly in BREP format + bool WriteBREP( const wxString& aFileName ); + /** * Write the assembly in binary GLTF Format * diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp index 609677bb54..b5bede2f33 100644 --- a/pcbnew/pcbnew_jobs_handler.cpp +++ b/pcbnew/pcbnew_jobs_handler.cpp @@ -133,6 +133,8 @@ int PCBNEW_JOBS_HANDLER::JobExportStep( JOB* aJob ) break; case JOB_EXPORT_PCB_3D::FORMAT::STEP: fn.SetExt( FILEEXT::StepFileExtension ); break; + case JOB_EXPORT_PCB_3D::FORMAT::BREP: fn.SetExt( FILEEXT::BrepFileExtension ); + break; case JOB_EXPORT_PCB_3D::FORMAT::GLB: fn.SetExt( FILEEXT::GltfBinaryFileExtension ); break; default: @@ -206,6 +208,9 @@ int PCBNEW_JOBS_HANDLER::JobExportStep( JOB* aJob ) case JOB_EXPORT_PCB_3D::FORMAT::STEP: params.m_format = EXPORTER_STEP_PARAMS::FORMAT::STEP; break; + case JOB_EXPORT_PCB_3D::FORMAT::BREP: + params.m_format = EXPORTER_STEP_PARAMS::FORMAT::BREP; + break; case JOB_EXPORT_PCB_3D::FORMAT::GLB: params.m_format = EXPORTER_STEP_PARAMS::FORMAT::GLB; break;