KiCad PCB EDA Suite
Loading...
Searching...
No Matches
job_export_pcb_3d.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) 2023 Mark Roszko <[email protected]>
5 * Copyright (C) 2023-2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
22#include <jobs/job_registry.h>
23#include <i18n_utility.h>
24
26 {
33 } )
34
35
37 {
42 } )
43
45{
46 switch( m_Format )
47 {
48 case EXPORTER_STEP_PARAMS::FORMAT::STEP: return wxS( "step" );
49 case EXPORTER_STEP_PARAMS::FORMAT::BREP: return wxS( "brep" );
50 case EXPORTER_STEP_PARAMS::FORMAT::XAO: return wxS( "xao" );
51 case EXPORTER_STEP_PARAMS::FORMAT::GLB: return wxS( "glb" );
52 default: return wxEmptyString; // shouldn't happen
53 }
54}
55
56
58{
59 switch( m_Format )
60 {
61 // honestly these names shouldn't be translated since they are mostly industry standard acronyms
62 case EXPORTER_STEP_PARAMS::FORMAT::STEP: return wxS( "STEP" );
63 case EXPORTER_STEP_PARAMS::FORMAT::BREP: return wxS( "BREP" );
64 case EXPORTER_STEP_PARAMS::FORMAT::XAO: return wxS( "XAO" );
65 case EXPORTER_STEP_PARAMS::FORMAT::GLB: return wxS( "Binary GLTF" );
66 default: return wxEmptyString; // shouldn't happen
67 }
68}
69
70
72 JOB( "3d", false, aIsCli ),
73 m_hasUserOrigin( false ),
74 m_filename(),
75 m_format( JOB_EXPORT_PCB_3D::FORMAT::UNKNOWN ),
76 m_vrmlUnits( JOB_EXPORT_PCB_3D::VRML_UNITS::METERS ),
77 m_vrmlModelDir( wxEmptyString ),
78 m_vrmlRelativePaths( false )
79{
80 m_params.emplace_back(
82 m_params.emplace_back( new JOB_PARAM<bool>( "use_grid_origin", &m_3dparams.m_UseGridOrigin,
84 m_params.emplace_back( new JOB_PARAM<bool>( "use_drill_origin", &m_3dparams.m_UseDrillOrigin,
86 m_params.emplace_back(
88 m_params.emplace_back( new JOB_PARAM<bool>( "include_unspecified",
91 m_params.emplace_back( new JOB_PARAM<bool>( "include_dnp", &m_3dparams.m_IncludeDNP,
93 m_params.emplace_back( new JOB_PARAM<bool>( "subst_models", &m_3dparams.m_SubstModels,
95 m_params.emplace_back( new JOB_PARAM<bool>( "optimize_step", &m_3dparams.m_OptimizeStep,
97 m_params.emplace_back( new JOB_PARAM<double>( "user_origin.x", &m_3dparams.m_Origin.x,
99 m_params.emplace_back( new JOB_PARAM<double>( "user_origin.y", &m_3dparams.m_Origin.y,
101 m_params.emplace_back( new JOB_PARAM<double>( "board_outlines_chaining_epsilon",
104 m_params.emplace_back( new JOB_PARAM<bool>( "export_board_body", &m_3dparams.m_ExportBoardBody,
106 m_params.emplace_back( new JOB_PARAM<bool>( "export_components", &m_3dparams.m_ExportComponents,
108 m_params.emplace_back( new JOB_PARAM<bool>( "export_tracks", &m_3dparams.m_ExportTracksVias,
110 m_params.emplace_back( new JOB_PARAM<bool>( "export_pads", &m_3dparams.m_ExportPads,
112 m_params.emplace_back( new JOB_PARAM<bool>( "export_zones", &m_3dparams.m_ExportZones,
114 m_params.emplace_back( new JOB_PARAM<bool>( "export_inner_copper",
117 m_params.emplace_back( new JOB_PARAM<bool>( "export_silkscreen", &m_3dparams.m_ExportSilkscreen,
119 m_params.emplace_back( new JOB_PARAM<bool>( "export_soldermask", &m_3dparams.m_ExportSoldermask,
121 m_params.emplace_back( new JOB_PARAM<bool>( "fuse_shapes", &m_3dparams.m_FuseShapes,
123 m_params.emplace_back( new JOB_PARAM<wxString>( "vrml_model_dir", &m_vrmlModelDir, m_vrmlModelDir ) );
124 m_params.emplace_back( new JOB_PARAM<bool>( "vrml_relative_paths", &m_vrmlRelativePaths,
126}
127
128
130{
131 return wxString::Format( _( "3D model export" ) );
132}
133
134REGISTER_JOB( pcb_export_3d, _HKI( "PCB: Export 3D Model" ), KIWAY::FACE_PCB, JOB_EXPORT_PCB_3D );
wxString GetFormatName() const
wxString GetDefaultExportExtension() const
wxString GetDescription() override
JOB_EXPORT_PCB_3D(bool aIsCli)
EXPORTER_STEP_PARAMS m_3dparams
Despite the name; also used for other formats.
Definition: job.h:45
An simple container class that lets us dispatch output jobs to kifaces.
Definition: job.h:79
std::vector< JOB_PARAM_BASE * > m_params
Definition: job.h:136
@ FACE_PCB
pcbnew DSO
Definition: kiway.h:292
#define _HKI(x)
#define _(s)
Some functions to handle hotkeys in KiCad.
NLOHMANN_JSON_SERIALIZE_ENUM(JOB_EXPORT_PCB_3D::FORMAT, { { JOB_EXPORT_PCB_3D::FORMAT::UNKNOWN, nullptr }, { JOB_EXPORT_PCB_3D::FORMAT::STEP, "step" }, { JOB_EXPORT_PCB_3D::FORMAT::BREP, "brep" }, { JOB_EXPORT_PCB_3D::FORMAT::GLB, "step" }, { JOB_EXPORT_PCB_3D::FORMAT::VRML, "vrml" }, { JOB_EXPORT_PCB_3D::FORMAT::XAO, "xao" }, }) NLOHMANN_JSON_SERIALIZE_ENUM(JOB_EXPORT_PCB_3D
#define REGISTER_JOB(job_name, title, face, T)
Definition: job_registry.h:64