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 <eda_text.h> // EDA_DRAW_MODE_T
28 #include <plotter.h>
30 
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 
82 
84  double m_scale;
85 
87  bool m_mirror;
88 
90  bool m_negative;
91 
94 
97 
100 
103 
109 
112 
115 
118 
124 
127 
130 
133 
136 
139 
142 
145 
148 
151 
152  /* These next two scale factors are intended to compensate plotters
153  * (mainly printers) X and Y scale error. Therefore they are expected very
154  * near 1.0; only X and Y dimensions are adjusted: circles are plotted as
155  * circles, even if X and Y fine scale differ; because of this it is mostly
156  * useful for printers: postscript plots would be best adjusted using
157  * the prologue (that would change the whole output matrix
158  */
159 
162 
167 
170  double m_HPGLPenDiam;
171  COLOR4D m_color;
173 
174 public:
175  PCB_PLOT_PARAMS();
176 
177  void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; }
178  bool GetSkipPlotNPTH_Pads() const { return m_skipNPTH_Pads; }
179 
180  void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 ) const;
181  void Parse( PCB_PLOT_PARAMS_PARSER* aParser );
182 
190  bool IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams, bool aCompareOnlySavedPrms ) const;
191 
192  void SetColor( COLOR4D aVal ) { m_color = aVal; }
193  COLOR4D GetColor() const { return m_color; }
194 
195  void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; }
196  PlotTextMode GetTextMode() const { return m_textMode; }
197 
198  void SetPlotMode( EDA_DRAW_MODE_T aPlotMode ) { m_plotMode = aPlotMode; }
200 
201  void SetDXFPlotPolygonMode( bool aFlag ) { m_DXFplotPolygonMode = aFlag; }
203 
205  {
206  m_DXFplotUnits = aUnit;
207  }
208 
210  {
211  return m_DXFplotUnits;
212  }
213 
216 
217  void SetScale( double aVal ) { m_scale = aVal; }
218  double GetScale() const { return m_scale; }
219 
220  void SetFineScaleAdjustX( double aVal ) { m_fineScaleAdjustX = aVal; }
221  double GetFineScaleAdjustX() const { return m_fineScaleAdjustX; }
222  void SetFineScaleAdjustY( double aVal ) { m_fineScaleAdjustY = aVal; }
223  double GetFineScaleAdjustY() const { return m_fineScaleAdjustY; }
224  void SetWidthAdjust( int aVal ) { m_widthAdjust = aVal; }
225  int GetWidthAdjust() const { return m_widthAdjust; }
226 
227  void SetAutoScale( bool aFlag ) { m_autoScale = aFlag; }
228  bool GetAutoScale() const { return m_autoScale; }
229 
230  void SetMirror( bool aFlag ) { m_mirror = aFlag; }
231  bool GetMirror() const { return m_mirror; }
232 
233  void SetPlotPadsOnSilkLayer( bool aFlag ) { m_plotPadsOnSilkLayer = aFlag; }
235 
236  void SetPlotInvisibleText( bool aFlag ) { m_plotInvisibleText = aFlag; }
237  bool GetPlotInvisibleText() const { return m_plotInvisibleText; }
238  void SetPlotValue( bool aFlag ) { m_plotValue = aFlag; }
239  bool GetPlotValue() const { return m_plotValue; }
240  void SetPlotReference( bool aFlag ) { m_plotReference = aFlag; }
241  bool GetPlotReference() const { return m_plotReference; }
242 
243  void SetNegative( bool aFlag ) { m_negative = aFlag; }
244  bool GetNegative() const { return m_negative; }
245 
246  void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; }
248 
249  void SetPlotFrameRef( bool aFlag ) { m_plotFrameRef = aFlag; }
250  bool GetPlotFrameRef() const { return m_plotFrameRef; }
251 
252  void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; }
253  bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; }
254 
255  void SetFormat( PlotFormat aFormat ) { m_format = aFormat; }
256  PlotFormat GetFormat() const { return m_format; }
257 
258  void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; }
259  wxString GetOutputDirectory() const { return m_outputDirectory; }
260 
261  void SetUseGerberX2format( bool aUse ) { m_useGerberX2format = aUse; }
262  bool GetUseGerberX2format() const { return m_useGerberX2format; }
263 
266 
267  void SetCreateGerberJobFile( bool aCreate ) { m_createGerberJobFile = aCreate; }
269 
272 
273  void SetGerberPrecision( int aPrecision );
274  int GetGerberPrecision() const { return m_gerberPrecision; }
275 
280  static int GetGerberDefaultPrecision() { return 6; }
281 
282  void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; };
284 
285  void SetLayerSelection( LSET aSelection ) { m_layerSelection = aSelection; };
287 
288  void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; };
289  bool GetUseAuxOrigin() const { return m_useAuxOrigin; };
290 
291  void SetScaleSelection( int aSelection ) { m_scaleSelection = aSelection; };
292  int GetScaleSelection() const { return m_scaleSelection; };
293 
294  void SetA4Output( int aForce ) { m_A4Output = aForce; };
295  bool GetA4Output() const { return m_A4Output; };
296 
297  // For historical reasons, this parameter is stored in mils
298  // (but is in mm in hpgl files...)
299  double GetHPGLPenDiameter() const { return m_HPGLPenDiam; };
300  bool SetHPGLPenDiameter( double aValue );
301 
302  // This parameter is always in cm, due to hpgl file format constraint
303  int GetHPGLPenSpeed() const { return m_HPGLPenSpeed; };
304  bool SetHPGLPenSpeed( int aValue );
305 
306  void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; }
307  int GetHPGLPenNum() const { return m_HPGLPenNum; }
308 
309  int GetLineWidth() const { return m_lineWidth; };
310  bool SetLineWidth( int aValue );
311 };
312 
313 
319 extern int g_DrawDefaultLineThickness;
320 
321 #endif // PCB_PLOT_PARAMS_H_
double m_fineScaleAdjustX
fine scale adjust X axis
DXF_PLOTTER::DXF_UNITS m_DXFplotUnits
DXF format: Units to use when plotting the DXF.
void SetTextMode(PlotTextMode aVal)
void SetUseGerberProtelExtensions(bool aUse)
void SetPlotReference(bool aFlag)
void SetExcludeEdgeLayer(bool aFlag)
bool m_plotValue
Enable plotting of part values.
void SetScaleSelection(int aSelection)
void SetIncludeGerberNetlistInfo(bool aUse)
void SetDXFPlotPolygonMode(bool aFlag)
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)
Class PCB_PLOT_PARAMS_PARSER is the parser class for PCB_PLOT_PARAMS.
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
void SetFormat(PlotFormat aFormat)
PlotFormat GetFormat() const
void SetCreateGerberJobFile(bool aCreate)
void SetMirror(bool aFlag)
bool m_plotPadsOnSilkLayer
Allows pads outlines on silkscreen layer (when pads are also on silk screen)
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.
PlotFormat
Enum PlotFormat is the set of supported output plot formats.
Definition: plotter.h:50
Class OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a conve...
Definition: richio.h:327
bool m_useGerberProtelExtensions
When plotting gerber files, use a conventional set of Protel extensions instead of ....
int GetHPGLPenSpeed() const
bool SetHPGLPenSpeed(int aValue)
void SetDrillMarksType(DrillMarksType aVal)
int m_scaleSelection
Scale ratio index (UI only)
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 SetLineWidth(int aValue)
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.
bool GetA4Output() const
int GetGerberPrecision() const
Class LSET is a set of PCB_LAYER_IDs.
static int GetGerberDefaultPrecision()
Default precision of coordinates in Gerber files.
void SetColor(COLOR4D aVal)
bool GetUseGerberProtelExtensions() const
void SetDXFPlotUnits(DXF_PLOTTER::DXF_UNITS aUnit)
bool m_subtractMaskFromSilk
On gerbers 'scrape' away the solder mask from silkscreen (trim silks)
EDA_DRAW_MODE_T
Definition: eda_text.h:59
COLOR4D GetColor() const
double m_fineScaleAdjustY
fine scale adjust Y axis
bool GetIncludeGerberNetlistInfo() const
void SetSkipPlotNPTH_Pads(bool aSkip)
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)
bool GetAutoScale() const
Class PCB_PLOT_PARAMS handles plot parameters and options when plotting/printing a board.
void SetPlotInvisibleText(bool aFlag)
void SetScale(double aVal)
double GetFineScaleAdjustX() const
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.
wxString GetOutputDirectory() const
void SetFineScaleAdjustX(double aVal)
int GetLineWidth() const
int GetHPGLPenNum() const
bool m_createGerberJobFile
generate the auxiliary "job file" in gerber format
void SetPlotPadsOnSilkLayer(bool aFlag)
void SetPlotMode(EDA_DRAW_MODE_T aPlotMode)
bool SetHPGLPenDiameter(double aValue)
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)
EDA_DRAW_MODE_T m_plotMode
FILLED or SKETCH selects how to plot filled objects.
bool GetSubtractMaskFromSilk() const
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.
PlotTextMode
Enum for choosing which kind of text to output with the PSLIKE plotters.
Definition: plotter.h:74
PlotTextMode GetTextMode() const
bool GetPlotInvisibleText() const
void SetAutoScale(bool aFlag)
void SetFineScaleAdjustY(double aVal)
double GetFineScaleAdjustY() const
int GetScaleSelection() const
bool GetPlotPadsOnSilkLayer() const
int m_HPGLPenSpeed
HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
bool GetNegative() const
bool GetUseAuxOrigin() const
LSET GetLayerSelection() const
void Parse(PCB_PLOT_PARAMS_PARSER *aParser)
DXF_PLOTTER::DXF_UNITS GetDXFPlotUnits() const
PlotTextMode m_textMode
Choose how represent text with PS, PDF and DXF drivers.
DrillMarksType GetDrillMarksType() const
bool GetPlotReference() const
PlotFormat m_format
Plot format type (chooses the driver to be used)
DrillMarksType m_drillMarks
Holes can be not plotted, have a small mark or plotted in actual size.
int m_lineWidth
The default line width (used to draw items having no defined width)
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
EDA_DRAW_MODE_T GetPlotMode() const
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39