35 #define PLOT_LINEWIDTH_DEFAULT ( DEFAULT_TEXT_WIDTH * IU_PER_MM ) 37 #define HPGL_PEN_DIAMETER_MIN 0 38 #define HPGL_PEN_DIAMETER_MAX 100.0 // Unit = mil 39 #define HPGL_PEN_SPEED_MIN 1 // this param is always in cm/s 40 #define HPGL_PEN_SPEED_MAX 99 // this param is always in cm/s 41 #define HPGL_PEN_NUMBER_MIN 1 42 #define HPGL_PEN_NUMBER_MAX 16 44 #define SVG_PRECISION_MIN 3U 45 #define SVG_PRECISION_MAX 6U 46 #define SVG_PRECISION_DEFAULT 6 54 using namespace PCBPLOTPARAMS_T;
59 return PCB_PLOT_PARAMS_LEXER::TokenName( aTok );
63 static bool setInt(
int* aTarget,
int aValue,
int aMin,
int aMax )
69 else if( aValue > aMax )
73 return (temp == aValue);
77 static bool setDouble(
double* aTarget,
double aValue,
double aMin,
double aMax )
83 else if( aValue > aMax )
87 return (temp == aValue);
94 m_useGerberProtelExtensions =
false;
95 m_gerberDisableApertMacros =
false;
96 m_useGerberX2format =
true;
97 m_includeGerberNetlistInfo =
true;
98 m_createGerberJobFile =
true;
102 m_svgUseInch =
false;
103 m_excludeEdgeLayer =
true;
104 m_plotFrameRef =
false;
105 m_plotViaOnMaskLayer =
false;
107 m_DXFplotPolygonMode =
true;
109 m_useAuxOrigin =
false;
115 m_plotReference =
true;
117 m_plotInvisibleText =
false;
118 m_sketchPadsOnFabLayers =
false;
119 m_subtractMaskFromSilk =
false;
122 m_drillMarks = SMALL_DRILL_SHAPE;
125 m_scaleSelection = 1;
126 m_fineScaleAdjustX = 1.0;
127 m_fineScaleAdjustY = 1.0;
130 m_outputDirectory.clear();
136 m_skipNPTH_Pads =
false;
140 m_default_colors = std::make_shared<COLOR_SETTINGS>();
141 m_colors = m_default_colors.get();
157 m_svgUseInch = aUseInch;
163 int aNestLevel,
int aControl )
const 170 aFormatter->
Print( aNestLevel+1,
"(%s 0x%s)\n",
getTokenName( T_layerselection ),
171 m_layerSelection.FmtHex().c_str() );
173 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_disableapertmacros ),
174 m_gerberDisableApertMacros ? trueStr : falseStr );
176 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_usegerberextensions ),
177 m_useGerberProtelExtensions ? trueStr : falseStr );
179 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_usegerberattributes ),
180 GetUseGerberX2format() ? trueStr : falseStr );
182 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_usegerberadvancedattributes ),
183 GetIncludeGerberNetlistInfo() ? trueStr : falseStr );
185 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_creategerberjobfile ),
186 GetCreateGerberJobFile() ? trueStr : falseStr );
190 aFormatter->
Print( aNestLevel+1,
"(%s %d)\n",
195 m_svgUseInch ? trueStr : falseStr );
199 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_excludeedgelayer ),
200 m_excludeEdgeLayer ? trueStr : falseStr );
202 m_plotFrameRef ? trueStr : falseStr );
204 m_plotViaOnMaskLayer ? trueStr : falseStr );
206 GetPlotMode() ==
SKETCH ? 2 : 1 );
208 m_useAuxOrigin ? trueStr : falseStr );
220 m_DXFplotPolygonMode ? trueStr : falseStr );
221 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_dxfimperialunits ),
223 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_dxfusepcbnewfont ),
227 m_negative ? trueStr : falseStr );
229 m_A4Output ? trueStr : falseStr );
231 m_plotReference ? trueStr : falseStr );
233 m_plotValue ? trueStr : falseStr );
234 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_plotinvisibletext ),
235 m_plotInvisibleText ? trueStr : falseStr );
237 m_sketchPadsOnFabLayers ? trueStr : falseStr );
238 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_subtractmaskfromsilk ),
239 m_subtractMaskFromSilk ? trueStr : falseStr );
241 static_cast<int>( m_format ) );
243 m_mirror ? trueStr : falseStr );
248 aFormatter->
Print( aNestLevel+1,
"(%s \"%s\")",
getTokenName( T_outputdirectory ),
249 (
const char*) m_outputDirectory.utf8_str() );
250 aFormatter->
Print( 0,
"\n" );
251 aFormatter->
Print( aNestLevel,
")\n" );
257 aParser->
Parse(
this );
315 if( m_format != aPcbPlotParams.
m_format )
317 if( m_mirror != aPcbPlotParams.
m_mirror )
325 if( m_scale != aPcbPlotParams.
m_scale )
357 PCB_PLOT_PARAMS_LEXER( aReader )
363 PCB_PLOT_PARAMS_LEXER( aLine, aSource )
372 while( ( token = NextTok() ) != T_RIGHT )
377 if( token == T_LEFT )
380 if( token == T_pcbplotparams )
383 bool skip_right =
false;
387 case T_layerselection:
389 token = NeedSYMBOLorNUMBER();
391 const std::string& cur = CurStr();
393 if( token == T_NUMBER )
402 else if( cur.find_first_of(
"0x" ) == 0 )
408 Expecting(
"integer or hex layerSelection" );
412 case T_disableapertmacros:
416 case T_usegerberextensions:
420 case T_usegerberattributes:
424 case T_usegerberadvancedattributes:
428 case T_creategerberjobfile:
432 case T_gerberprecision:
449 case T_excludeedgelayer:
469 case T_hpglpennumber:
479 case T_hpglpendiameter:
483 case T_hpglpenoverlay:
488 case T_dxfpolygonmode:
492 case T_dxfimperialunits:
497 case T_dxfusepcbnewfont:
510 case T_plotreference:
518 case T_plotinvisibletext:
522 case T_sketchpadsonfab:
526 case T_subtractmaskfromsilk:
531 aPcbPlotParams->
m_format = static_cast<PLOT_FORMAT>(
541 aPcbPlotParams->
m_drillMarks = static_cast<PCB_PLOT_PARAMS::DrillMarksType>
545 case T_scaleselection:
549 case T_outputdirectory:
550 NeedSYMBOLorNUMBER();
568 T token = NeedSYMBOL();
570 if( token != T_false && token != T_true )
571 Expecting(
"true|false" );
573 return token == T_true;
581 if( token != T_NUMBER )
582 Expecting( T_NUMBER );
584 int val = atoi( CurText() );
588 else if( val > aMax )
599 if( token != T_NUMBER )
600 Expecting( T_NUMBER );
602 double val = strtod( CurText(),
NULL );
613 while( ( token = NextTok() ) != T_EOF )
615 if( token == T_LEFT )
618 if( token == T_RIGHT )
double m_fineScaleAdjustX
fine scale adjust X axis
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
#define HPGL_PEN_NUMBER_MAX
bool m_plotValue
Enable plotting of part values.
#define HPGL_PEN_SPEED_MAX
static bool setDouble(double *aTarget, double aValue, double aMin, double aMax)
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
double parseDouble()
Function parseDouble parses a double.
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
void SetGerberPrecision(int aPrecision)
wxString m_outputDirectory
Output directory for plot files (usually relative to the board file)
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
bool m_mirror
Mirror the plot around the X axis.
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
DXF_UNITS m_DXFplotUnits
DXF format: Units to use when plotting the DXF.
static const int gbrDefaultPrecision
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.
bool m_useGerberProtelExtensions
When plotting gerber files, use a conventional set of Protel extensions instead of ....
bool SetHPGLPenSpeed(int aValue)
OUTLINE_MODE m_plotMode
FILLED or SKETCH selects how to plot filled objects.
int m_scaleSelection
Scale ratio index (UI only)
bool m_negative
Plot in negative color (supported only by some drivers)
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.
This file contains miscellaneous commonly used macros and functions.
bool m_includeGerberNetlistInfo
Include netlist info (only in Gerber X2 format) (chapter ? in revision ?)
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...
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.
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.
PCB_PLOT_PARAMS_PARSER(LINE_READER *aReader)
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 m_subtractMaskFromSilk
On gerbers 'scrape' away the solder mask from silkscreen (trim silks)
#define HPGL_PEN_DIAMETER_MAX
double m_fineScaleAdjustY
fine scale adjust Y axis
static bool setInt(int *aTarget, int aValue, int aMin, int aMax)
#define HPGL_PEN_DIAMETER_MIN
bool m_plotViaOnMaskLayer
True if vias are drawn on Mask layer (ie untented, exposed by mask)
static const char * getTokenName(T aTok)
PCB_PLOT_PARAMS handles plot parameters and options when plotting/printing a board.
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...
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)
#define SVG_PRECISION_MAX
bool m_createGerberJobFile
generate the auxiliary "job file" in gerber format
bool SetHPGLPenDiameter(double aValue)
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)
LSET m_layerSelection
Set of layers to plot.
void skipCurrent()
Function skipCurrent Skip the current token level, i.e search for the RIGHT parenthesis which closes ...
Board layer functions and definitions.
#define HPGL_PEN_NUMBER_MIN
#define HPGL_PEN_SPEED_MIN
const T & Clamp(const T &lower, const T &value, const T &upper)
Function Clamp limits value within the range lower <= value <= upper.
PLOT_TEXT_MODE m_textMode
Choose how represent text with PS, PDF and DXF drivers.
int m_HPGLPenSpeed
HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
int parseInt(int aMin, int aMax)
Function parseInt parses an integer and constrains it between two values.
#define SVG_PRECISION_DEFAULT
void Parse(PCB_PLOT_PARAMS *aPcbPlotParams)
void Parse(PCB_PLOT_PARAMS_PARSER *aParser)
#define SVG_PRECISION_MIN
int ParseHex(const char *aStart, int aCount)
Convert the output of FmtHex() and replaces this set's values with those given in the input string.
static constexpr int Millimeter2iu(double mm)
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,...