KiCad PCB EDA Suite
Loading...
Searching...
No Matches
job_export_pcb_stats.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
21
22#include <jobs/job_registry.h>
23#include <i18n_utility.h>
25#include <wx/filename.h>
26
40
42 JOB( "stats", false ),
43 m_filename(),
49{
50 m_params.emplace_back( new JOB_PARAM<OUTPUT_FORMAT>( "output_format", &m_format, m_format ) );
51 m_params.emplace_back( new JOB_PARAM<UNITS>( "units", &m_units, m_units ) );
52 m_params.emplace_back( new JOB_PARAM<bool>( "exclude_footprints_without_pads", &m_excludeFootprintsWithoutPads,
54 m_params.emplace_back( new JOB_PARAM<bool>( "subtract_holes_from_board", &m_subtractHolesFromBoardArea,
56 m_params.emplace_back( new JOB_PARAM<bool>( "subtract_holes_from_copper", &m_subtractHolesFromCopperAreas,
58}
59
60
62{
63 return _( "Export board statistics" );
64}
65
66
68{
69 return _( "Export Board Statistics Job Settings" );
70}
71
72
73void JOB_EXPORT_PCB_STATS::SetDefaultOutputPath( const wxString& aReferenceName )
74{
75 wxFileName fn( aReferenceName );
76
77 // We have other report file types (ERC/DRC) and JSON outputs so make sure we default
78 // to something that won't overwrite them.
79 fn.SetName( fn.GetName() + wxS( "_statistics" ) );
80
82 fn.SetExt( FILEEXT::JsonFileExtension );
83 else
85
86 SetWorkingOutputPath( fn.GetFullName() );
87}
88
89
90REGISTER_JOB( pcb_export_stats, _HKI( "PCB: Export Board Statistics" ), KIWAY::FACE_PCB, JOB_EXPORT_PCB_STATS );
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
void SetDefaultOutputPath(const wxString &aReferenceName)
std::vector< JOB_PARAM_BASE * > m_params
Definition job.h:285
JOB(const std::string &aType, bool aOutputIsDirectory)
Definition job.cpp:26
void SetWorkingOutputPath(const wxString &aPath)
Sets a transient output path for the job, it takes priority over the configured output path when GetF...
Definition job.h:241
@ FACE_PCB
pcbnew DSO
Definition kiway.h:356
#define _(s)
static const std::string ReportFileExtension
static const std::string JsonFileExtension
Some functions to handle hotkeys in KiCad.
NLOHMANN_JSON_SERIALIZE_ENUM(JOB_EXPORT_PCB_STATS::OUTPUT_FORMAT, { { JOB_EXPORT_PCB_STATS::OUTPUT_FORMAT::REPORT, "report" }, { JOB_EXPORT_PCB_STATS::OUTPUT_FORMAT::JSON, "json" }, { JOB_EXPORT_PCB_STATS::OUTPUT_FORMAT::REPORT, 0 }, { JOB_EXPORT_PCB_STATS::OUTPUT_FORMAT::JSON, 1 }, }) NLOHMANN_JSON_SERIALIZE_ENUM(JOB_EXPORT_PCB_STATS
#define REGISTER_JOB(job_name, title, face, T)
#define _HKI(x)
Definition page_info.cpp:40
Definition of file extensions used in Kicad.