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 The 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 {
35 } )
36
38 {
43 } )
44
46{
47 switch( m_Format )
48 {
49 case EXPORTER_STEP_PARAMS::FORMAT::STEP: return wxS( "step" );
50 case EXPORTER_STEP_PARAMS::FORMAT::BREP: return wxS( "brep" );
51 case EXPORTER_STEP_PARAMS::FORMAT::XAO: return wxS( "xao" );
52 case EXPORTER_STEP_PARAMS::FORMAT::GLB: return wxS( "glb" );
53 case EXPORTER_STEP_PARAMS::FORMAT::PLY: return wxS( "ply" );
54 case EXPORTER_STEP_PARAMS::FORMAT::STL: return wxS( "stl" );
55 default: return wxEmptyString; // shouldn't happen
56 }
57}
58
59
61{
62 switch( m_Format )
63 {
64 // honestly these names shouldn't be translated since they are mostly industry standard acronyms
65 case EXPORTER_STEP_PARAMS::FORMAT::STEP: return wxS( "STEP" );
66 case EXPORTER_STEP_PARAMS::FORMAT::BREP: return wxS( "BREP" );
67 case EXPORTER_STEP_PARAMS::FORMAT::XAO: return wxS( "XAO" );
68 case EXPORTER_STEP_PARAMS::FORMAT::GLB: return wxS( "Binary GLTF" );
69 case EXPORTER_STEP_PARAMS::FORMAT::PLY: return wxS( "PLY" );
70 case EXPORTER_STEP_PARAMS::FORMAT::STL: return wxS( "STL" );
71 default: return wxEmptyString; // shouldn't happen
72 }
73}
74
75
77 JOB( "3d", false ),
78 m_hasUserOrigin( false ),
79 m_filename(),
80 m_format( JOB_EXPORT_PCB_3D::FORMAT::UNKNOWN ),
81 m_vrmlUnits( JOB_EXPORT_PCB_3D::VRML_UNITS::METERS ),
82 m_vrmlModelDir( wxEmptyString ),
83 m_vrmlRelativePaths( false )
84{
85 m_params.emplace_back(
87 m_params.emplace_back( new JOB_PARAM<bool>( "use_grid_origin", &m_3dparams.m_UseGridOrigin,
89 m_params.emplace_back( new JOB_PARAM<bool>( "use_drill_origin", &m_3dparams.m_UseDrillOrigin,
91 m_params.emplace_back(
93 m_params.emplace_back( new JOB_PARAM<bool>( "include_unspecified",
96 m_params.emplace_back( new JOB_PARAM<bool>( "include_dnp", &m_3dparams.m_IncludeDNP,
98 m_params.emplace_back( new JOB_PARAM<bool>( "subst_models", &m_3dparams.m_SubstModels,
100 m_params.emplace_back( new JOB_PARAM<bool>( "optimize_step", &m_3dparams.m_OptimizeStep,
102 m_params.emplace_back( new JOB_PARAM<double>( "user_origin.x", &m_3dparams.m_Origin.x,
104 m_params.emplace_back( new JOB_PARAM<double>( "user_origin.y", &m_3dparams.m_Origin.y,
106 m_params.emplace_back( new JOB_PARAM<double>( "board_outlines_chaining_epsilon",
109 m_params.emplace_back( new JOB_PARAM<bool>( "cut_vias_in_body", &m_3dparams.m_CutViasInBody,
111 m_params.emplace_back( new JOB_PARAM<bool>( "export_board_body", &m_3dparams.m_ExportBoardBody,
113 m_params.emplace_back( new JOB_PARAM<bool>( "export_components", &m_3dparams.m_ExportComponents,
115 m_params.emplace_back( new JOB_PARAM<bool>( "export_tracks", &m_3dparams.m_ExportTracksVias,
117 m_params.emplace_back( new JOB_PARAM<bool>( "export_pads", &m_3dparams.m_ExportPads,
119 m_params.emplace_back( new JOB_PARAM<bool>( "export_zones", &m_3dparams.m_ExportZones,
121 m_params.emplace_back( new JOB_PARAM<bool>( "export_inner_copper",
124 m_params.emplace_back( new JOB_PARAM<bool>( "export_silkscreen", &m_3dparams.m_ExportSilkscreen,
126 m_params.emplace_back( new JOB_PARAM<bool>( "export_soldermask", &m_3dparams.m_ExportSoldermask,
128 m_params.emplace_back( new JOB_PARAM<bool>( "fuse_shapes", &m_3dparams.m_FuseShapes,
130 m_params.emplace_back( new JOB_PARAM<bool>( "fill_all_vias", &m_3dparams.m_FillAllVias,
132 m_params.emplace_back( new JOB_PARAM<wxString>( "vrml_model_dir", &m_vrmlModelDir, m_vrmlModelDir ) );
133 m_params.emplace_back( new JOB_PARAM<bool>( "vrml_relative_paths", &m_vrmlRelativePaths,
135 m_params.emplace_back(
138 "occt_format", &m_3dparams.m_Format, m_3dparams.m_Format ) );
139}
140
141
143{
144 return _( "3D model export" );
145}
146
147
149{
150 return _( "Export 3D Model Job Settings" );
151}
152
153
155{
156 m_3dparams.m_Format = aFormat;
157 switch( m_3dparams.m_Format )
158 {
165 }
166}
167
168REGISTER_JOB( pcb_export_3d, _HKI( "PCB: Export 3D Model" ), KIWAY::FACE_PCB, JOB_EXPORT_PCB_3D );
wxString GetFormatName() const
wxString GetDefaultExportExtension() const
JOB_EXPORT_PCB_3D::FORMAT m_format
wxString GetSettingsDialogTitle() const override
void SetStepFormat(EXPORTER_STEP_PARAMS::FORMAT aFormat)
wxString GetDefaultDescription() const override
EXPORTER_STEP_PARAMS m_3dparams
Despite the name; also used for other formats.
Definition: job.h:50
An simple container class that lets us dispatch output jobs to kifaces.
Definition: job.h:182
std::vector< JOB_PARAM_BASE * > m_params
Definition: job.h:232
@ FACE_PCB
pcbnew DSO
Definition: kiway.h:293
#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" }, { JOB_EXPORT_PCB_3D::FORMAT::PLY, "ply" }, { JOB_EXPORT_PCB_3D::FORMAT::STL, "stl" }, }) NLOHMANN_JSON_SERIALIZE_ENUM(JOB_EXPORT_PCB_3D
#define REGISTER_JOB(job_name, title, face, T)
Definition: job_registry.h:64