KiCad PCB EDA Suite
Loading...
Searching...
No Matches
job_export_pcb_plot.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
23 {
27 } )
28
29JOB_EXPORT_PCB_PLOT::JOB_EXPORT_PCB_PLOT( PLOT_FORMAT aFormat, const std::string& aType,
30 bool aOutputIsDirectory ) :
31 JOB( aType, aOutputIsDirectory ),
32 m_plotFormat( aFormat ),
33 m_filename(),
34 m_colorTheme(),
35 m_drawingSheet(),
36 m_mirror( false ),
37 m_blackAndWhite( false ),
38 m_negative( false ),
39 m_scale( 1.0 ),
40 m_sketchPadsOnFabLayers( false ),
41 m_hideDNPFPsOnFabLayers( false ),
42 m_sketchDNPFPsOnFabLayers( true ),
43 m_crossoutDNPFPsOnFabLayers( true ),
44 m_plotFootprintValues( true ),
45 m_plotRefDes( true ),
46 m_plotDrawingSheet( true ),
47 m_subtractSolderMaskFromSilk( false ),
48 m_plotPadNumbers( false ),
49 m_plotLayerSequence(),
50 m_plotAllCopperLayers( false ),
51 m_plotOnAllLayersSequence(),
52 m_drillShapeOption( DRILL_MARKS::FULL_DRILL_SHAPE ),
53 m_useDrillOrigin( false ),
54 m_checkZonesBeforePlot( false )
55{
56 m_params.emplace_back( new JOB_PARAM_LSEQ( "layers",
57 &m_plotLayerSequence, m_plotLayerSequence ) );
58
59 m_params.emplace_back( new JOB_PARAM<bool>( "all_copper_layers", &m_plotAllCopperLayers,
60 m_plotAllCopperLayers ) );
61
62 m_params.emplace_back( new JOB_PARAM_LSEQ( "layers_to_include_on_all_layers",
63 &m_plotOnAllLayersSequence,
64 m_plotOnAllLayersSequence ) );
65
66 m_params.emplace_back( new JOB_PARAM<bool>( "mirror",
67 &m_mirror, m_mirror ) );
68 m_params.emplace_back( new JOB_PARAM<bool>( "black_and_white",
69 &m_blackAndWhite, m_blackAndWhite ) );
70 m_params.emplace_back( new JOB_PARAM<bool>( "negative",
71 &m_negative, m_negative ) );
72
73 m_params.emplace_back( new JOB_PARAM<bool>( "plot_footprint_values",
74 &m_plotFootprintValues, m_plotFootprintValues ) );
75 m_params.emplace_back( new JOB_PARAM<bool>( "plot_ref_des",
76 &m_plotRefDes, m_plotRefDes ) );
77
78 m_params.emplace_back( new JOB_PARAM<bool>( "hide_dnp_footprints_on_fab_layers",
79 &m_hideDNPFPsOnFabLayers,
80 m_hideDNPFPsOnFabLayers ) );
81 m_params.emplace_back( new JOB_PARAM<bool>( "sketch_dnp_footprints_on_fab_layers",
82 &m_sketchDNPFPsOnFabLayers,
83 m_sketchDNPFPsOnFabLayers ) );
84 m_params.emplace_back( new JOB_PARAM<bool>( "crossout_dnp_footprints_on_fab_layers",
85 &m_crossoutDNPFPsOnFabLayers,
86 m_crossoutDNPFPsOnFabLayers ) );
87
88 m_params.emplace_back( new JOB_PARAM<bool>( "sketch_pads_on_fab_layers",
89 &m_sketchPadsOnFabLayers,
90 m_sketchPadsOnFabLayers ) );
91 m_params.emplace_back( new JOB_PARAM<bool>( "plot_pad_numbers",
92 &m_plotPadNumbers, m_plotPadNumbers ) );
93
94 m_params.emplace_back( new JOB_PARAM<bool>( "plot_drawing_sheet",
95 &m_plotDrawingSheet, m_plotDrawingSheet ) );
96
97 m_params.emplace_back( new JOB_PARAM<bool>( "subtract_solder_mask_from_silk",
98 &m_subtractSolderMaskFromSilk,
99 m_subtractSolderMaskFromSilk ) );
100
101 m_params.emplace_back( new JOB_PARAM<bool>( "use_drill_origin",
102 &m_useDrillOrigin, m_useDrillOrigin ) );
103
104 m_params.emplace_back( new JOB_PARAM<DRILL_MARKS>( "drill_shape",
105 &m_drillShapeOption, m_drillShapeOption ) );
106
107 m_params.emplace_back( new JOB_PARAM<wxString>( "drawing_sheet",
108 &m_drawingSheet, m_drawingSheet ) );
109
110 m_params.emplace_back( new JOB_PARAM<bool>( "check_zones", &m_checkZonesBeforePlot, m_checkZonesBeforePlot ) );
111
112 m_params.emplace_back( new JOB_PARAM<wxString>( "variant", &m_variant, m_variant ) );
113}
114
115
116void JOB_EXPORT_PCB_PLOT::FromJson( const nlohmann::json& aJson )
117{
118 JOB::FromJson( aJson );
119
120 // Older plot job dialogs stored every copper layer the board lacked, so a list holding all of
121 // them meant every copper layer
122 if( !aJson.contains( "all_copper_layers" ) )
124}
125
126
128{
130 return m_plotLayerSequence;
131
132 LSET layers( m_plotLayerSequence );
133 layers |= aEnabledLayers & LSET::AllCuMask();
134
135 return layers.SeqStackupForPlotting();
136}
LSEQ ResolvePlotLayers(const LSET &aEnabledLayers) const
Return the layers to plot on a board with aEnabledLayers.
JOB_EXPORT_PCB_PLOT(PLOT_FORMAT aFormat, const std::string &aType, bool aOutputIsDirectory)
void FromJson(const nlohmann::json &aJson) override
bool m_plotAllCopperLayers
Plot every copper layer of the board in addition to m_plotLayerSequence.
An simple container class that lets us dispatch output jobs to kifaces.
Definition job.h:184
virtual void FromJson(const nlohmann::json &j)
Definition job.cpp:60
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition lseq.h:47
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Definition lset.cpp:604
LSEQ SeqStackupForPlotting() const
Return the sequence that is typical for a bottom-to-top stack-up.
Definition lset.cpp:400
bool ContainsAll(const LSET &aLayers) const
See if this layer set contains all layers in another set.
Definition lset.h:85
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition lset.cpp:595
NLOHMANN_JSON_SERIALIZE_ENUM(DRILL_MARKS, { { DRILL_MARKS::NO_DRILL_SHAPE, "none" }, { DRILL_MARKS::SMALL_DRILL_SHAPE, "small" }, { DRILL_MARKS::FULL_DRILL_SHAPE, "full" } }) JOB_EXPORT_PCB_PLOT
DRILL_MARKS
Plots and prints can show holes in pads and vias 3 options are available:
PLOT_FORMAT
The set of supported output plot formats.
Definition plotter.h:65