KiCad PCB EDA Suite
Loading...
Searching...
No Matches
job_export_pcb_ipc2581.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) 2024 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
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
22#include <jobs/job_registry.h>
23#include <i18n_utility.h>
25
37
39 JOB_EXPORT_PCB_FAB( "ipc2581" ),
41 m_compress( false ),
43 m_colMfg(),
45 m_colDist(),
46 m_bomRev()
47{
48 m_params.emplace_back( new JOB_PARAM<IPC2581_VERSION>( "version", &m_version, m_version ) );
49 m_params.emplace_back( new JOB_PARAM<bool>( "compress", &m_compress, m_compress ) );
50 m_params.emplace_back( new JOB_PARAM<wxString>( "field_bom_map.internal_id",
53 m_params.emplace_back( new JOB_PARAM<wxString>( "field_bom_map.mfg", &m_colMfg, m_colMfg ) );
54 m_params.emplace_back( new JOB_PARAM<wxString>( "field_bom_map.dist_pn",
56 m_colDistPn ) );
57 m_params.emplace_back( new JOB_PARAM<wxString>( "field_bom_map.dist", &m_colDist, m_colDist ) );
58 m_params.emplace_back( new JOB_PARAM<wxString>( "bom_rev", &m_bomRev, m_bomRev ) );
59 m_params.emplace_back( new JOB_PARAM<REF_DES>( "ref_des", &m_refDes, m_refDes ) );
60}
61
62
63void JOB_EXPORT_PCB_IPC2581::FromJson( const nlohmann::json& aJson )
64{
66
67 // Nightly builds stored the data set token under this key
68 if( !aJson.contains( "data_set" ) && aJson.contains( "mode" ) && aJson["mode"].is_string() )
69 m_dataSet = DataSetFromToken( wxString::FromUTF8( aJson["mode"].get<std::string>() ) );
70}
71
72
74{
75 // KiCad has no DFX data to give
76 return aDataSet != DATA_SET::DFX && aDataSet != DATA_SET::COUNT;
77}
78
79
81{
82 return _( "Export IPC-2581" );
83}
84
85
87{
88 return _( "Export IPC-2581 Job Settings" );
89}
90
91
92void JOB_EXPORT_PCB_IPC2581::SetDefaultOutputPath( const wxString& aReferenceName )
93{
94 wxFileName fn = aReferenceName;
95
97
98 SetConfiguredOutputPath( fn.GetFullName() );
99}
100
101REGISTER_JOB( pcb_export_ipc2581, _HKI( "PCB: Export IPC-2581" ), KIWAY::FACE_PCB,
void FromJson(const nlohmann::json &aJson) override
DATA_SET
Columns of the IPC-2581C function mode table, Table 4 p 80.
JOB_EXPORT_PCB_FAB(const std::string &aType)
static DATA_SET DataSetFromToken(const wxString &aToken)
Read a data set token in upper case or in lower case An empty token is USERDEF.
bool SupportsDataSet(DATA_SET aDataSet) const override
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
void SetDefaultOutputPath(const wxString &aReferenceName)
void FromJson(const nlohmann::json &aJson) override
void SetConfiguredOutputPath(const wxString &aPath)
Sets the configured output path for the job, this path is always saved to file.
Definition job.cpp:157
std::vector< JOB_PARAM_BASE * > m_params
Definition job.h:277
@ FACE_PCB
pcbnew DSO
Definition kiway.h:356
#define _(s)
static const std::string Ipc2581FileExtension
Some functions to handle hotkeys in KiCad.
NLOHMANN_JSON_SERIALIZE_ENUM(JOB_EXPORT_PCB_IPC2581::IPC2581_VERSION, { { JOB_EXPORT_PCB_IPC2581::IPC2581_VERSION::B, "B" }, { JOB_EXPORT_PCB_IPC2581::IPC2581_VERSION::C, "C" }, }) NLOHMANN_JSON_SERIALIZE_ENUM(JOB_EXPORT_PCB_IPC2581
#define REGISTER_JOB(job_name, title, face, T)
#define _HKI(x)
Definition page_info.cpp:40
Definition of file extensions used in Kicad.