KiCad PCB EDA Suite
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 (C) 1992-2022 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, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include <plotters/plotter.h>
27#include <layer_ids.h>
28#include <plotprint_opts.h>
29
30class COLOR_SETTINGS;
32
37{
38public:
40
41 void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; }
42 bool GetSkipPlotNPTH_Pads() const { return m_skipNPTH_Pads; }
43
44 void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 ) const;
45 void Parse( PCB_PLOT_PARAMS_PARSER* aParser );
46
55 bool IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
56
57 void SetColorSettings( COLOR_SETTINGS* aSettings ) { m_colors = aSettings; }
58
60
62 {
63 m_textMode = aVal;
64 }
65
67 {
68 return m_textMode;
69 }
70
71 void SetPlotMode( OUTLINE_MODE aPlotMode ) { m_plotMode = aPlotMode; }
73
74 void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; }
76
77 void SetDXFPlotUnits( DXF_UNITS aUnit ) { m_DXFplotUnits = aUnit; }
79
82
83 void SetScale( double aVal ) { m_scale = aVal; }
84 double GetScale() const { return m_scale; }
85
86 void SetFineScaleAdjustX( double aVal ) { m_fineScaleAdjustX = aVal; }
87 double GetFineScaleAdjustX() const { return m_fineScaleAdjustX; }
88 void SetFineScaleAdjustY( double aVal ) { m_fineScaleAdjustY = aVal; }
89 double GetFineScaleAdjustY() const { return m_fineScaleAdjustY; }
90 void SetWidthAdjust( int aVal ) { m_widthAdjust = aVal; }
91 int GetWidthAdjust() const { return m_widthAdjust; }
92
93 void SetAutoScale( bool aFlag ) { m_autoScale = aFlag; }
94 bool GetAutoScale() const { return m_autoScale; }
95
96 void SetMirror( bool aFlag ) { m_mirror = aFlag; }
97 bool GetMirror() const { return m_mirror; }
98
99 void SetSketchPadsOnFabLayers( bool aFlag ) { m_sketchPadsOnFabLayers = aFlag; }
101 void SetSketchPadLineWidth( int aWidth ) { m_sketchPadLineWidth = aWidth; }
103
104 void SetPlotInvisibleText( bool aFlag ) { m_plotInvisibleText = aFlag; }
106 void SetPlotValue( bool aFlag ) { m_plotValue = aFlag; }
107 bool GetPlotValue() const { return m_plotValue; }
108 void SetPlotReference( bool aFlag ) { m_plotReference = aFlag; }
109 bool GetPlotReference() const { return m_plotReference; }
110
111 void SetNegative( bool aFlag ) { m_negative = aFlag; }
112 bool GetNegative() const { return m_negative; }
113
114 void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; }
116
117 void SetPlotFrameRef( bool aFlag ) { m_plotFrameRef = aFlag; }
118 bool GetPlotFrameRef() const { return m_plotFrameRef; }
119
120 void SetFormat( PLOT_FORMAT aFormat ) { m_format = aFormat; }
121 PLOT_FORMAT GetFormat() const { return m_format; }
122
123 void SetOutputDirectory( const wxString& aDir ) { m_outputDirectory = aDir; }
124 wxString GetOutputDirectory() const { return m_outputDirectory; }
125
126 void SetDisableGerberMacros( bool aDisable ) { m_gerberDisableApertMacros = aDisable; }
128
129 void SetUseGerberX2format( bool aUse ) { m_useGerberX2format = aUse; }
131
134
135 void SetCreateGerberJobFile( bool aCreate ) { m_createGerberJobFile = aCreate; }
137
140
141 void SetGerberPrecision( int aPrecision );
142 int GetGerberPrecision() const { return m_gerberPrecision; }
143
144 void SetSvgPrecision( unsigned aPrecision );
145 unsigned GetSvgPrecision() const { return m_svgPrecision; }
146
147 void SetBlackAndWhite( bool blackAndWhite ) { m_blackAndWhite = blackAndWhite; }
148 unsigned GetBlackAndWhite() const { return m_blackAndWhite; }
149
156 static int GetGerberDefaultPrecision() { return 6; }
157
158 void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; }
160
161 void SetLayerSelection( LSET aSelection ) { m_layerSelection = aSelection; }
163
165 {
166 m_plotOnAllLayersSelection = aSelection;
167 }
168
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 // For historical reasons, this parameter is stored in mils
181 // (but is in mm in hpgl files...)
182 double GetHPGLPenDiameter() const { return m_HPGLPenDiam; }
183 bool SetHPGLPenDiameter( double aValue );
184
185 // This parameter is always in cm, due to hpgl file format constraint
186 int GetHPGLPenSpeed() const { return m_HPGLPenSpeed; }
187 bool SetHPGLPenSpeed( int aValue );
188
189 void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; }
190 int GetHPGLPenNum() const { return m_HPGLPenNum; }
191
192 void SetDashedLineDashRatio( double aVal ) { m_dashedLineDashRatio = aVal; }
194
195 void SetDashedLineGapRatio( double aVal ) { m_dashedLineGapRatio = aVal; }
197
198private:
200
201 // If true, do not plot NPTH pads
202 // (mainly used to disable NPTH pads plotting on copper layers)
204
211
218
223
226
229
232
235
237 double m_scale;
238
241
244
247
250
253
256
262
265
269
272
275
281
285
288
291
294
297
300
303
306
309
312
316
317 /* These next two scale factors are intended to compensate plotters
318 * (mainly printers) X and Y scale error. Therefore they are expected very
319 * near 1.0; only X and Y dimensions are adjusted: circles are plotted as
320 * circles, even if X and Y fine scale differ; because of this it is mostly
321 * useful for printers: postscript plots would be best adjusted using
322 * the prologue (that would change the whole output matrix
323 */
324
327
333
338
341
344
346 std::shared_ptr<COLOR_SETTINGS> m_default_colors;
347};
348
349
350#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...
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:310
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.
int m_HPGLPenNum
HPGL only: pen number selection(1 to 9)
DXF_UNITS m_DXFplotUnits
DXF format: Units to use when plotting the DXF.
bool GetSkipPlotNPTH_Pads() const
double m_dashedLineGapRatio
static int GetGerberDefaultPrecision()
Default precision of coordinates in Gerber files.
void SetDrillMarksType(DRILL_MARKS aVal)
bool GetUseAuxOrigin() const
void SetSkipPlotNPTH_Pads(bool aSkip)
int m_gerberPrecision
precision of coordinates in Gerber files: accepted 5 or 6 when units are in mm (6 or 7 in inches,...
void SetLayerSelection(LSET aSelection)
void SetOutputDirectory(const wxString &aDir)
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)
OUTLINE_MODE m_plotMode
FILLED or SKETCH selects how to plot filled objects.
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)
bool GetPlotInvisibleText() const
void SetA4Output(int aForce)
PLOT_TEXT_MODE GetTextMode() const
void SetHPGLPenNum(int aVal)
PLOT_TEXT_MODE m_textMode
Choose how represent text with PS, PDF and DXF drivers.
bool m_plotValue
Enable plotting of part values.
void SetDXFPlotPolygonMode(bool aFlag)
void SetAutoScale(bool aFlag)
double GetHPGLPenDiameter() const
unsigned GetSvgPrecision() const
wxString m_outputDirectory
Output directory for plot files (usually relative to the board file)
void SetPlotFrameRef(bool aFlag)
void SetDashedLineGapRatio(double aVal)
unsigned GetBlackAndWhite() const
double GetScale() const
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 ....
int m_HPGLPenSpeed
HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
bool GetCreateGerberJobFile() const
bool GetDXFPlotPolygonMode() const
bool m_useAuxOrigin
Plot gerbers using auxiliary (drill) origin instead of absolute coordinates.
void SetSketchPadLineWidth(int aWidth)
double m_scale
Global scale factor, 1.0 plots a board with its actual size.
LSET GetLayerSelection() const
bool GetPlotReference() const
wxString GetOutputDirectory() const
int GetScaleSelection() const
void SetPlotOnAllLayersSelection(LSET aSelection)
int m_widthAdjust
This width factor is intended to compensate PS printers/ plotters that do not strictly obey line widt...
LSET GetPlotOnAllLayersSelection() const
bool SetHPGLPenDiameter(double aValue)
void SetScale(double aVal)
void SetDisableGerberMacros(bool aDisable)
double m_fineScaleAdjustX
fine scale adjust X axis
LSET m_plotOnAllLayersSelection
Set of layers that get plotted on each of the layers to plot.
void SetScaleSelection(int aSelection)
double m_dashedLineDashRatio
void SetFineScaleAdjustX(double aVal)
void Format(OUTPUTFORMATTER *aFormatter, int aNestLevel, int aControl=0) const
void SetMirror(bool aFlag)
void SetBlackAndWhite(bool blackAndWhite)
void SetPlotViaOnMaskLayer(bool aFlag)
bool m_plotFrameRef
True to plot/print frame references.
void SetGerberPrecision(int aPrecision)
bool m_blackAndWhite
Plot in black and white only.
void SetSubtractMaskFromSilk(bool aSubtract)
bool SetHPGLPenSpeed(int aValue)
bool m_plotInvisibleText
Force plotting of fields marked invisible.
int GetSketchPadLineWidth() const
PLOT_FORMAT m_format
Plot format type (chooses the driver to be used)
bool GetSketchPadsOnFabLayers() const
bool m_createGerberJobFile
generate the auxiliary "job file" in gerber format
bool GetSubtractMaskFromSilk() const
void SetPlotValue(bool aFlag)
int GetGerberPrecision() const
bool m_plotReference
Enable plotting of part references.
double m_fineScaleAdjustY
fine scale adjust Y axis
double m_HPGLPenDiam
HPGL only: pen diameter in MILS, useful to fill areas However, it is in mm in hpgl files.
bool m_DXFplotPolygonMode
DXF format: Plot items in outline (polygon) mode.
int GetHPGLPenSpeed() const
double GetFineScaleAdjustY() const
bool m_gerberDisableApertMacros
Disable aperture macros in Gerber format (only for broken Gerber readers) Ideally,...
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 active color settings to be used for plotting.
bool GetA4Output() const
int GetHPGLPenNum() const
DRILL_MARKS GetDrillMarksType() const
bool GetUseGerberX2format() const
bool m_mirror
Mirror the plot around the X axis.
void SetDXFPlotUnits(DXF_UNITS aUnit)
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
void SetPlotInvisibleText(bool aFlag)
void SetCreateGerberJobFile(bool aCreate)
unsigned m_svgPrecision
precision of coordinates in SVG files: accepted 3 - 6 6 is the internal resolution of Pcbnew
bool GetIncludeGerberNetlistInfo() const
void SetNegative(bool aFlag)
double GetFineScaleAdjustX() const
void SetPlotMode(OUTLINE_MODE aPlotMode)
double GetDashedLineGapRatio() const
void SetUseAuxOrigin(bool aAux)
void SetTextMode(PLOT_TEXT_MODE aVal)
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 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 SetFormat(PLOT_FORMAT aFormat)
bool GetPlotViaOnMaskLayer() const
bool m_plotViaOnMaskLayer
True if vias are drawn on Mask layer (ie untented, exposed by mask)
bool GetDisableGerberMacros() const
void SetFineScaleAdjustY(double aVal)
OUTLINE_MODE GetPlotMode() const
LSET m_layerSelection
Set of layers to plot.
void SetWidthAdjust(int aVal)
COLOR_SETTINGS * ColorSettings() const
OUTLINE_MODE
Definition: outline_mode.h:25
DRILL_MARKS
Plots and prints can show holes in pads and vias 3 options are available:
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
DXF_UNITS
Definition: plotter.h:58
PLOT_TEXT_MODE
Which kind of text to output with the PSLIKE plotters.
Definition: plotter.h:96
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:70