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
39#define HPGL_PEN_SPEED_MIN 1
40#define HPGL_PEN_SPEED_MAX 99
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 4
54using namespace PCBPLOTPARAMS_T;
59 return PCB_PLOT_PARAMS_LEXER::TokenName( aTok );
63static bool setInt(
int* aTarget,
int aValue,
int aMin,
int aMax )
69 else if( aValue > aMax )
73 return ( temp == aValue );
77static bool setDouble(
double* aTarget,
double aValue,
double aMin,
double aMax )
83 else if( aValue > aMax )
87 return ( temp == aValue );
168 int aNestLevel,
int aControl )
const
171 [](
bool aBool ) ->
const char*
173 return aBool ?
"true" :
"false";
176 aFormatter->
Print( aNestLevel,
"(pcbplotparams\n" );
178 aFormatter->
Print( aNestLevel+1,
"(layerselection 0x%s)\n",
181 aFormatter->
Print( aNestLevel+1,
"(plot_on_all_layers_selection 0x%s)\n",
184 aFormatter->
Print( aNestLevel+1,
"(disableapertmacros %s)\n",
187 aFormatter->
Print( aNestLevel+1,
"(usegerberextensions %s)\n",
190 aFormatter->
Print( aNestLevel+1,
"(usegerberattributes %s)\n",
193 aFormatter->
Print( aNestLevel+1,
"(usegerberadvancedattributes %s)\n",
196 aFormatter->
Print( aNestLevel+1,
"(creategerberjobfile %s)\n",
223 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_dxfimperialunits ),
225 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_dxfusepcbnewfont ),
233 aFormatter->
Print( aNestLevel+1,
"(plotvalue %s)\n", printBool(
m_plotValue ) );
235 aFormatter->
Print( aNestLevel+1,
"(sketchpadsonfab %s)\n",
237 aFormatter->
Print( aNestLevel+1,
"(subtractmaskfromsilk %s)\n",
239 aFormatter->
Print( aNestLevel+1,
"(outputformat %d)\n",
static_cast<int>(
m_format ) );
240 aFormatter->
Print( aNestLevel+1,
"(mirror %s)\n", printBool(
m_mirror ) );
243 aFormatter->
Print( aNestLevel+1,
"(outputdirectory \"%s\")",
245 aFormatter->
Print( 0,
"\n" );
246 aFormatter->
Print( aNestLevel,
")\n" );
252 aParser->
Parse(
this );
392 PCB_PLOT_PARAMS_LEXER( aReader )
398 PCB_PLOT_PARAMS_LEXER( aLine, aSource )
407 while( ( token = NextTok() ) != T_RIGHT )
412 if( token == T_LEFT )
415 if( token == T_pcbplotparams )
418 bool skip_right =
false;
422 case T_layerselection:
424 token = NeedSYMBOLorNUMBER();
426 const std::string& cur = CurStr();
428 if( token == T_NUMBER )
436 else if( cur.find_first_of(
"0x" ) == 0 )
443 Expecting(
"integer or hex layerSelection" );
449 case T_plot_on_all_layers_selection:
451 token = NeedSYMBOLorNUMBER();
453 const std::string& cur = CurStr();
455 if( cur.find_first_of(
"0x" ) == 0 )
463 Expecting(
"hex plot_on_all_layers_selection" );
469 case T_disableapertmacros:
473 case T_usegerberextensions:
477 case T_usegerberattributes:
481 case T_usegerberadvancedattributes:
485 case T_creategerberjobfile:
489 case T_gerberprecision:
494 case T_dashed_line_dash_ratio:
498 case T_dashed_line_gap_ratio:
514 case T_excludeedgelayer:
536 case T_hpglpennumber:
544 case T_hpglpendiameter:
548 case T_hpglpenoverlay:
553 case T_dxfpolygonmode:
557 case T_dxfimperialunits:
562 case T_dxfusepcbnewfont:
575 case T_plotreference:
583 case T_plotinvisibletext:
587 case T_sketchpadsonfab:
591 case T_subtractmaskfromsilk:
609 case T_scaleselection:
613 case T_outputdirectory:
614 NeedSYMBOLorNUMBER();
632 T token = NeedSYMBOL();
634 if( token != T_false && token != T_true )
635 Expecting(
"true|false" );
637 return token == T_true;
645 if( token != T_NUMBER )
646 Expecting( T_NUMBER );
648 int val = atoi( CurText() );
652 else if( val > aMax )
663 if( token != T_NUMBER )
664 Expecting( T_NUMBER );
675 while( ( token = NextTok() ) != T_EOF )
677 if( token == T_LEFT )
680 if( token == T_RIGHT )
constexpr EDA_IU_SCALE pcbIUScale
double parseDouble()
Parse the current token as an ASCII numeric string with possible leading whitespace into a double pre...
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
LSET is a set of PCB_LAYER_IDs.
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 LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
std::string FmtHex() const
Return a hex string showing contents of this LSEQ.
The parser for PCB_PLOT_PARAMS.
void skipCurrent()
Skip the current token level.
int parseInt(int aMin, int aMax)
Parse an integer and constrains it between two values.
PCB_PLOT_PARAMS_PARSER(LINE_READER *aReader)
double parseDouble()
Parse a double precision floating point number.
void Parse(PCB_PLOT_PARAMS *aPcbPlotParams)
Parameters and options when plotting/printing a board.
bool m_sketchPadsOnFabLayers
Plots pads outlines on fab layers.
int m_HPGLPenNum
HPGL only: pen number selection(1 to 9)
DXF_UNITS m_DXFplotUnits
DXF format: Units to use when plotting the DXF.
double m_dashedLineGapRatio
int m_gerberPrecision
precision of coordinates in Gerber files: accepted 5 or 6 when units are in mm (6 or 7 in inches,...
std::shared_ptr< COLOR_SETTINGS > m_default_colors
Dummy colors object that can be created if there is no Pgm context.
OUTLINE_MODE m_plotMode
FILLED or SKETCH selects how to plot filled objects.
bool m_A4Output
Autoscale the plot to fit an A4 (landscape?) sheet.
int m_scaleSelection
Scale ratio index (UI only)
PLOT_TEXT_MODE m_textMode
Choose how represent text with PS, PDF and DXF drivers.
bool m_plotValue
Enable plotting of part values.
wxString m_outputDirectory
Output directory for plot files (usually relative to the board file)
bool m_autoScale
When true set the scale to fit the board in the page.
bool m_useGerberProtelExtensions
When plotting gerber files, use a conventional set of Protel extensions instead of ....
int m_HPGLPenSpeed
HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
bool GetCreateGerberJobFile() const
bool m_useAuxOrigin
Plot gerbers using auxiliary (drill) origin instead of absolute coordinates.
double m_scale
Global scale factor, 1.0 plots a board with its actual size.
int m_widthAdjust
This width factor is intended to compensate PS printers/ plotters that do not strictly obey line widt...
bool SetHPGLPenDiameter(double aValue)
double m_fineScaleAdjustX
fine scale adjust X axis
LSET m_plotOnAllLayersSelection
Set of layers that get plotted on each of the layers to plot.
double m_dashedLineDashRatio
void Format(OUTPUTFORMATTER *aFormatter, int aNestLevel, int aControl=0) const
bool m_plotFrameRef
True to plot/print frame references.
void SetGerberPrecision(int aPrecision)
bool m_blackAndWhite
Plot in black and white only.
bool SetHPGLPenSpeed(int aValue)
bool m_plotInvisibleText
Force plotting of fields marked invisible.
PLOT_FORMAT m_format
Plot format type (chooses the driver to be used)
bool m_createGerberJobFile
generate the auxiliary "job file" in gerber format
bool m_plotReference
Enable plotting of part references.
double m_fineScaleAdjustY
fine scale adjust Y axis
double m_HPGLPenDiam
HPGL only: pen diameter in MILS, useful to fill areas However, it is in mm in hpgl files.
bool m_DXFplotPolygonMode
DXF format: Plot items in outline (polygon) mode.
bool m_gerberDisableApertMacros
Disable aperture macros in Gerber format (only for broken Gerber readers) Ideally,...
void Parse(PCB_PLOT_PARAMS_PARSER *aParser)
bool m_subtractMaskFromSilk
On gerbers 'scrape' away the solder mask from silkscreen (trim silks)
COLOR_SETTINGS * m_colors
Pointer to active color settings to be used for plotting.
bool GetUseGerberX2format() const
bool m_mirror
Mirror the plot around the X axis.
bool IsSameAs(const PCB_PLOT_PARAMS &aPcbPlotParams) const
Compare current settings to aPcbPlotParams, including not saved parameters in brd file.
bool m_includeGerberNetlistInfo
Include netlist info (only in Gerber X2 format) (chapter ? in revision ?)
unsigned m_svgPrecision
precision of coordinates in SVG files: accepted 3 - 6 6 is the internal resolution of Pcbnew
bool GetIncludeGerberNetlistInfo() const
void SetPlotMode(OUTLINE_MODE aPlotMode)
double GetDashedLineGapRatio() const
double GetDashedLineDashRatio() const
void SetSvgPrecision(unsigned aPrecision)
DRILL_MARKS m_drillMarks
Holes can be not plotted, have a small mark or plotted in actual size.
bool m_useGerberX2format
Include attributes from the Gerber X2 format (chapter 5 in revision J2)
bool m_negative
Plot in negative color (supported only by some drivers)
bool m_plotViaOnMaskLayer
True if vias are drawn on Mask layer (ie untented, exposed by mask)
OUTLINE_MODE GetPlotMode() const
LSET m_layerSelection
Set of layers to plot.
This file contains miscellaneous commonly used macros and functions.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
#define HPGL_PEN_NUMBER_MAX
static bool setDouble(double *aTarget, double aValue, double aMin, double aMax)
#define SVG_PRECISION_MIN
#define HPGL_PEN_SPEED_MAX
static bool setInt(int *aTarget, int aValue, int aMin, int aMax)
#define HPGL_PEN_DIAMETER_MIN
static const char * getTokenName(T aTok)
#define HPGL_PEN_DIAMETER_MAX
static const int gbrDefaultPrecision
#define HPGL_PEN_SPEED_MIN
#define HPGL_PEN_NUMBER_MIN
#define SVG_PRECISION_MAX
#define SVG_PRECISION_DEFAULT
DRILL_MARKS
Plots and prints can show holes in pads and vias 3 options are available:
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
PLOT_FORMAT
The set of supported output plot formats.
constexpr int mmToIU(double mm) const
constexpr T Clamp(const T &lower, const T &value, const T &upper)
Limit value within the range lower <= value <= upper.