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 <plotters/plotter.h>
27 #include <layer_ids.h>
28 
29 class COLOR_SETTINGS;
31 
36 {
37 public:
42  };
43 
45 
46  void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; }
47  bool GetSkipPlotNPTH_Pads() const { return m_skipNPTH_Pads; }
48 
49  void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 ) const;
50  void Parse( PCB_PLOT_PARAMS_PARSER* aParser );
51 
60  bool IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
61 
62  void SetColorSettings( COLOR_SETTINGS* aSettings ) { m_colors = aSettings; }
63 
64  COLOR_SETTINGS* ColorSettings() const { return m_colors; }
65 
67  {
68  m_textMode = aVal;
69  }
70 
72  {
73  return m_textMode;
74  }
75 
76  void SetPlotMode( OUTLINE_MODE aPlotMode ) { m_plotMode = aPlotMode; }
77  OUTLINE_MODE GetPlotMode() const { return m_plotMode; }
78 
79  void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; }
81 
82  void SetDXFPlotUnits( DXF_UNITS aUnit )
83  {
84  m_DXFplotUnits = aUnit;
85  }
86 
88  {
89  return m_DXFplotUnits;
90  }
91 
94 
95  void SetScale( double aVal ) { m_scale = aVal; }
96  double GetScale() const { return m_scale; }
97 
98  void SetFineScaleAdjustX( double aVal ) { m_fineScaleAdjustX = aVal; }
99  double GetFineScaleAdjustX() const { return m_fineScaleAdjustX; }
100  void SetFineScaleAdjustY( double aVal ) { m_fineScaleAdjustY = aVal; }
101  double GetFineScaleAdjustY() const { return m_fineScaleAdjustY; }
102  void SetWidthAdjust( int aVal ) { m_widthAdjust = aVal; }
103  int GetWidthAdjust() const { return m_widthAdjust; }
104 
105  void SetAutoScale( bool aFlag ) { m_autoScale = aFlag; }
106  bool GetAutoScale() const { return m_autoScale; }
107 
108  void SetMirror( bool aFlag ) { m_mirror = aFlag; }
109  bool GetMirror() const { return m_mirror; }
110 
111  void SetSketchPadsOnFabLayers( bool aFlag ) { m_sketchPadsOnFabLayers = aFlag; }
113  void SetSketchPadLineWidth( int aWidth ) { m_sketchPadLineWidth = aWidth; }
115 
116  void SetPlotInvisibleText( bool aFlag ) { m_plotInvisibleText = aFlag; }
117  bool GetPlotInvisibleText() const { return m_plotInvisibleText; }
118  void SetPlotValue( bool aFlag ) { m_plotValue = aFlag; }
119  bool GetPlotValue() const { return m_plotValue; }
120  void SetPlotReference( bool aFlag ) { m_plotReference = aFlag; }
121  bool GetPlotReference() const { return m_plotReference; }
122 
123  void SetNegative( bool aFlag ) { m_negative = aFlag; }
124  bool GetNegative() const { return m_negative; }
125 
126  void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; }
128 
129  void SetPlotFrameRef( bool aFlag ) { m_plotFrameRef = aFlag; }
130  bool GetPlotFrameRef() const { return m_plotFrameRef; }
131 
132  void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; }
133  bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; }
134 
135  void SetFormat( PLOT_FORMAT aFormat ) { m_format = aFormat; }
136  PLOT_FORMAT GetFormat() const { return m_format; }
137 
138  void SetOutputDirectory( const wxString& aDir ) { m_outputDirectory = aDir; }
139  wxString GetOutputDirectory() const { return m_outputDirectory; }
140 
141  void SetDisableGerberMacros( bool aDisable ) { m_gerberDisableApertMacros = aDisable; }
143 
144  void SetUseGerberX2format( bool aUse ) { m_useGerberX2format = aUse; }
145  bool GetUseGerberX2format() const { return m_useGerberX2format; }
146 
149 
150  void SetCreateGerberJobFile( bool aCreate ) { m_createGerberJobFile = aCreate; }
152 
155 
156  void SetGerberPrecision( int aPrecision );
157  int GetGerberPrecision() const { return m_gerberPrecision; }
158 
159  void SetSvgPrecision( unsigned aPrecision, bool aUseInch );
160  unsigned GetSvgPrecision() const { return m_svgPrecision; }
161  bool GetSvgUseInch() const { return m_svgUseInch; }
162 
169  static int GetGerberDefaultPrecision() { return 6; }
170 
171  void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; };
173 
174  void SetLayerSelection( LSET aSelection ) { m_layerSelection = aSelection; };
176 
177  void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; };
178  bool GetUseAuxOrigin() const { return m_useAuxOrigin; };
179 
180  void SetScaleSelection( int aSelection ) { m_scaleSelection = aSelection; };
181  int GetScaleSelection() const { return m_scaleSelection; };
182 
183  void SetA4Output( int aForce ) { m_A4Output = aForce; };
184  bool GetA4Output() const { return m_A4Output; };
185 
186  // For historical reasons, this parameter is stored in mils
187  // (but is in mm in hpgl files...)
188  double GetHPGLPenDiameter() const { return m_HPGLPenDiam; };
189  bool SetHPGLPenDiameter( double aValue );
190 
191  // This parameter is always in cm, due to hpgl file format constraint
192  int GetHPGLPenSpeed() const { return m_HPGLPenSpeed; };
193  bool SetHPGLPenSpeed( int aValue );
194 
195  void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; }
196  int GetHPGLPenNum() const { return m_HPGLPenNum; }
197 
198 private:
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 
240  bool m_mirror;
241 
244 
247 
250 
253 
256 
262 
265 
269 
272 
275 
281 
284  unsigned m_svgPrecision;
285 
289 
292 
295 
298 
301 
304 
307 
310 
313 
317 
318  /* These next two scale factors are intended to compensate plotters
319  * (mainly printers) X and Y scale error. Therefore they are expected very
320  * near 1.0; only X and Y dimensions are adjusted: circles are plotted as
321  * circles, even if X and Y fine scale differ; because of this it is mostly
322  * useful for printers: postscript plots would be best adjusted using
323  * the prologue (that would change the whole output matrix
324  */
325 
328 
334 
337  double m_HPGLPenDiam;
338 
342 
344  std::shared_ptr<COLOR_SETTINGS> m_default_colors;
345 };
346 
347 
348 #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 SetOutputDirectory(const wxString &aDir)
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.
Definition: layer_ids.h:502
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 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.
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)