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 {
35 } )
36
37
39 {
44 } )
45
47{
48 switch( m_Format )
49 {
50 case EXPORTER_STEP_PARAMS::FORMAT::STEP: return wxS( "step" );
51 case EXPORTER_STEP_PARAMS::FORMAT::BREP: return wxS( "brep" );
52 case EXPORTER_STEP_PARAMS::FORMAT::XAO: return wxS( "xao" );
53 case EXPORTER_STEP_PARAMS::FORMAT::GLB: return wxS( "glb" );
54 case EXPORTER_STEP_PARAMS::FORMAT::PLY: return wxS( "ply" );
55 case EXPORTER_STEP_PARAMS::FORMAT::STL: return wxS( "stl" );
56 default: return wxEmptyString; // shouldn't happen
57 }
58}
59
60
62{
63 switch( m_Format )
64 {
65 // honestly these names shouldn't be translated since they are mostly industry standard acronyms
66 case EXPORTER_STEP_PARAMS::FORMAT::STEP: return wxS( "STEP" );
67 case EXPORTER_STEP_PARAMS::FORMAT::BREP: return wxS( "BREP" );
68 case EXPORTER_STEP_PARAMS::FORMAT::XAO: return wxS( "XAO" );
69 case EXPORTER_STEP_PARAMS::FORMAT::GLB: return wxS( "Binary GLTF" );
70 case EXPORTER_STEP_PARAMS::FORMAT::PLY: return wxS( "PLY" );
71 case EXPORTER_STEP_PARAMS::FORMAT::STL: return wxS( "STL" );
72 default: return wxEmptyString; // shouldn't happen
73 }
74}
75
76
78 JOB( "3d", false ),
79 m_hasUserOrigin( false ),
80 m_filename(),
81 m_format( JOB_EXPORT_PCB_3D::FORMAT::UNKNOWN ),
82 m_vrmlUnits( JOB_EXPORT_PCB_3D::VRML_UNITS::METERS ),
83 m_vrmlModelDir( wxEmptyString ),
84 m_vrmlRelativePaths( false )
85{
86 m_params.emplace_back(
88 m_params.emplace_back( new JOB_PARAM<bool>( "use_grid_origin", &m_3dparams.m_UseGridOrigin,
90 m_params.emplace_back( new JOB_PARAM<bool>( "use_drill_origin", &m_3dparams.m_UseDrillOrigin,
92 m_params.emplace_back(
94 m_params.emplace_back( new JOB_PARAM<bool>( "include_unspecified",
97 m_params.emplace_back( new JOB_PARAM<bool>( "include_dnp", &m_3dparams.m_IncludeDNP,
99 m_params.emplace_back( new JOB_PARAM<bool>( "subst_models", &m_3dparams.m_SubstModels,
101 m_params.emplace_back( new JOB_PARAM<bool>( "optimize_step", &m_3dparams.m_OptimizeStep,
103 m_params.emplace_back( new JOB_PARAM<double>( "user_origin.x", &m_3dparams.m_Origin.x,
105 m_params.emplace_back( new JOB_PARAM<double>( "user_origin.y", &m_3dparams.m_Origin.y,
107 m_params.emplace_back( new JOB_PARAM<double>( "board_outlines_chaining_epsilon",
110 m_params.emplace_back( new JOB_PARAM<bool>( "export_board_body", &m_3dparams.m_ExportBoardBody,
112 m_params.emplace_back( new JOB_PARAM<bool>( "export_components", &m_3dparams.m_ExportComponents,
114 m_params.emplace_back( new JOB_PARAM<bool>( "export_tracks", &m_3dparams.m_ExportTracksVias,
116 m_params.emplace_back( new JOB_PARAM<bool>( "export_pads", &m_3dparams.m_ExportPads,
118 m_params.emplace_back( new JOB_PARAM<bool>( "export_zones", &m_3dparams.m_ExportZones,
120 m_params.emplace_back( new JOB_PARAM<bool>( "export_inner_copper",
123 m_params.emplace_back( new JOB_PARAM<bool>( "export_silkscreen", &m_3dparams.m_ExportSilkscreen,
125 m_params.emplace_back( new JOB_PARAM<bool>( "export_soldermask", &m_3dparams.m_ExportSoldermask,
127 m_params.emplace_back( new JOB_PARAM<bool>( "fuse_shapes", &m_3dparams.m_FuseShapes,
129 m_params.emplace_back( new JOB_PARAM<wxString>( "vrml_model_dir", &m_vrmlModelDir, m_vrmlModelDir ) );
130 m_params.emplace_back( new JOB_PARAM<bool>( "vrml_relative_paths", &m_vrmlRelativePaths,
132}
133
134
136{
137 return wxString::Format( _( "3D model export" ) );
138}
139
140REGISTER_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
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:134
@ 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" }, { 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