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 );
172 int aNestLevel,
int aControl )
const
175 [](
bool aBool ) ->
const char*
177 return aBool ?
"true" :
"false";
180 aFormatter->
Print( aNestLevel,
"(pcbplotparams\n" );
182 aFormatter->
Print( aNestLevel+1,
"(layerselection 0x%s)\n",
185 aFormatter->
Print( aNestLevel+1,
"(plot_on_all_layers_selection 0x%s)\n",
188 aFormatter->
Print( aNestLevel+1,
"(disableapertmacros %s)\n",
191 aFormatter->
Print( aNestLevel+1,
"(usegerberextensions %s)\n",
194 aFormatter->
Print( aNestLevel+1,
"(usegerberattributes %s)\n",
197 aFormatter->
Print( aNestLevel+1,
"(usegerberadvancedattributes %s)\n",
200 aFormatter->
Print( aNestLevel+1,
"(creategerberjobfile %s)\n",
225 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_pdf_front_fp_property_popups ),
227 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_pdf_back_fp_property_popups ),
233 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_dxfimperialunits ),
234 printBool(
m_DXFUnits == DXF_UNITS::INCHES ) );
235 aFormatter->
Print( aNestLevel+1,
"(%s %s)\n",
getTokenName( T_dxfusepcbnewfont ),
236 printBool(
m_textMode != PLOT_TEXT_MODE::NATIVE ) );
243 aFormatter->
Print( aNestLevel+1,
"(plotvalue %s)\n", printBool(
m_plotValue ) );
244 aFormatter->
Print( aNestLevel+1,
"(plotfptext %s)\n", printBool(
m_plotFPText ) );
246 aFormatter->
Print( aNestLevel+1,
"(sketchpadsonfab %s)\n",
248 aFormatter->
Print( aNestLevel+1,
"(subtractmaskfromsilk %s)\n",
250 aFormatter->
Print( aNestLevel+1,
"(outputformat %d)\n",
static_cast<int>(
m_format ) );
251 aFormatter->
Print( aNestLevel+1,
"(mirror %s)\n", printBool(
m_mirror ) );
254 aFormatter->
Print( aNestLevel+1,
"(outputdirectory \"%s\")",
256 aFormatter->
Print( 0,
"\n" );
257 aFormatter->
Print( aNestLevel,
")\n" );
263 aParser->
Parse(
this );
412 PCB_PLOT_PARAMS_LEXER( aReader )
418 PCB_PLOT_PARAMS_LEXER( aLine, aSource )
427 while( ( token = NextTok() ) != T_RIGHT )
432 if( token == T_LEFT )
435 if( token == T_pcbplotparams )
438 bool skip_right =
false;
442 case T_layerselection:
444 token = NeedSYMBOLorNUMBER();
446 const std::string& cur = CurStr();
448 if( token == T_NUMBER )
456 else if( cur.find_first_of(
"0x" ) == 0 )
463 Expecting(
"integer or hex layerSelection" );
469 case T_plot_on_all_layers_selection:
471 token = NeedSYMBOLorNUMBER();
473 const std::string& cur = CurStr();
475 if( cur.find_first_of(
"0x" ) == 0 )
483 Expecting(
"hex plot_on_all_layers_selection" );
489 case T_disableapertmacros:
493 case T_usegerberextensions:
497 case T_usegerberattributes:
501 case T_usegerberadvancedattributes:
505 case T_creategerberjobfile:
509 case T_gerberprecision:
514 case T_dashed_line_dash_ratio:
518 case T_dashed_line_gap_ratio:
534 case T_excludeedgelayer:
556 case T_hpglpennumber:
564 case T_hpglpendiameter:
568 case T_hpglpenoverlay:
573 case T_pdf_front_fp_property_popups:
577 case T_pdf_back_fp_property_popups:
581 case T_dxfpolygonmode:
585 case T_dxfimperialunits:
587 : DXF_UNITS::MILLIMETERS;
590 case T_dxfusepcbnewfont:
592 : PLOT_TEXT_MODE::NATIVE;
603 case T_plotreference:
615 case T_plotinvisibletext:
619 case T_sketchpadsonfab:
623 case T_subtractmaskfromsilk:
629 parseInt(
static_cast<int>( PLOT_FORMAT::FIRST_FORMAT ),
630 static_cast<int>( PLOT_FORMAT::LAST_FORMAT ) ) );
641 case T_scaleselection:
645 case T_outputdirectory:
646 NeedSYMBOLorNUMBER();
664 T token = NeedSYMBOL();
666 if( token != T_false && token != T_true )
667 Expecting(
"true|false" );
669 return token == T_true;
677 if( token != T_NUMBER )
678 Expecting( T_NUMBER );
680 int val = atoi( CurText() );
684 else if( val > aMax )
695 if( token != T_NUMBER )
696 Expecting( T_NUMBER );
707 while( ( token = NextTok() ) != T_EOF )
709 if( token == T_LEFT )
712 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)
double m_dashedLineGapRatio
int m_gerberPrecision
Precision of coordinates in Gerber: accepted 5 or 6 when units are in mm, 6 or 7 in inches (but Pcbne...
std::shared_ptr< COLOR_SETTINGS > m_default_colors
Pointer to color settings to be used for plotting.
OUTLINE_MODE m_plotMode
Used to disable NPTH pads plotting on copper layers.
bool m_A4Output
In polygon mode, each item to plot is converted to a polygon and all polygons are merged.
int m_scaleSelection
Scale ratio index (UI only)
PLOT_TEXT_MODE m_textMode
Holes can be not plotted, have a small mark, or be plotted in actual size.
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
Autoscale the plot to fit an A4 (landscape?) sheet.
bool m_useGerberProtelExtensions
On gerbers 'scrape' away the solder mask from silkscreen (trim silks)
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
When true set the scale to fit the board in the page.
int m_widthAdjust
Compensation for PS printers/plotters that do not strictly obey line width settings.
bool SetHPGLPenDiameter(double aValue)
bool m_PDFFrontFPPropertyPopups
Generate PDF property popup menus for footprints.
double m_fineScaleAdjustX
Compensation for printer scale errors (and therefore.
LSET m_plotOnAllLayersSelection
double m_dashedLineDashRatio
void Format(OUTPUTFORMATTER *aFormatter, int aNestLevel, int aControl=0) const
void SetGerberPrecision(int aPrecision)
bool m_blackAndWhite
Plot in negative color (supported only by some drivers)
bool SetHPGLPenSpeed(int aValue)
bool m_plotInvisibleText
Force plotting of fields marked invisible.
bool m_createGerberJobFile
generate the auxiliary "job file" in gerber format
bool m_plotReference
Enable plotting of part references.
double m_fineScaleAdjustY
expected to be very near 1.0).
double m_HPGLPenDiam
HPGL only: pen diameter in MILS, useful to fill areas However, it is in mm in hpgl files.
bool m_gerberDisableApertMacros
Disable aperture macros in Gerber format (only for broken Gerber readers).
void Parse(PCB_PLOT_PARAMS_PARSER *aParser)
bool m_subtractMaskFromSilk
True if vias are drawn on Mask layer (ie untented, exposed by mask)
COLOR_SETTINGS * m_colors
bool GetUseGerberX2format() const
bool m_mirror
Global scale factor, 1.0 plots a board at actual size.
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: accepted 3 - 6; 6 is the internal resolution of Pcbnew.
bool GetIncludeGerberNetlistInfo() const
void SetPlotMode(OUTLINE_MODE aPlotMode)
double GetDashedLineGapRatio() const
bool m_PDFBackFPPropertyPopups
on front and/or back of board
double GetDashedLineDashRatio() const
void SetSvgPrecision(unsigned aPrecision)
DRILL_MARKS m_drillMarks
FILLED or SKETCH for filled objects.
bool m_useGerberX2format
Include attributes from the Gerber X2 format (chapter 5 in revision J2)
bool m_negative
Mirror the plot around the X axis.
bool m_plotDrawingSheet
Plot in black and white only.
bool m_plotViaOnMaskLayer
OUTLINE_MODE GetPlotMode() const
LSET m_layerSelection
Plot format type (chooses the driver to be used)
static bool setDouble(double *aResult, double aValue, double aMin, double aMax)
static bool setInt(int *aResult, int aValue, int aMin, int aMax)
static const char * getTokenName(T aTok)
#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_FORMAT
The set of supported output plot formats.
wxString From_UTF8(const char *cstring)
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.