KiCad PCB EDA Suite
Loading...
Searching...
No Matches
command_pcb_export_gerbers.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) 2022 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 <cli/exit_codes.h>
24#include <kiface_base.h>
25#include <string_utils.h>
26
27#define ARG_USE_BOARD_PLOT_PARAMS "--board-plot-params"
28
29
31 PCB_EXPORT_GERBER_COMMAND( "gerbers", true )
32{
33 m_argParser.add_description( UTF8STDSTR( _( "Plot multiple Gerbers for a PCB, including the "
34 "ability to use stored board plot settings" ) ) );
35
37 .help( UTF8STDSTR( _( "Use the Gerber plot settings already configured in the "
38 "board file" ) ) )
39 .flag();
40}
41
42
44{
45 std::unique_ptr<JOB_EXPORT_PCB_GERBERS> gerberJob( new JOB_EXPORT_PCB_GERBERS() );
46
47 int exitCode = populateJob( gerberJob.get() );
48
49 if( exitCode != EXIT_CODES::OK )
50 return exitCode;
51
52 gerberJob->m_argLayers = From_UTF8( m_argParser.get<std::string>( ARG_LAYERS ).c_str() );
53 gerberJob->m_argCommonLayers = From_UTF8( m_argParser.get<std::string>( ARG_COMMON_LAYERS ).c_str() );
54 gerberJob->m_useBoardPlotParams = m_argParser.get<bool>( ARG_USE_BOARD_PLOT_PARAMS );
55
56 return aKiway.ProcessJob( KIWAY::FACE_PCB, gerberJob.get() );
57}
argparse::ArgumentParser m_argParser
Definition command.h:100
int doPerform(KIWAY &aKiway) override
The internal handler that should be overloaded to implement command specific processing and work.
PCB_EXPORT_GERBER_COMMAND(const std::string &aName, bool aOutputIsDir=false)
int populateJob(JOB_EXPORT_PCB_GERBER *aJob)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:286
int ProcessJob(KIWAY::FACE_T aFace, JOB *aJob, REPORTER *aReporter=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Definition kiway.cpp:701
@ FACE_PCB
pcbnew DSO
Definition kiway.h:294
#define UTF8STDSTR(s)
Definition command.h:27
#define ARG_COMMON_LAYERS
#define ARG_LAYERS
#define ARG_USE_BOARD_PLOT_PARAMS
#define _(s)
static const int OK
Definition exit_codes.h:30
wxString From_UTF8(const char *cstring)