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-2015 KiCad Developers, see change_log.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 <plot_common.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 
59 
62 
65 
68 
71 
74 
76  double m_scale;
77 
79  bool m_mirror;
80 
82  bool m_negative;
83 
86 
89 
92 
95 
99 
102 
105 
111 
114 
117 
120 
123 
126 
129 
132 
135 
139 
140  /* These next two scale factors are intended to compensate plotters
141  * (mainly printers) X and Y scale error. Therefore they are expected very
142  * near 1.0; only X and Y dimensions are adjusted: circles are plotted as
143  * circles, even if X and Y fine scale differ; because of this it is mostly
144  * useful for printers: postscript plots would be best adjusted using
145  * the prologue (that would change the whole output matrix */
146 
149 
154 
161 
162 public:
163  PCB_PLOT_PARAMS();
164 
165  void SetSkipPlotNPTH_Pads( bool aSkip ) { m_skipNPTH_Pads = aSkip; }
166  bool GetSkipPlotNPTH_Pads() const { return m_skipNPTH_Pads; }
167 
168  void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 )
169  const throw( IO_ERROR );
170  void Parse( PCB_PLOT_PARAMS_PARSER* aParser ) throw( PARSE_ERROR, IO_ERROR );
171 
172  bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
173  bool operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
174 
175  void SetColor( COLOR4D aVal ) { m_color = aVal; }
176  COLOR4D GetColor() const { return m_color; }
177 
178  void SetReferenceColor( COLOR4D aVal ) { m_referenceColor = aVal; }
180 
181  void SetValueColor( COLOR4D aVal ) { m_valueColor = aVal; }
182  COLOR4D GetValueColor() const { return m_valueColor; }
183 
184  void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; }
185  PlotTextMode GetTextMode() const { return m_textMode; }
186 
187  void SetPlotMode( EDA_DRAW_MODE_T aPlotMode ) { m_plotMode = aPlotMode; }
189 
190  void SetPlotOutlineMode( bool aFlag ) { m_plotOutlineMode = aFlag; }
191  bool GetPlotOutlineMode() const { return m_plotOutlineMode; }
192 
193  void SetDrillMarksType( DrillMarksType aVal ) { m_drillMarks = aVal; }
195 
196  void SetScale( double aVal ) { m_scale = aVal; }
197  double GetScale() const { return m_scale; }
198 
199  void SetFineScaleAdjustX( double aVal ) { m_fineScaleAdjustX = aVal; }
200  double GetFineScaleAdjustX() const { return m_fineScaleAdjustX; }
201  void SetFineScaleAdjustY( double aVal ) { m_fineScaleAdjustY = aVal; }
202  double GetFineScaleAdjustY() const { return m_fineScaleAdjustY; }
203  void SetWidthAdjust( int aVal ) { m_widthAdjust = aVal; }
204  int GetWidthAdjust() const { return m_widthAdjust; }
205 
206  void SetAutoScale( bool aFlag ) { m_autoScale = aFlag; }
207  bool GetAutoScale() const { return m_autoScale; }
208 
209  void SetMirror( bool aFlag ) { m_mirror = aFlag; }
210  bool GetMirror() const { return m_mirror; }
211 
212  void SetPlotPadsOnSilkLayer( bool aFlag ) { m_plotPadsOnSilkLayer = aFlag; }
214 
215  void SetPlotInvisibleText( bool aFlag ) { m_plotInvisibleText = aFlag; }
216  bool GetPlotInvisibleText() const { return m_plotInvisibleText; }
217  void SetPlotValue( bool aFlag ) { m_plotValue = aFlag; }
218  bool GetPlotValue() const { return m_plotValue; }
219  void SetPlotReference( bool aFlag ) { m_plotReference = aFlag; }
220  bool GetPlotReference() const { return m_plotReference; }
221 
222  void SetNegative( bool aFlag ) { m_negative = aFlag; }
223  bool GetNegative() const { return m_negative; }
224 
225  void SetPlotViaOnMaskLayer( bool aFlag ) { m_plotViaOnMaskLayer = aFlag; }
227 
228  void SetPlotFrameRef( bool aFlag ) { m_plotFrameRef = aFlag; }
229  bool GetPlotFrameRef() const { return m_plotFrameRef; }
230 
231  void SetExcludeEdgeLayer( bool aFlag ) { m_excludeEdgeLayer = aFlag; }
232  bool GetExcludeEdgeLayer() const { return m_excludeEdgeLayer; }
233 
234  void SetFormat( PlotFormat aFormat ) { m_format = aFormat; }
235  PlotFormat GetFormat() const { return m_format; }
236 
237  void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; }
238  wxString GetOutputDirectory() const { return m_outputDirectory; }
239 
240  void SetUseGerberAttributes( bool aUse ) { m_useGerberAttributes = aUse; }
242 
243  void SetIncludeGerberNetlistInfo( bool aUse ) { m_includeGerberNetlistInfo = aUse; }
245 
246  void SetUseGerberProtelExtensions( bool aUse ) { m_useGerberProtelExtensions = aUse; }
248 
249  void SetGerberPrecision( int aPrecision );
250  int GetGerberPrecision() const { return m_gerberPrecision; }
251 
256  static int GetGerberDefaultPrecision() { return 6; }
257 
258  void SetSubtractMaskFromSilk( bool aSubtract ) { m_subtractMaskFromSilk = aSubtract; };
260 
261  void SetLayerSelection( LSET aSelection ) { m_layerSelection = aSelection; };
263 
264  void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; };
265  bool GetUseAuxOrigin() const { return m_useAuxOrigin; };
266 
267  void SetScaleSelection( int aSelection ) { m_scaleSelection = aSelection; };
268  int GetScaleSelection() const { return m_scaleSelection; };
269 
270  void SetA4Output( int aForce ) { m_A4Output = aForce; };
271  bool GetA4Output() const { return m_A4Output; };
272 
273  int GetHPGLPenDiameter() const { return m_HPGLPenDiam; };
274  bool SetHPGLPenDiameter( int aValue );
275  int GetHPGLPenSpeed() const { return m_HPGLPenSpeed; };
276  bool SetHPGLPenSpeed( int aValue );
277  void SetHPGLPenNum( int aVal ) { m_HPGLPenNum = aVal; }
278  int GetHPGLPenNum() const { return m_HPGLPenNum; }
279 
280  int GetLineWidth() const { return m_lineWidth; };
281  bool SetLineWidth( int aValue );
282 };
283 
284 
290 extern int g_DrawDefaultLineThickness;
291 
292 #endif // PCB_PLOT_PARAMS_H_
double m_fineScaleAdjustX
fine scale adjust X axis
void SetTextMode(PlotTextMode aVal)
void SetUseGerberProtelExtensions(bool aUse)
void SetPlotReference(bool aFlag)
void SetExcludeEdgeLayer(bool aFlag)
bool GetUseGerberProtelExtensions() const
bool m_plotValue
Enable plotting of part values.
void SetScaleSelection(int aSelection)
void SetIncludeGerberNetlistInfo(bool aUse)
bool GetMirror() const
bool GetSubtractMaskFromSilk() const
int g_DrawDefaultLineThickness
Default line thickness in PCnew units used to draw or plot items having a default thickness line valu...
bool GetAutoScale() const
int GetHPGLPenDiameter() const
double GetScale() const
void SetGerberPrecision(int aPrecision)
void SetPlotViaOnMaskLayer(bool aFlag)
wxString m_outputDirectory
Output directory for plot files (usually relative to the board file)
bool m_mirror
Mirror the plot around the X axis.
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_plotOutlineMode
Plot lines in outline mode.
PlotFormat
Enum PlotFormat is the set of supported output plot formats.
Definition: plot_common.h:49
void SetReferenceColor(COLOR4D aVal)
bool GetUseGerberAttributes() const
bool m_excludeEdgeLayer
If false always plot (merge) the pcb edge layer on other layers.
void SetFormat(PlotFormat aFormat)
void SetMirror(bool aFlag)
bool m_plotPadsOnSilkLayer
Allows pads outlines on silkscreen layer (when pads are also on silk screen)
double m_scale
Global scale factor, 1.0 plots a board with its actual size.
bool m_plotReference
Enable plotting of part references.
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 gerbers use a conventional set of Protel extensions instead of appending a suffix to th...
bool SetHPGLPenSpeed(int aValue)
bool GetUseAuxOrigin() const
void SetDrillMarksType(DrillMarksType aVal)
LSET GetLayerSelection() const
int m_scaleSelection
Scale ratio index (UI only)
Definition of base KiCad text object.
bool m_negative
Plot in negative color (supported only by some drivers)
COLOR4D m_valueColor
Color for plotting values.
bool GetPlotValue() const
double GetFineScaleAdjustX() const
void SetA4Output(int aForce)
bool m_plotFrameRef
True to plot/print frame references.
bool SetHPGLPenDiameter(int aValue)
bool SetLineWidth(int aValue)
bool m_includeGerberNetlistInfo
Include netlist info (only in Gerber X2 format) (chapter ? in revision ?)
void SetPlotValue(bool aFlag)
bool GetA4Output() const
bool m_useGerberAttributes
Include attributes from the Gerber X2 format (chapter 5 in revision J2)
bool GetExcludeEdgeLayer() const
bool m_plotInvisibleText
Force plotting of fields marked invisible.
void SetPlotFrameRef(bool aFlag)
bool m_autoScale
When true set the scale to fit the board in the page.
wxString GetOutputDirectory() const
DrillMarksType GetDrillMarksType() const
bool m_A4Output
Autoscale the plot to fit an A4 (landscape?) sheet.
bool GetIncludeGerberNetlistInfo() const
Class LSET is a set of PCB_LAYER_IDs.
static int GetGerberDefaultPrecision()
Default precision of coordinates in Gerber files.
void SetColor(COLOR4D aVal)
int GetLineWidth() const
PlotTextMode
Enum for choosing which kind of text to output with the PSLIKE plotters.
Definition: plot_common.h:72
int GetHPGLPenNum() const
bool m_subtractMaskFromSilk
On gerbers 'scrape' away the solder mask from silkscreen (trim silks)
EDA_DRAW_MODE_T
Definition: eda_text.h:62
PlotTextMode GetTextMode() const
double m_fineScaleAdjustY
fine scale adjust Y axis
COLOR4D m_referenceColor
Color for plotting references.
COLOR4D GetReferenceColor() const
void SetSkipPlotNPTH_Pads(bool aSkip)
void SetSubtractMaskFromSilk(bool aSubtract)
bool GetPlotViaOnMaskLayer() const
int GetScaleSelection() const
void SetPlotOutlineMode(bool aFlag)
Common plot library Plot settings, and plotting engines (Postscript, Gerber, HPGL and DXF) ...
bool m_plotViaOnMaskLayer
True if vias are drawn on Mask layer (ie untented, exposed by mask)
void SetOutputDirectory(wxString aDir)
bool GetPlotReference() const
PlotFormat GetFormat() const
void SetUseGerberAttributes(bool aUse)
Class PCB_PLOT_PARAMS handles plot parameters and options when plotting/printing a board...
void SetPlotInvisibleText(bool aFlag)
void SetScale(double aVal)
COLOR4D GetColor() 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 m_useAuxOrigin
Plot gerbers using auxiliary (drill) origin instead of page coordinates.
void SetFineScaleAdjustX(double aVal)
void SetValueColor(COLOR4D aVal)
void SetPlotPadsOnSilkLayer(bool aFlag)
void SetPlotMode(EDA_DRAW_MODE_T aPlotMode)
int m_HPGLPenNum
HPGL only: pen number selection(1 to 9)
COLOR4D m_color
Color for plotting the current layer.
bool GetSkipPlotNPTH_Pads() const
Struct PARSE_ERROR contains a filename or source description, a problem input line, a line number, a byte offset, and an error message which contains the the caller's report and his call site information: CPP source file, function, and line number.
Definition: ki_exception.h:94
LSET m_layerSelection
Set of layers to plot.
bool GetPlotInvisibleText() const
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 GetNegative() const
bool GetPlotFrameRef() const
int GetHPGLPenSpeed() const
EDA_DRAW_MODE_T GetPlotMode() const
bool GetPlotPadsOnSilkLayer() const
void SetAutoScale(bool aFlag)
void SetFineScaleAdjustY(double aVal)
COLOR4D GetValueColor() const
int m_HPGLPenSpeed
HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
void Format(OUTPUTFORMATTER *aFormatter, int aNestLevel, int aControl=0) const
void Parse(PCB_PLOT_PARAMS_PARSER *aParser)
PlotTextMode m_textMode
Choose how represent text with PS, PDF and DXF drivers.
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
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 for the frame and in LINE mode)
int m_HPGLPenDiam
HPGL only: pen diameter in MILS, useful to fill areas.
int m_gerberPrecision
precision of coordinates in Gerber files: accepted 5 or 6 when units are in mm (6 or 7 in inches...
bool GetPlotOutlineMode() const
double GetFineScaleAdjustY() const
int GetWidthAdjust() const
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
int GetGerberPrecision() const