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-2021 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 <outline_mode.h>
27 #include <plotter.h>
29 
30 class COLOR_SETTINGS;
32 
37 {
38 public:
43  };
44 
46 
47  void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; }
48  bool GetSkipPlotNPTH_Pads() const { return m_skipNPTH_Pads; }
49 
50  void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 ) const;
51  void Parse( PCB_PLOT_PARAMS_PARSER* aParser );
52 
61  bool IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
62 
63  void SetColorSettings( COLOR_SETTINGS* aSettings ) { m_colors = aSettings; }
64 
65  COLOR_SETTINGS* ColorSettings() const { return m_colors; }
66 
68  {
69  m_textMode = aVal;
70  }
71 
73  {
74  return m_textMode;
75  }
76 
77  void SetPlotMode( OUTLINE_MODE aPlotMode ) { m_plotMode = aPlotMode; }
78  OUTLINE_MODE GetPlotMode() const { return m_plotMode; }
79 
80  void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; }
82 
83  void SetDXFPlotUnits( DXF_UNITS aUnit )
84  {
85  m_DXFplotUnits = aUnit;
86  }
87 
89  {
90  return m_DXFplotUnits;
91  }
92 
95 
96  void SetScale( double aVal ) { m_scale = aVal; }
97  double GetScale() const { return m_scale; }
98 
99  void SetFineScaleAdjustX( double aVal ) { m_fineScaleAdjustX = aVal; }
100  double GetFineScaleAdjustX() const { return m_fineScaleAdjustX; }
101  void SetFineScaleAdjustY( double aVal ) { m_fineScaleAdjustY = aVal; }
102  double GetFineScaleAdjustY() const { return m_fineScaleAdjustY; }
103  void SetWidthAdjust( int aVal ) { m_widthAdjust = aVal; }
104  int GetWidthAdjust() const { return m_widthAdjust; }
105 
106  void SetAutoScale( bool aFlag ) { m_autoScale = aFlag; }
107  bool GetAutoScale() const { return m_autoScale; }
108 
109  void SetMirror( bool aFlag ) { m_mirror = aFlag; }
110  bool GetMirror() const { return m_mirror; }
111 
112  void SetSketchPadsOnFabLayers( bool aFlag ) { m_sketchPadsOnFabLayers = aFlag; }
114  void SetSketchPadLineWidth( int aWidth ) { m_sketchPadLineWidth = aWidth; }
116 
117  void SetPlotInvisibleText( bool aFlag ) { m_plotInvisibleText = aFlag; }
118  bool GetPlotInvisibleText() const { return m_plotInvisibleText; }
119  void SetPlotValue( bool aFlag ) { m_plotValue = aFlag; }
120  bool GetPlotValue() const { return m_plotValue; }
121  void SetPlotReference( bool aFlag ) { m_plotReference = aFlag; }
122  bool GetPlotReference() const { return m_plotReference; }
123 
124  void SetNegative( bool aFlag ) { m_negative = aFlag; }
125  bool GetNegative() const { return m_negative; }
126 
127  void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; }
129 
130  void SetPlotFrameRef( bool aFlag ) { m_plotFrameRef = aFlag; }
131  bool GetPlotFrameRef() const { return m_plotFrameRef; }
132 
133  void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; }
134  bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; }
135 
136  void SetFormat( PLOT_FORMAT aFormat ) { m_format = aFormat; }
137  PLOT_FORMAT GetFormat() const { return m_format; }
138 
139  void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; }
140  wxString GetOutputDirectory() const { return m_outputDirectory; }
141 
142  void SetDisableGerberMacros( bool aDisable ) { m_gerberDisableApertMacros = aDisable; }
144 
145  void SetUseGerberX2format( bool aUse ) { m_useGerberX2format = aUse; }
146  bool GetUseGerberX2format() const { return m_useGerberX2format; }
147 
150 
151  void SetCreateGerberJobFile( bool aCreate ) { m_createGerberJobFile = aCreate; }
153 
156 
157  void SetGerberPrecision( int aPrecision );
158  int GetGerberPrecision() const { return m_gerberPrecision; }
159 
160  void SetSvgPrecision( unsigned aPrecision, bool aUseInch );
161  unsigned GetSvgPrecision() const { return m_svgPrecision; }
162  bool GetSvgUseInch() const { return m_svgUseInch; }
163 
170  static int GetGerberDefaultPrecision() { return 6; }
171 
172  void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; };
174 
175  void SetLayerSelection( LSET aSelection ) { m_layerSelection = aSelection; };
177 
178  void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; };
179  bool GetUseAuxOrigin() const { return m_useAuxOrigin; };
180 
181  void SetScaleSelection( int aSelection ) { m_scaleSelection = aSelection; };
182  int GetScaleSelection() const { return m_scaleSelection; };
183 
184  void SetA4Output( int aForce ) { m_A4Output = aForce; };
185  bool GetA4Output() const { return m_A4Output; };
186 
187  // For historical reasons, this parameter is stored in mils
188  // (but is in mm in hpgl files...)
189  double GetHPGLPenDiameter() const { return m_HPGLPenDiam; };
190  bool SetHPGLPenDiameter( double aValue );
191 
192  // This parameter is always in cm, due to hpgl file format constraint
193  int GetHPGLPenSpeed() const { return m_HPGLPenSpeed; };
194  bool SetHPGLPenSpeed( int aValue );
195 
196  void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; }
197  int GetHPGLPenNum() const { return m_HPGLPenNum; }
198 
199 private:
201 
202  // If true, do not plot NPTH pads
203  // (mainly used to disable NPTH pads plotting on copper layers)
205 
212 
219 
224 
227 
230 
233 
236 
238  double m_scale;
239 
241  bool m_mirror;
242 
245 
248 
251 
254 
257 
263 
266 
270 
273 
276 
282 
285  unsigned m_svgPrecision;
286 
290 
293 
296 
299 
302 
305 
308 
311 
314 
318 
319  /* These next two scale factors are intended to compensate plotters
320  * (mainly printers) X and Y scale error. Therefore they are expected very
321  * near 1.0; only X and Y dimensions are adjusted: circles are plotted as
322  * circles, even if X and Y fine scale differ; because of this it is mostly
323  * useful for printers: postscript plots would be best adjusted using
324  * the prologue (that would change the whole output matrix
325  */
326 
329 
335 
338  double m_HPGLPenDiam;
339 
343 
345  std::shared_ptr<COLOR_SETTINGS> m_default_colors;
346 };
347 
348 
349 #endif // PCB_PLOT_PARAMS_H_
double m_fineScaleAdjustX
fine scale adjust X axis
void SetUseGerberProtelExtensions(bool aUse)
void SetPlotReference(bool aFlag)
void SetExcludeEdgeLayer(bool aFlag)
bool m_plotValue
Enable plotting of part values.
OUTLINE_MODE GetPlotMode() const
void SetScaleSelection(int aSelection)
void SetIncludeGerberNetlistInfo(bool aUse)
void SetDXFPlotPolygonMode(bool aFlag)
OUTLINE_MODE
Definition: outline_mode.h:24
bool GetCreateGerberJobFile() const
int GetWidthAdjust() const
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
void SetGerberPrecision(int aPrecision)
void SetPlotViaOnMaskLayer(bool aFlag)
wxString m_outputDirectory
Output directory for plot files (usually relative to the board file)
bool GetPlotFrameRef() const
bool m_mirror
Mirror the plot around the X axis.
bool GetDXFPlotPolygonMode() const
void SetLayerSelection(LSET aSelection)
void SetUseAuxOrigin(bool aAux)
void SetHPGLPenNum(int aVal)
PCB_PLOT_PARAMS_PARSER is the parser class for PCB_PLOT_PARAMS.
void SetSketchPadLineWidth(int aWidth)
bool m_excludeEdgeLayer
If false always plot (merge) the pcb edge layer on other layers.
void Format(OUTPUTFORMATTER *aFormatter, int aNestLevel, int aControl=0) const
DXF_UNITS m_DXFplotUnits
DXF format: Units to use when plotting the DXF.
bool GetDisableGerberMacros() const
void SetCreateGerberJobFile(bool aCreate)
void SetMirror(bool aFlag)
bool m_svgUseInch
units for SVG plot false for metric, true for inch/mils
bool m_useGerberX2format
Include attributes from the Gerber X2 format (chapter 5 in revision J2)
double m_scale
Global scale factor, 1.0 plots a board with its actual size.
bool m_plotReference
Enable plotting of part references.
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:309
bool m_useGerberProtelExtensions
When plotting gerber files, use a conventional set of Protel extensions instead of ....
int GetHPGLPenSpeed() const
bool SetHPGLPenSpeed(int aValue)
void SetTextMode(PLOT_TEXT_MODE aVal)
OUTLINE_MODE m_plotMode
FILLED or SKETCH selects how to plot filled objects.
COLOR_SETTINGS * m_colors
Pointer to active color settings to be used for plotting.
void SetDrillMarksType(DrillMarksType aVal)
int m_scaleSelection
Scale ratio index (UI only)
void SetDXFPlotUnits(DXF_UNITS aUnit)
bool m_negative
Plot in negative color (supported only by some drivers)
double GetScale() const
void SetA4Output(int aForce)
bool GetUseGerberX2format() const
bool m_plotFrameRef
True to plot/print frame references.
double m_HPGLPenDiam
HPGL only: pen diameter in MILS, useful to fill areas However, it is in mm in hpgl files.
bool m_includeGerberNetlistInfo
Include netlist info (only in Gerber X2 format) (chapter ? in revision ?)
bool GetMirror() const
void SetPlotValue(bool aFlag)
bool m_plotInvisibleText
Force plotting of fields marked invisible.
bool m_DXFplotPolygonMode
DXF format: Plot items in outline (polygon) mode.
void SetPlotFrameRef(bool aFlag)
bool m_autoScale
When true set the scale to fit the board in the page.
bool m_A4Output
Autoscale the plot to fit an A4 (landscape?) sheet.
void SetDisableGerberMacros(bool aDisable)
bool GetA4Output() const
int GetGerberPrecision() const
unsigned m_svgPrecision
precision of coordinates in SVG files: accepted 3 - 6 6 is the internal resolution of Pcbnew
LSET is a set of PCB_LAYER_IDs.
PLOT_FORMAT GetFormat() const
static int GetGerberDefaultPrecision()
Default precision of coordinates in Gerber files.
bool m_sketchPadsOnFabLayers
Plots pads outlines on fab layers.
bool IsSameAs(const PCB_PLOT_PARAMS &aPcbPlotParams) const
Compare current settings to aPcbPlotParams, including not saved parameters in brd file.
bool GetUseGerberProtelExtensions() const
void SetColorSettings(COLOR_SETTINGS *aSettings)
unsigned GetSvgPrecision() const
bool m_subtractMaskFromSilk
On gerbers 'scrape' away the solder mask from silkscreen (trim silks)
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:67
double m_fineScaleAdjustY
fine scale adjust Y axis
bool GetIncludeGerberNetlistInfo() const
void SetSkipPlotNPTH_Pads(bool aSkip)
PLOT_TEXT_MODE GetTextMode() const
void SetSubtractMaskFromSilk(bool aSubtract)
bool GetSkipPlotNPTH_Pads() const
void SetUseGerberX2format(bool aUse)
bool m_plotViaOnMaskLayer
True if vias are drawn on Mask layer (ie untented, exposed by mask)
void SetOutputDirectory(wxString aDir)
void SetFormat(PLOT_FORMAT aFormat)
bool GetAutoScale() const
Parameters and options when plotting/printing a board.
void SetPlotInvisibleText(bool aFlag)
void SetScale(double aVal)
double GetFineScaleAdjustX() const
void SetPlotMode(OUTLINE_MODE aPlotMode)
int m_widthAdjust
This width factor is intended to compensate PS printers/ plotters that do not strictly obey line widt...
void SetNegative(bool aFlag)
bool GetPlotValue() const
bool m_useAuxOrigin
Plot gerbers using auxiliary (drill) origin instead of absolute coordinates.
PLOT_FORMAT m_format
Plot format type (chooses the driver to be used)
void SetSvgPrecision(unsigned aPrecision, bool aUseInch)
wxString GetOutputDirectory() const
void SetFineScaleAdjustX(double aVal)
int GetHPGLPenNum() const
bool m_createGerberJobFile
generate the auxiliary "job file" in gerber format
bool SetHPGLPenDiameter(double aValue)
bool GetSketchPadsOnFabLayers() const
bool m_gerberDisableApertMacros
Disable aperture macros in Gerber format (only for broken Gerber readers) Ideally,...
int m_HPGLPenNum
HPGL only: pen number selection(1 to 9)
bool GetPlotViaOnMaskLayer() const
LSET m_layerSelection
Set of layers to plot.
Board layer functions and definitions.
void SetWidthAdjust(int aVal)
bool GetSubtractMaskFromSilk() const
std::shared_ptr< COLOR_SETTINGS > m_default_colors
Dummy colors object that can be created if there is no Pgm context.
double GetHPGLPenDiameter() const
bool GetPlotInvisibleText() const
PLOT_TEXT_MODE m_textMode
Choose how represent text with PS, PDF and DXF drivers.
void SetAutoScale(bool aFlag)
void SetFineScaleAdjustY(double aVal)
int GetSketchPadLineWidth() const
DXF_UNITS
Definition: plotter.h:55
double GetFineScaleAdjustY() const
Color settings are a bit different than most of the settings objects in that there can be more than o...
int GetScaleSelection() const
int m_HPGLPenSpeed
HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
COLOR_SETTINGS * ColorSettings() const
DXF_UNITS GetDXFPlotUnits() const
bool GetSvgUseInch() const
bool GetNegative() const
PLOT_TEXT_MODE
Which kind of text to output with the PSLIKE plotters.
Definition: plotter.h:93
bool GetUseAuxOrigin() const
LSET GetLayerSelection() const
void Parse(PCB_PLOT_PARAMS_PARSER *aParser)
DrillMarksType GetDrillMarksType() const
bool GetPlotReference() const
DrillMarksType m_drillMarks
Holes can be not plotted, have a small mark or plotted in actual size.
int m_gerberPrecision
precision of coordinates in Gerber files: accepted 5 or 6 when units are in mm (6 or 7 in inches,...
bool GetExcludeEdgeLayer() const
void SetSketchPadsOnFabLayers(bool aFlag)