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 along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
21
22#include <jobs/job_registry.h>
24#include <wx/filename.h>
25
29 } )
30
32 JOB( "stats", false ),
33 m_filename(),
34 m_format( OUTPUT_FORMAT::REPORT ),
35 m_units( UNITS::MM ),
36 m_excludeFootprintsWithoutPads( false ),
37 m_subtractHolesFromBoardArea( false ),
38 m_subtractHolesFromCopperAreas( false )
39{
40 m_params.emplace_back( new JOB_PARAM<OUTPUT_FORMAT>( "output_format", &m_format, m_format ) );
41 m_params.emplace_back( new JOB_PARAM<UNITS>( "units", &m_units, m_units ) );
42 m_params.emplace_back( new JOB_PARAM<bool>( "exclude_footprints_without_pads", &m_excludeFootprintsWithoutPads,
43 m_excludeFootprintsWithoutPads ) );
44 m_params.emplace_back( new JOB_PARAM<bool>( "subtract_holes_from_board", &m_subtractHolesFromBoardArea,
45 m_subtractHolesFromBoardArea ) );
46 m_params.emplace_back( new JOB_PARAM<bool>( "subtract_holes_from_copper", &m_subtractHolesFromCopperAreas,
47 m_subtractHolesFromCopperAreas ) );
48}
49
50
52{
53 return _( "Export board statistics" );
54}
55
56
58{
59 return _( "Export Board Statistics Job Settings" );
60}
61
62
63void JOB_EXPORT_PCB_STATS::SetDefaultOutputPath( const wxString& aReferenceName )
64{
65 wxFileName fn( aReferenceName );
66
67 // We have other report file types (ERC/DRC) and JSON outputs so make sure we default
68 // to something that won't overwrite them.
69 fn.SetName( fn.GetName() + wxS( "_statistics" ) );
70
72 fn.SetExt( FILEEXT::JsonFileExtension );
73 else
75
76 SetWorkingOutputPath( fn.GetFullName() );
77}
78
79
80REGISTER_JOB( pcb_export_stats, _( "PCB: Export Statistics" ), KIWAY::FACE_PCB, JOB_EXPORT_PCB_STATS );
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
void SetDefaultOutputPath(const wxString &aReferenceName)
An simple container class that lets us dispatch output jobs to kifaces.
Definition job.h:183
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:238
@ FACE_PCB
pcbnew DSO
Definition kiway.h:294
#define _(s)
static const std::string ReportFileExtension
static const std::string JsonFileExtension
NLOHMANN_JSON_SERIALIZE_ENUM(JOB_EXPORT_PCB_STATS::UNITS, { { JOB_EXPORT_PCB_STATS::UNITS::INCH, "in" }, { JOB_EXPORT_PCB_STATS::UNITS::MM, "mm" }, }) JOB_EXPORT_PCB_STATS
#define REGISTER_JOB(job_name, title, face, T)
#define REPORT(msg)
OUTPUT_FORMAT
Definition of file extensions used in Kicad.