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-2018 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 <wx/wx.h>
27 #include <outline_mode.h>
28 #include <plotters_specific.h>
30 
31 class COLOR_SETTINGS;
33 
39 {
40  friend class PCB_PLOT_PARAMS_PARSER;
41 public:
46  };
47 
48 private:
49  // If true, do not plot NPTH pads
50  // (mainly used to disable NPTH pads plotting on copper layers)
52 
57 
63 
68 
71 
74 
77 
80 
82  double m_scale;
83 
85  bool m_mirror;
86 
88  bool m_negative;
89 
92 
95 
98 
101 
107 
110 
114 
117 
120 
126 
129  unsigned m_svgPrecision;
130 
134 
137 
140 
143 
146 
149 
152 
155 
158 
162 
163  /* These next two scale factors are intended to compensate plotters
164  * (mainly printers) X and Y scale error. Therefore they are expected very
165  * near 1.0; only X and Y dimensions are adjusted: circles are plotted as
166  * circles, even if X and Y fine scale differ; because of this it is mostly
167  * useful for printers: postscript plots would be best adjusted using
168  * the prologue (that would change the whole output matrix
169  */
170 
173 
178 
181  double m_HPGLPenDiam;
182  COLOR4D m_color;
184 
187 
189  std::shared_ptr<COLOR_SETTINGS> m_default_colors;
190 
191 public:
192  PCB_PLOT_PARAMS();
193 
194  void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; }
195  bool GetSkipPlotNPTH_Pads() const { return m_skipNPTH_Pads; }
196 
197  void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 ) const;
198  void Parse( PCB_PLOT_PARAMS_PARSER* aParser );
199 
207  bool IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams, bool aCompareOnlySavedPrms ) const;
208 
209  void SetColor( COLOR4D aVal ) { m_color = aVal; }
210  COLOR4D GetColor() const { return m_color; }
211 
212  void SetColorSettings( COLOR_SETTINGS* aSettings ) { m_colors = aSettings; }
213 
214  COLOR_SETTINGS* ColorSettings() const { return m_colors; }
215 
217  {
218  m_textMode = aVal;
219  }
220 
222  {
223  return m_textMode;
224  }
225 
226  void SetPlotMode( OUTLINE_MODE aPlotMode ) { m_plotMode = aPlotMode; }
227  OUTLINE_MODE GetPlotMode() const { return m_plotMode; }
228 
229  void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; }
231 
233  {
234  m_DXFplotUnits = aUnit;
235  }
236 
238  {
239  return m_DXFplotUnits;
240  }
241 
244 
245  void SetScale( double aVal ) { m_scale = aVal; }
246  double GetScale() const { return m_scale; }
247 
248  void SetFineScaleAdjustX( double aVal ) { m_fineScaleAdjustX = aVal; }
249  double GetFineScaleAdjustX() const { return m_fineScaleAdjustX; }
250  void SetFineScaleAdjustY( double aVal ) { m_fineScaleAdjustY = aVal; }
251  double GetFineScaleAdjustY() const { return m_fineScaleAdjustY; }
252  void SetWidthAdjust( int aVal ) { m_widthAdjust = aVal; }
253  int GetWidthAdjust() const { return m_widthAdjust; }
254 
255  void SetAutoScale( bool aFlag ) { m_autoScale = aFlag; }
256  bool GetAutoScale() const { return m_autoScale; }
257 
258  void SetMirror( bool aFlag ) { m_mirror = aFlag; }
259  bool GetMirror() const { return m_mirror; }
260 
261  void SetSketchPadsOnFabLayers( bool aFlag ) { m_sketchPadsOnFabLayers = aFlag; }
263  void SetSketchPadLineWidth( int aWidth ) { m_sketchPadLineWidth = aWidth; }
265 
266  void SetPlotInvisibleText( bool aFlag ) { m_plotInvisibleText = aFlag; }
267  bool GetPlotInvisibleText() const { return m_plotInvisibleText; }
268  void SetPlotValue( bool aFlag ) { m_plotValue = aFlag; }
269  bool GetPlotValue() const { return m_plotValue; }
270  void SetPlotReference( bool aFlag ) { m_plotReference = aFlag; }
271  bool GetPlotReference() const { return m_plotReference; }
272 
273  void SetNegative( bool aFlag ) { m_negative = aFlag; }
274  bool GetNegative() const { return m_negative; }
275 
276  void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; }
278 
279  void SetPlotFrameRef( bool aFlag ) { m_plotFrameRef = aFlag; }
280  bool GetPlotFrameRef() const { return m_plotFrameRef; }
281 
282  void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; }
283  bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; }
284 
285  void SetFormat( PLOT_FORMAT aFormat )
286  {
287  m_format = aFormat;
288  }
289 
291  {
292  return m_format;
293  }
294 
295  void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; }
296  wxString GetOutputDirectory() const { return m_outputDirectory; }
297 
298  void SetDisableGerberMacros( bool aDisable ) { m_gerberDisableApertMacros = aDisable; }
300 
301  void SetUseGerberX2format( bool aUse ) { m_useGerberX2format = aUse; }
302  bool GetUseGerberX2format() const { return m_useGerberX2format; }
303 
306 
307  void SetCreateGerberJobFile( bool aCreate ) { m_createGerberJobFile = aCreate; }
309 
312 
313  void SetGerberPrecision( int aPrecision );
314  int GetGerberPrecision() const { return m_gerberPrecision; }
315 
316  void SetSvgPrecision( unsigned aPrecision, bool aUseInch );
317  unsigned GetSvgPrecision() const { return m_svgPrecision; }
318  bool GetSvgUseInch() const { return m_svgUseInch; }
319 
324  static int GetGerberDefaultPrecision() { return 6; }
325 
326  void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; };
328 
329  void SetLayerSelection( LSET aSelection ) { m_layerSelection = aSelection; };
331 
332  void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; };
333  bool GetUseAuxOrigin() const { return m_useAuxOrigin; };
334 
335  void SetScaleSelection( int aSelection ) { m_scaleSelection = aSelection; };
336  int GetScaleSelection() const { return m_scaleSelection; };
337 
338  void SetA4Output( int aForce ) { m_A4Output = aForce; };
339  bool GetA4Output() const { return m_A4Output; };
340 
341  // For historical reasons, this parameter is stored in mils
342  // (but is in mm in hpgl files...)
343  double GetHPGLPenDiameter() const { return m_HPGLPenDiam; };
344  bool SetHPGLPenDiameter( double aValue );
345 
346  // This parameter is always in cm, due to hpgl file format constraint
347  int GetHPGLPenSpeed() const { return m_HPGLPenSpeed; };
348  bool SetHPGLPenSpeed( int aValue );
349 
350  void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; }
351  int GetHPGLPenNum() const { return m_HPGLPenNum; }
352 };
353 
354 
360 extern int g_DrawDefaultLineThickness;
361 
362 #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 g_DrawDefaultLineThickness
Default line thickness in PCnew units used to draw or plot items having a default thickness line valu...
int GetWidthAdjust() const
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.
Plotting engines (PostScript, Gerber, HPGL and DXF)
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.
OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a convenient ...
Definition: richio.h:328
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.
void SetColor(COLOR4D aVal)
bool m_sketchPadsOnFabLayers
Plots pads outlines on fab layers.
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
COLOR4D GetColor() const
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)
COLOR4D m_color
Color for plotting the current layer. Provided, but not really used.
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 IsSameAs(const PCB_PLOT_PARAMS &aPcbPlotParams, bool aCompareOnlySavedPrms) const
Compare current settings to aPcbPlotParams, including not saved parameters in brd file.
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)
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:100