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 
38 {
39  friend class PCB_PLOT_PARAMS_PARSER;
40 public:
45  };
46 
47 private:
48  // If true, do not plot NPTH pads
49  // (mainly used to disable NPTH pads plotting on copper layers)
51 
56 
62 
67 
70 
73 
76 
79 
81  double m_scale;
82 
84  bool m_mirror;
85 
87  bool m_negative;
88 
91 
94 
97 
100 
106 
109 
113 
116 
119 
125 
128  unsigned m_svgPrecision;
129 
133 
136 
139 
142 
145 
148 
151 
154 
157 
161 
162  /* These next two scale factors are intended to compensate plotters
163  * (mainly printers) X and Y scale error. Therefore they are expected very
164  * near 1.0; only X and Y dimensions are adjusted: circles are plotted as
165  * circles, even if X and Y fine scale differ; because of this it is mostly
166  * useful for printers: postscript plots would be best adjusted using
167  * the prologue (that would change the whole output matrix
168  */
169 
172 
177 
180  double m_HPGLPenDiam;
181 
185 
187  std::shared_ptr<COLOR_SETTINGS> m_default_colors;
188 
189 public:
190  PCB_PLOT_PARAMS();
191 
192  void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; }
193  bool GetSkipPlotNPTH_Pads() const { return m_skipNPTH_Pads; }
194 
195  void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 ) const;
196  void Parse( PCB_PLOT_PARAMS_PARSER* aParser );
197 
205  bool IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
206 
207  void SetColorSettings( COLOR_SETTINGS* aSettings ) { m_colors = aSettings; }
208 
209  COLOR_SETTINGS* ColorSettings() const { return m_colors; }
210 
212  {
213  m_textMode = aVal;
214  }
215 
217  {
218  return m_textMode;
219  }
220 
221  void SetPlotMode( OUTLINE_MODE aPlotMode ) { m_plotMode = aPlotMode; }
222  OUTLINE_MODE GetPlotMode() const { return m_plotMode; }
223 
224  void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; }
226 
228  {
229  m_DXFplotUnits = aUnit;
230  }
231 
233  {
234  return m_DXFplotUnits;
235  }
236 
239 
240  void SetScale( double aVal ) { m_scale = aVal; }
241  double GetScale() const { return m_scale; }
242 
243  void SetFineScaleAdjustX( double aVal ) { m_fineScaleAdjustX = aVal; }
244  double GetFineScaleAdjustX() const { return m_fineScaleAdjustX; }
245  void SetFineScaleAdjustY( double aVal ) { m_fineScaleAdjustY = aVal; }
246  double GetFineScaleAdjustY() const { return m_fineScaleAdjustY; }
247  void SetWidthAdjust( int aVal ) { m_widthAdjust = aVal; }
248  int GetWidthAdjust() const { return m_widthAdjust; }
249 
250  void SetAutoScale( bool aFlag ) { m_autoScale = aFlag; }
251  bool GetAutoScale() const { return m_autoScale; }
252 
253  void SetMirror( bool aFlag ) { m_mirror = aFlag; }
254  bool GetMirror() const { return m_mirror; }
255 
256  void SetSketchPadsOnFabLayers( bool aFlag ) { m_sketchPadsOnFabLayers = aFlag; }
258  void SetSketchPadLineWidth( int aWidth ) { m_sketchPadLineWidth = aWidth; }
260 
261  void SetPlotInvisibleText( bool aFlag ) { m_plotInvisibleText = aFlag; }
262  bool GetPlotInvisibleText() const { return m_plotInvisibleText; }
263  void SetPlotValue( bool aFlag ) { m_plotValue = aFlag; }
264  bool GetPlotValue() const { return m_plotValue; }
265  void SetPlotReference( bool aFlag ) { m_plotReference = aFlag; }
266  bool GetPlotReference() const { return m_plotReference; }
267 
268  void SetNegative( bool aFlag ) { m_negative = aFlag; }
269  bool GetNegative() const { return m_negative; }
270 
271  void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; }
273 
274  void SetPlotFrameRef( bool aFlag ) { m_plotFrameRef = aFlag; }
275  bool GetPlotFrameRef() const { return m_plotFrameRef; }
276 
277  void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; }
278  bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; }
279 
280  void SetFormat( PLOT_FORMAT aFormat )
281  {
282  m_format = aFormat;
283  }
284 
286  {
287  return m_format;
288  }
289 
290  void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; }
291  wxString GetOutputDirectory() const { return m_outputDirectory; }
292 
293  void SetDisableGerberMacros( bool aDisable ) { m_gerberDisableApertMacros = aDisable; }
295 
296  void SetUseGerberX2format( bool aUse ) { m_useGerberX2format = aUse; }
297  bool GetUseGerberX2format() const { return m_useGerberX2format; }
298 
301 
302  void SetCreateGerberJobFile( bool aCreate ) { m_createGerberJobFile = aCreate; }
304 
307 
308  void SetGerberPrecision( int aPrecision );
309  int GetGerberPrecision() const { return m_gerberPrecision; }
310 
311  void SetSvgPrecision( unsigned aPrecision, bool aUseInch );
312  unsigned GetSvgPrecision() const { return m_svgPrecision; }
313  bool GetSvgUseInch() const { return m_svgUseInch; }
314 
319  static int GetGerberDefaultPrecision() { return 6; }
320 
321  void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; };
323 
324  void SetLayerSelection( LSET aSelection ) { m_layerSelection = aSelection; };
326 
327  void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; };
328  bool GetUseAuxOrigin() const { return m_useAuxOrigin; };
329 
330  void SetScaleSelection( int aSelection ) { m_scaleSelection = aSelection; };
331  int GetScaleSelection() const { return m_scaleSelection; };
332 
333  void SetA4Output( int aForce ) { m_A4Output = aForce; };
334  bool GetA4Output() const { return m_A4Output; };
335 
336  // For historical reasons, this parameter is stored in mils
337  // (but is in mm in hpgl files...)
338  double GetHPGLPenDiameter() const { return m_HPGLPenDiam; };
339  bool SetHPGLPenDiameter( double aValue );
340 
341  // This parameter is always in cm, due to hpgl file format constraint
342  int GetHPGLPenSpeed() const { return m_HPGLPenSpeed; };
343  bool SetHPGLPenSpeed( int aValue );
344 
345  void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; }
346  int GetHPGLPenNum() const { return m_HPGLPenNum; }
347 };
348 
349 
350 #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:306
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)
COLOR_SETTINGS * m_colors
Pointer to active color settings to be used for plotting.
OUTLINE_MODE m_plotMode
FILLED or SKETCH selects how to plot filled objects.
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 In polygon mode, each item to plot is converted to a...
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
PCB_PLOT_PARAMS handles plot 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 absolue 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 aperure macros in Gerber format (only for broken Gerber readers) Ideally, should be never sel...
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)