KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_plot_params.h
Go to the documentation of this file.
1#ifndef PCB_PLOT_PARAMS_H_
2#define PCB_PLOT_PARAMS_H_
3/*
4 * This program source code file is part of KiCad, a free EDA CAD application.
5 *
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#include <plotters/plotter.h>
23#include <layer_ids.h>
24#include <plotprint_opts.h>
25#include <lseq.h>
26
27class COLOR_SETTINGS;
29
34{
35public:
37
38 void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; }
39 bool GetSkipPlotNPTH_Pads() const { return m_skipNPTH_Pads; }
40
41 void Format( OUTPUTFORMATTER* aFormatter ) const;
42 void Parse( PCB_PLOT_PARAMS_PARSER* aParser );
43
50 bool IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
51
52 void SetColorSettings( COLOR_SETTINGS* aSettings ) { m_colors = aSettings; }
53
55
57 {
58 m_textMode = aVal;
59 }
60
61 PLOT_TEXT_MODE GetTextMode() const override
62 {
63 return m_textMode;
64 }
65
66 void SetDXFPlotMode( DXF_OUTLINE_MODE aPlotMode ) { m_DXFPlotMode = aPlotMode; }
67 DXF_OUTLINE_MODE GetDXFPlotMode() const override { return m_DXFPlotMode; }
68
69 void SetPlotPadNumbers( bool aFlag ) { m_plotPadNumbers = aFlag; }
70 bool GetPlotPadNumbers() const { return m_plotPadNumbers; }
71
72 void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFPolygonMode = aFlag; }
73 bool GetDXFPlotPolygonMode() const { return m_DXFPolygonMode; }
74
75 void SetDXFPlotUnits( DXF_UNITS aUnit ) { m_DXFUnits = aUnit; }
77
80
81 void SetScale( double aVal ) { m_scale = aVal; }
82 double GetScale() const { return m_scale; }
83
84 void SetFineScaleAdjustX( double aVal ) { m_fineScaleAdjustX = aVal; }
85 double GetFineScaleAdjustX() const { return m_fineScaleAdjustX; }
86 void SetFineScaleAdjustY( double aVal ) { m_fineScaleAdjustY = aVal; }
87 double GetFineScaleAdjustY() const { return m_fineScaleAdjustY; }
88 void SetWidthAdjust( int aVal ) { m_widthAdjust = aVal; }
89 int GetWidthAdjust() const { return m_widthAdjust; }
90
91 void SetAutoScale( bool aFlag ) { m_autoScale = aFlag; }
92 bool GetAutoScale() const { return m_autoScale; }
93
94 void SetMirror( bool aFlag ) { m_mirror = aFlag; }
95 bool GetMirror() const { return m_mirror; }
96
97 void SetSketchPadsOnFabLayers( bool aFlag ) { m_sketchPadsOnFabLayers = aFlag; }
99 void SetSketchPadLineWidth( int aWidth ) { m_sketchPadLineWidth = aWidth; }
101
102 void SetHideDNPFPsOnFabLayers( bool aFlag ) { m_hideDNPFPsOnFabLayers = aFlag; }
108
109 void SetPlotValue( bool aFlag ) { m_plotValue = aFlag; }
110 bool GetPlotValue() const { return m_plotValue; }
111 void SetPlotReference( bool aFlag ) { m_plotReference = aFlag; }
112 bool GetPlotReference() const { return m_plotReference; }
113 void SetPlotFPText( bool aFlag ) { m_plotFPText = aFlag; }
114 bool GetPlotFPText() const { return m_plotFPText; }
115
116 void SetNegative( bool aFlag ) { m_negative = aFlag; }
117 bool GetNegative() const { return m_negative; }
118
119 std::optional<bool> GetLegacyPlotViaOnMaskLayer() const { return m_plotViaOnMaskLayer; }
120
121 void SetPlotFrameRef( bool aFlag ) { m_plotDrawingSheet = aFlag; }
122 bool GetPlotFrameRef() const { return m_plotDrawingSheet; }
123
124 void SetFormat( PLOT_FORMAT aFormat ) { m_format = aFormat; }
125 PLOT_FORMAT GetFormat() const { return m_format; }
126
127 void SetOutputDirectory( const wxString& aDir ) { m_outputDirectory = aDir; }
128 wxString GetOutputDirectory() const { return m_outputDirectory; }
129
130 void SetDisableGerberMacros( bool aDisable ) { m_gerberDisableApertMacros = aDisable; }
132
133 void SetUseGerberX2format( bool aUse ) { m_useGerberX2format = aUse; }
135
138
139 void SetCreateGerberJobFile( bool aCreate ) { m_createGerberJobFile = aCreate; }
141
144
145 void SetGerberPrecision( int aPrecision );
146 int GetGerberPrecision() const { return m_gerberPrecision; }
147
148 void SetSvgPrecision( unsigned aPrecision );
149 unsigned GetSvgPrecision() const { return m_svgPrecision; }
150
151 void SetSvgFitPageToBoard( int aSvgFitPageToBoard ) { m_svgFitPageToBoard = aSvgFitPageToBoard; }
153
154 void SetPngDPI( int aDPI ) { m_pngDPI = aDPI; }
155 int GetPngDPI() const { return m_pngDPI; }
156 void SetPngAntialias( bool aFlag ) { m_pngAntialias = aFlag; }
157 bool GetPngAntialias() const { return m_pngAntialias; }
158
159 void SetBlackAndWhite( bool blackAndWhite ) { m_blackAndWhite = blackAndWhite; }
160 bool GetBlackAndWhite() const { return m_blackAndWhite; }
161
162 void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; }
164
165 void SetLayerSelection( const LSET& aSelection ) { m_layerSelection = aSelection; }
167
170
171 void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; }
172 bool GetUseAuxOrigin() const { return m_useAuxOrigin; }
173
174 void SetScaleSelection( int aSelection ) { m_scaleSelection = aSelection; }
175 int GetScaleSelection() const { return m_scaleSelection; }
176
177 void SetA4Output( int aForce ) { m_A4Output = aForce; }
178 bool GetA4Output() const { return m_A4Output; }
179
180 void SetDashedLineDashRatio( double aVal ) { m_dashedLineDashRatio = aVal; }
182
183 void SetDashedLineGapRatio( double aVal ) { m_dashedLineGapRatio = aVal; }
185
188
189 void SetLayersToExport( std::vector<std::pair<PCB_LAYER_ID, wxString>> & aVal ) { m_layersToExport = aVal; }
190 std::vector<std::pair<PCB_LAYER_ID, wxString>> GetLayersToExport() const { return m_layersToExport; }
191
195 PCB_LAYER_ID GetLayer() const { return m_layer; }
196 void SetLayer( PCB_LAYER_ID aLayer ) { m_layer = aLayer; }
197
198 void SetBackgroundColor( const COLOR4D& aColor ) { m_backgroundColor = aColor; }
200
201public:
207
208private:
210
214
224
227 double m_scale;
228 bool m_mirror;
229
233
234 std::optional<bool> m_plotViaOnMaskLayer;
235
238
239
243
246
250
253
256
262
268
271
272
276
280
283
287
295
299
302
304
306 std::shared_ptr<COLOR_SETTINGS> m_default_colors;
307
309
310 std::vector<std::pair<PCB_LAYER_ID, wxString>> m_layersToExport;
311
313};
314
315
316#endif // PCB_PLOT_PARAMS_H_
Color settings are a bit different than most of the settings objects in that there can be more than o...
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
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
An interface used to output 8 bit text in a convenient way.
Definition richio.h:294
The parser for PCB_PLOT_PARAMS.
Parameters and options when plotting/printing a board.
bool GetNegative() const
PLOT_FORMAT GetFormat() const
bool m_sketchPadsOnFabLayers
Plots pads outlines on fab layers.
bool GetSkipPlotNPTH_Pads() const
std::optional< bool > m_plotViaOnMaskLayer
Deprecated; only used for reading legacy files.
bool GetPngAntialias() const
void SetDrillMarksType(DRILL_MARKS aVal)
bool GetUseAuxOrigin() const
LSEQ GetPlotOnAllLayersSequence() const
bool GetHideDNPFPsOnFabLayers() const
void SetSkipPlotNPTH_Pads(bool aSkip)
void SetLayerSelection(const LSET &aSelection)
int m_gerberPrecision
Precision of coordinates in Gerber: accepted 5 or 6 when units are in mm, 6 or 7 in inches (but Pcbne...
void SetOutputDirectory(const wxString &aDir)
bool GetDXFMultiLayeredExportOption() const
void SetPlotReference(bool aFlag)
std::shared_ptr< COLOR_SETTINGS > m_default_colors
Dummy colors object that can be created if there is no Pgm context.
int GetWidthAdjust() const
void SetSketchPadsOnFabLayers(bool aFlag)
void SetUseGerberX2format(bool aUse)
bool m_A4Output
Autoscale the plot to fit an A4 (landscape?) sheet.
bool GetMirror() const
DXF_UNITS GetDXFPlotUnits() const
bool GetAutoScale() const
int m_scaleSelection
Scale ratio index (UI only)
void SetA4Output(int aForce)
PLOT_TEXT_MODE m_textMode
bool GetCrossoutDNPFPsOnFabLayers() const
bool GetSketchDNPFPsOnFabLayers() const
void SetPlotOnAllLayersSequence(LSEQ aSeq)
bool m_plotValue
Enable plotting of part values.
void SetDXFPlotPolygonMode(bool aFlag)
void SetAutoScale(bool aFlag)
unsigned GetSvgPrecision() const
wxString m_outputDirectory
Output directory for plot files (usually relative to the board file)
void SetPlotFrameRef(bool aFlag)
void SetSketchDNPFPsOnFabLayers(bool aFlag)
bool m_PDFMetadata
Generate PDF metadata for SUBJECT and AUTHOR.
void SetDashedLineGapRatio(double aVal)
double GetScale() const
PLOT_TEXT_MODE GetTextMode() const override
PCB_LAYER_ID GetLayer() const
Return the layer this item is on.
bool m_autoScale
When true set the scale to fit the board in the page.
bool m_useGerberProtelExtensions
When plotting gerber files, use a conventional set of Protel extensions instead of ....
bool GetCreateGerberJobFile() const
void SetPlotPadNumbers(bool aFlag)
bool GetDXFPlotPolygonMode() const
bool m_useAuxOrigin
Plot gerbers using auxiliary (drill) origin instead of absolute coordinates.
void SetSketchPadLineWidth(int aWidth)
void SetLayersToExport(std::vector< std::pair< PCB_LAYER_ID, wxString > > &aVal)
bool GetSvgFitPagetoBoard() const
double m_scale
Global scale factor, 1.0 plots a board at actual size.
LSET GetLayerSelection() const
bool GetPlotReference() const
wxString GetOutputDirectory() const
int GetScaleSelection() const
COLOR4D m_backgroundColor
Background color to use for PNG and PDF plotting.
int m_widthAdjust
Compensation for PS printers/plotters that do not strictly obey line width settings.
bool m_PDFFrontFPPropertyPopups
Generate PDF property popup menus for footprints.
void SetScale(double aVal)
void SetDisableGerberMacros(bool aDisable)
void SetDXFMultiLayeredExportOption(bool aFlag)
double m_fineScaleAdjustX
Compensation for printer scale errors (and therefore.
friend class PCB_PLOT_PARAMS_PARSER
void SetScaleSelection(int aSelection)
std::optional< bool > GetLegacyPlotViaOnMaskLayer() const
void SetFineScaleAdjustX(double aVal)
void SetMirror(bool aFlag)
void SetBlackAndWhite(bool blackAndWhite)
PCB_LAYER_ID m_layer
void SetPlotFPText(bool aFlag)
void SetGerberPrecision(int aPrecision)
bool m_blackAndWhite
Plot in black and white only.
DXF_OUTLINE_MODE GetDXFPlotMode() const override
void SetSubtractMaskFromSilk(bool aSubtract)
int GetSketchPadLineWidth() const
PLOT_FORMAT m_format
Plot format type (chooses the driver to be used)
bool GetSketchPadsOnFabLayers() const
void SetHideDNPFPsOnFabLayers(bool aFlag)
bool m_createGerberJobFile
generate the auxiliary "job file" in gerber format
bool GetSubtractMaskFromSilk() const
void SetPlotValue(bool aFlag)
COLOR4D GetBackgroundColor() const
void SetPngDPI(int aDPI)
int GetGerberPrecision() const
bool m_plotReference
Enable plotting of part references.
double m_fineScaleAdjustY
expected to be very near 1.0).
double GetFineScaleAdjustY() const
bool m_gerberDisableApertMacros
Disable aperture macros in Gerber format (only for broken Gerber readers).
void SetUseGerberProtelExtensions(bool aUse)
void SetDashedLineDashRatio(double aVal)
void Parse(PCB_PLOT_PARAMS_PARSER *aParser)
bool m_subtractMaskFromSilk
On gerbers 'scrape' away the solder mask from silkscreen (trim silks)
COLOR_SETTINGS * m_colors
Pointer to color settings to be used for plotting.
bool GetPlotPadNumbers() const
bool GetA4Output() const
DRILL_MARKS GetDrillMarksType() const
bool GetUseGerberX2format() const
bool m_mirror
Mirror the plot around the X axis.
void SetDXFPlotUnits(DXF_UNITS aUnit)
void SetPngAntialias(bool aFlag)
void SetColorSettings(COLOR_SETTINGS *aSettings)
bool IsSameAs(const PCB_PLOT_PARAMS &aPcbPlotParams) const
Compare current settings to aPcbPlotParams, including not saved parameters in brd file.
void SetIncludeGerberNetlistInfo(bool aUse)
bool m_includeGerberNetlistInfo
Include netlist info (only in Gerber X2 format) (chapter ? in revision ?)
bool GetPlotValue() const
DXF_OUTLINE_MODE m_DXFPlotMode
FILLED or SKETCH for filled objects.
void SetCreateGerberJobFile(bool aCreate)
unsigned m_svgPrecision
Precision of coordinates in SVG: accepted 3 - 6; 6 is the internal resolution of Pcbnew.
bool GetIncludeGerberNetlistInfo() const
bool m_PDFSingle
Generate a single PDF file for all layers.
void SetNegative(bool aFlag)
int GetPngDPI() const
double GetFineScaleAdjustX() const
bool GetBlackAndWhite() const
std::vector< std::pair< PCB_LAYER_ID, wxString > > m_layersToExport
double GetDashedLineGapRatio() const
void SetUseAuxOrigin(bool aAux)
bool m_PDFBackFPPropertyPopups
on front and/or back of board
bool GetPlotFPText() const
void SetLayer(PCB_LAYER_ID aLayer)
bool m_skipNPTH_Pads
Used to disable NPTH pads plotting on copper layers.
void SetDXFPlotMode(DXF_OUTLINE_MODE aPlotMode)
void SetTextMode(PLOT_TEXT_MODE aVal)
void SetSvgFitPageToBoard(int aSvgFitPageToBoard)
bool GetUseGerberProtelExtensions() const
double GetDashedLineDashRatio() const
void SetSvgPrecision(unsigned aPrecision)
bool GetPlotFrameRef() const
DRILL_MARKS m_drillMarks
Holes can be not plotted, have a small mark, or be plotted in actual size.
bool m_useGerberX2format
Include attributes from the Gerber X2 format (chapter 5 in revision J2)
bool m_negative
Plot in negative color (supported only by some drivers)
void SetCrossoutDNPFPsOnFabLayers(bool aFlag)
void SetFormat(PLOT_FORMAT aFormat)
bool GetDisableGerberMacros() const
void SetBackgroundColor(const COLOR4D &aColor)
void SetFineScaleAdjustY(double aVal)
std::vector< std::pair< PCB_LAYER_ID, wxString > > GetLayersToExport() const
void Format(OUTPUTFORMATTER *aFormatter) const
bool m_DXFExportAsMultiLayeredFile
bool m_plotPadNumbers
Plot pad numbers when sketching pads on fab layers.
bool m_DXFPolygonMode
In polygon mode, each item to plot is converted to a polygon and all polygons are merged.
void SetWidthAdjust(int aVal)
COLOR_SETTINGS * ColorSettings() const
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
DRILL_MARKS
Plots and prints can show holes in pads and vias 3 options are available:
DXF_UNITS
Definition plotter.h:51
PLOT_TEXT_MODE
Which kind of text to output with the PSLIKE plotters.
Definition plotter.h:99
DXF_OUTLINE_MODE
Options to draw items with thickness ( segments, arcs, circles, texts...)
Definition plotter.h:80
PLOT_FORMAT
The set of supported output plot formats.
Definition plotter.h:63