KiCad PCB EDA Suite
pcb_plot_params.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #include <board_design_settings.h>
25 #include <convert_to_biu.h>
27 #include <macros.h>
28 #include <math/util.h> // for KiROUND
29 #include <pcb_plot_params.h>
30 #include <pcb_plot_params_parser.h>
31 #include <plotter.h>
33 
34 
35 #define PLOT_LINEWIDTH_MIN ( 0.02 * IU_PER_MM ) // min value for default line thickness
36 #define PLOT_LINEWIDTH_MAX ( 2 * IU_PER_MM ) // max value for default line thickness
37 #define PLOT_LINEWIDTH_DEFAULT ( DEFAULT_TEXT_WIDTH * IU_PER_MM )
38 
39 #define HPGL_PEN_DIAMETER_MIN 0
40 #define HPGL_PEN_DIAMETER_MAX 100.0 // Unit = mil
41 #define HPGL_PEN_SPEED_MIN 1 // this param is always in cm/s
42 #define HPGL_PEN_SPEED_MAX 99 // this param is always in cm/s
43 #define HPGL_PEN_NUMBER_MIN 1
44 #define HPGL_PEN_NUMBER_MAX 16
45 
46 #define SVG_PRECISION_MIN 3U
47 #define SVG_PRECISION_MAX 6U
48 #define SVG_PRECISION_DEFAULT 6
49 
50 
56 
57 // default trailing digits in Gerber coordinates, when units are mm
58 // This is also the max usable precision (i.e. internal Pcbnew Units)
59 static const int gbrDefaultPrecision = 6;
60 
61 
62 using namespace PCBPLOTPARAMS_T;
63 
64 
65 static const char* getTokenName( T aTok )
66 {
67  return PCB_PLOT_PARAMS_LEXER::TokenName( aTok );
68 }
69 
70 
71 static bool setInt( int* aTarget, int aValue, int aMin, int aMax )
72 {
73  int temp = aValue;
74 
75  if( aValue < aMin )
76  temp = aMin;
77  else if( aValue > aMax )
78  temp = aMax;
79 
80  *aTarget = temp;
81  return (temp == aValue);
82 }
83 
84 
85 static bool setDouble( double* aTarget, double aValue, double aMin, double aMax )
86 {
87  double temp = aValue;
88 
89  if( aValue < aMin )
90  temp = aMin;
91  else if( aValue > aMax )
92  temp = aMax;
93 
94  *aTarget = temp;
95  return (temp == aValue);
96 }
97 
98 // PCB_PLOT_PARAMS
99 
101 {
102  m_useGerberProtelExtensions = false;
103  m_useGerberX2format = true;
104  m_includeGerberNetlistInfo = true;
105  m_createGerberJobFile = true;
106  m_gerberPrecision = gbrDefaultPrecision;
107  // we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm
108  m_svgPrecision = SVG_PRECISION_DEFAULT;
109  m_svgUseInch = false;
110  m_excludeEdgeLayer = true;
111  m_lineWidth = g_DrawDefaultLineThickness;
112  m_plotFrameRef = false;
113  m_plotViaOnMaskLayer = false;
114  m_plotMode = FILLED;
115  m_DXFplotPolygonMode = true;
116  m_DXFplotUnits = DXF_PLOTTER::DXF_UNITS::INCHES;
117  m_useAuxOrigin = false;
118  m_HPGLPenNum = 1;
119  m_HPGLPenSpeed = 20; // this param is always in cm/s
120  m_HPGLPenDiam = 15; // in mils
121  m_negative = false;
122  m_A4Output = false;
123  m_plotReference = true;
124  m_plotValue = true;
125  m_plotInvisibleText = false;
126  m_sketchPadsOnFabLayers = false;
127  m_subtractMaskFromSilk = false;
128  m_format = PLOT_FORMAT::GERBER;
129  m_mirror = false;
130  m_drillMarks = SMALL_DRILL_SHAPE;
131  m_autoScale = false;
132  m_scale = 1.0;
133  m_scaleSelection = 1;
134  m_fineScaleAdjustX = 1.0;
135  m_fineScaleAdjustY = 1.0;
136  m_widthAdjust = 0.;
137  m_color = BLACK;
138  m_textMode = PLOT_TEXT_MODE::DEFAULT;
139  m_outputDirectory.clear();
140  m_layerSelection = LSET( 7, F_SilkS, B_SilkS, F_Mask, B_Mask,
142  | LSET::AllCuMask();
143  // This parameter controls if the NPTH pads will be plotted or not
144  // it is a "local" parameter
145  m_skipNPTH_Pads = false;
146 
147  m_sketchPadLineWidth = Millimeter2iu( 0.1 ); // line width to plot items in outline mode
148 
149  m_default_colors = std::make_shared<COLOR_SETTINGS>();
150  m_colors = m_default_colors.get();
151 }
152 
154 {
155  // Currently geber files use mm.
156  // accepted precision is only 6 (max value, this is the resolution of Pcbnew)
157  // or 5, min value for professional boards, when 6 creates problems
158  // to board makers.
159 
160  m_gerberPrecision = aPrecision == gbrDefaultPrecision-1 ? gbrDefaultPrecision-1 :
162 }
163 
164 void PCB_PLOT_PARAMS::SetSvgPrecision( unsigned aPrecision, bool aUseInch )
165 {
166  m_svgUseInch = aUseInch;
167  m_svgPrecision = Clamp( SVG_PRECISION_MIN, aPrecision, SVG_PRECISION_MAX );
168 }
169 
170 // PLEASE NOTE: only plot dialog options are processed
172  int aNestLevel, int aControl ) const
173 {
174  const char* falseStr = getTokenName( T_false );
175  const char* trueStr = getTokenName( T_true );
176 
177  aFormatter->Print( aNestLevel, "(%s\n", getTokenName( T_pcbplotparams ) );
178 
179  aFormatter->Print( aNestLevel+1, "(%s 0x%s)\n", getTokenName( T_layerselection ),
180  m_layerSelection.FmtHex().c_str() );
181 
182  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberextensions ),
183  m_useGerberProtelExtensions ? trueStr : falseStr );
184 
185  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberattributes ),
186  GetUseGerberX2format() ? trueStr : falseStr );
187 
188  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberadvancedattributes ),
189  GetIncludeGerberNetlistInfo() ? trueStr : falseStr );
190 
191  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_creategerberjobfile ),
192  GetCreateGerberJobFile() ? trueStr : falseStr );
193 
194  if( m_gerberPrecision != gbrDefaultPrecision ) // save this option only if it is not the default value,
195  // to avoid incompatibility with older Pcbnew version
196  aFormatter->Print( aNestLevel+1, "(%s %d)\n",
197  getTokenName( T_gerberprecision ), m_gerberPrecision );
198 
199  // Svg options
200  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_svguseinch ),
201  m_svgUseInch ? trueStr : falseStr );
202  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_svgprecision ),
203  m_svgPrecision );
204 
205  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_excludeedgelayer ),
206  m_excludeEdgeLayer ? trueStr : falseStr );
207  aFormatter->Print( aNestLevel+1, "(%s %f)\n", getTokenName( T_linewidth ),
208  m_lineWidth / IU_PER_MM );
209  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotframeref ),
210  m_plotFrameRef ? trueStr : falseStr );
211  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_viasonmask ),
212  m_plotViaOnMaskLayer ? trueStr : falseStr );
213  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_mode ),
214  GetPlotMode() == SKETCH ? 2 : 1 ); // Value 0 (LINE mode) no more used
215  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_useauxorigin ),
216  m_useAuxOrigin ? trueStr : falseStr );
217  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpennumber ),
218  m_HPGLPenNum );
219 
220  // Obsolete parameter, pen speed is no more managed, because hpgl format
221  // is now an export format, and for this, pen speed has no meaning
222  // aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpenspeed ),
223  // m_HPGLPenSpeed );
224 
225  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpenspeed ),
226  m_HPGLPenSpeed );
227  aFormatter->Print( aNestLevel+1, "(%s %f)\n", getTokenName( T_hpglpendiameter ),
228  m_HPGLPenDiam );
229  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_psnegative ),
230  m_negative ? trueStr : falseStr );
231  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_psa4output ),
232  m_A4Output ? trueStr : falseStr );
233  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotreference ),
234  m_plotReference ? trueStr : falseStr );
235  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotvalue ),
236  m_plotValue ? trueStr : falseStr );
237  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotinvisibletext ),
238  m_plotInvisibleText ? trueStr : falseStr );
239  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_sketchpadsonfab ),
240  m_sketchPadsOnFabLayers ? trueStr : falseStr );
241  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_subtractmaskfromsilk ),
242  m_subtractMaskFromSilk ? trueStr : falseStr );
243  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_outputformat ),
244  static_cast<int>( m_format ) );
245  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_mirror ),
246  m_mirror ? trueStr : falseStr );
247  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_drillshape ),
248  m_drillMarks );
249  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_scaleselection ),
250  m_scaleSelection );
251  aFormatter->Print( aNestLevel+1, "(%s \"%s\")", getTokenName( T_outputdirectory ),
252  (const char*) m_outputDirectory.utf8_str() );
253  aFormatter->Print( 0, "\n" );
254  aFormatter->Print( aNestLevel, ")\n" );
255 }
256 
257 
259 {
260  aParser->Parse( this );
261 }
262 
263 
264 bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams, bool aCompareOnlySavedPrms ) const
265 {
266  if( m_layerSelection != aPcbPlotParams.m_layerSelection )
267  return false;
268  if( m_useGerberProtelExtensions != aPcbPlotParams.m_useGerberProtelExtensions )
269  return false;
270  if( m_useGerberX2format != aPcbPlotParams.m_useGerberX2format )
271  return false;
272  if( m_includeGerberNetlistInfo != aPcbPlotParams.m_includeGerberNetlistInfo )
273  return false;
274  if( m_createGerberJobFile != aPcbPlotParams.m_createGerberJobFile )
275  return false;
276  if( m_gerberPrecision != aPcbPlotParams.m_gerberPrecision )
277  return false;
278  if( m_excludeEdgeLayer != aPcbPlotParams.m_excludeEdgeLayer )
279  return false;
280  if( m_lineWidth != aPcbPlotParams.m_lineWidth )
281  return false;
282  if( m_plotFrameRef != aPcbPlotParams.m_plotFrameRef )
283  return false;
284  if( m_plotViaOnMaskLayer != aPcbPlotParams.m_plotViaOnMaskLayer )
285  return false;
286  if( m_plotMode != aPcbPlotParams.m_plotMode )
287  return false;
288  if( !aCompareOnlySavedPrms )
289  {
290  if( m_DXFplotPolygonMode != aPcbPlotParams.m_DXFplotPolygonMode )
291  return false;
292  if( m_DXFplotUnits != aPcbPlotParams.m_DXFplotUnits )
293  return false;
294  }
295  if( m_svgPrecision != aPcbPlotParams.m_svgPrecision )
296  return false;
297  if( m_svgUseInch != aPcbPlotParams.m_svgUseInch )
298  return false;
299  if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
300  return false;
301  if( m_HPGLPenNum != aPcbPlotParams.m_HPGLPenNum )
302  return false;
303  if( m_HPGLPenSpeed != aPcbPlotParams.m_HPGLPenSpeed )
304  return false;
305  if( m_HPGLPenDiam != aPcbPlotParams.m_HPGLPenDiam )
306  return false;
307  if( m_negative != aPcbPlotParams.m_negative )
308  return false;
309  if( m_A4Output != aPcbPlotParams.m_A4Output )
310  return false;
311  if( m_plotReference != aPcbPlotParams.m_plotReference )
312  return false;
313  if( m_plotValue != aPcbPlotParams.m_plotValue )
314  return false;
315  if( m_plotInvisibleText != aPcbPlotParams.m_plotInvisibleText )
316  return false;
317  if( m_sketchPadsOnFabLayers != aPcbPlotParams.m_sketchPadsOnFabLayers )
318  return false;
319  if( m_subtractMaskFromSilk != aPcbPlotParams.m_subtractMaskFromSilk )
320  return false;
321  if( m_format != aPcbPlotParams.m_format )
322  return false;
323  if( m_mirror != aPcbPlotParams.m_mirror )
324  return false;
325  if( m_drillMarks != aPcbPlotParams.m_drillMarks )
326  return false;
327  if( m_scaleSelection != aPcbPlotParams.m_scaleSelection )
328  return false;
329  if( m_autoScale != aPcbPlotParams.m_autoScale )
330  return false;
331  if( m_scale != aPcbPlotParams.m_scale )
332  return false;
333  if( m_fineScaleAdjustX != aPcbPlotParams.m_fineScaleAdjustX )
334  return false;
335  if( m_fineScaleAdjustY != aPcbPlotParams.m_fineScaleAdjustY )
336  return false;
337  if( m_widthAdjust != aPcbPlotParams.m_widthAdjust )
338  return false;
339  if( !aCompareOnlySavedPrms )
340  {
341  if( m_color != aPcbPlotParams.m_color )
342  return false;
343  }
344  if( m_textMode != aPcbPlotParams.m_textMode )
345  return false;
346  if( !m_outputDirectory.IsSameAs( aPcbPlotParams.m_outputDirectory ) )
347  return false;
348 
349  return true;
350 }
351 
352 
354 {
355  return setDouble( &m_HPGLPenDiam, aValue, HPGL_PEN_DIAMETER_MIN, HPGL_PEN_DIAMETER_MAX );
356 }
357 
358 
360 {
361  return setInt( &m_HPGLPenSpeed, aValue, HPGL_PEN_SPEED_MIN, HPGL_PEN_SPEED_MAX );
362 }
363 
364 
365 // PCB_PLOT_PARAMS_PARSER
366 
368  PCB_PLOT_PARAMS_LEXER( aReader )
369 {
370 }
371 
372 
373 PCB_PLOT_PARAMS_PARSER::PCB_PLOT_PARAMS_PARSER( char* aLine, const wxString& aSource ) :
374  PCB_PLOT_PARAMS_LEXER( aLine, aSource )
375 {
376 }
377 
378 
380 {
381  T token;
382 
383  while( ( token = NextTok() ) != T_RIGHT )
384  {
385  if( token == T_EOF)
386  Unexpected( T_EOF );
387 
388  if( token == T_LEFT )
389  token = NextTok();
390 
391  if( token == T_pcbplotparams )
392  continue;
393 
394  bool skip_right = false;
395 
396  switch( token )
397  {
398  case T_layerselection:
399  {
400  token = NeedSYMBOLorNUMBER();
401 
402  const std::string& cur = CurStr();
403 
404  if( token == T_NUMBER ) // pretty 3 format had legacy Cu stack.
405  {
406  // unsigned legacy_mask = atol( cur.c_str() );
407 
408  /* It's not possible to convert a legacy Cu layer number to a new
409  Cu layer number without knowing the number or total Cu layers
410  in the legacy board. We do not have that information here.
411  So simply set all layers ON. User can turn them off in the UI.
412  This is one of the superiorities of the new Cu sequence.
413  aPcbPlotParams->m_layerSelection = LEGACY_PLUGIN::leg_mask2new( cu_count, legacy_mask );
414  */
415 
416  // sorry, use the UI once to fix:
417  aPcbPlotParams->m_layerSelection = LSET( 2, F_SilkS, B_SilkS) | LSET::AllCuMask();
418  }
419  else if( cur.find_first_of( "0x" ) == 0 ) // pretty ver. 4.
420  {
421  // skip the leading 2 0x bytes.
422  aPcbPlotParams->m_layerSelection.ParseHex( cur.c_str()+2, cur.size()-2 );
423  }
424  else
425  Expecting( "integer or hex layerSelection" );
426  }
427  break;
428 
429  case T_usegerberextensions:
430  aPcbPlotParams->m_useGerberProtelExtensions = parseBool();
431  break;
432 
433  case T_usegerberattributes:
434  aPcbPlotParams->m_useGerberX2format = parseBool();
435  break;
436 
437  case T_usegerberadvancedattributes:
438  aPcbPlotParams->m_includeGerberNetlistInfo = parseBool();
439  break;
440 
441  case T_creategerberjobfile:
442  aPcbPlotParams->m_createGerberJobFile = parseBool();
443  break;
444 
445  case T_gerberprecision:
446  aPcbPlotParams->m_gerberPrecision =
448  break;
449 
450  case T_svgprecision:
452  break;
453 
454  case T_svguseinch:
455  aPcbPlotParams->m_svgUseInch = parseBool();
456  break;
457 
458  case T_psa4output:
459  aPcbPlotParams->m_A4Output = parseBool();
460  break;
461 
462  case T_excludeedgelayer:
463  aPcbPlotParams->m_excludeEdgeLayer = parseBool();
464  break;
465 
466  case T_plotframeref:
467  aPcbPlotParams->m_plotFrameRef = parseBool();
468  break;
469 
470  case T_viasonmask:
471  aPcbPlotParams->m_plotViaOnMaskLayer = parseBool();
472  break;
473 
474  case T_mode:
475  aPcbPlotParams->SetPlotMode( parseInt( 0, 2 ) > 1 ? SKETCH : FILLED );
476  break;
477 
478  case T_useauxorigin:
479  aPcbPlotParams->m_useAuxOrigin = parseBool();
480  break;
481 
482  case T_hpglpennumber:
483  aPcbPlotParams->m_HPGLPenNum = parseInt( HPGL_PEN_NUMBER_MIN,
485  break;
486 
487  case T_hpglpenspeed:
488  aPcbPlotParams->m_HPGLPenSpeed = parseInt( HPGL_PEN_SPEED_MIN,
490  break;
491 
492  case T_hpglpendiameter:
493  aPcbPlotParams->m_HPGLPenDiam = parseDouble();
494  break;
495 
496  case T_hpglpenoverlay:
497  // No more used. juste here for compatibility with old versions
499  break;
500 
501  case T_pscolor:
502  NeedSYMBOL(); // This actually was never used...
503  break;
504 
505  case T_psnegative:
506  aPcbPlotParams->m_negative = parseBool();
507  break;
508 
509  case T_plotreference:
510  aPcbPlotParams->m_plotReference = parseBool();
511  break;
512 
513  case T_plotvalue:
514  aPcbPlotParams->m_plotValue = parseBool();
515  break;
516 
517  case T_plotinvisibletext:
518  aPcbPlotParams->m_plotInvisibleText = parseBool();
519  break;
520 
521  case T_sketchpadsonfab:
522  aPcbPlotParams->m_sketchPadsOnFabLayers= parseBool();
523  break;
524 
525  case T_subtractmaskfromsilk:
526  aPcbPlotParams->m_subtractMaskFromSilk = parseBool();
527  break;
528 
529  case T_outputformat:
530  aPcbPlotParams->m_format = static_cast<PLOT_FORMAT>(
531  parseInt( static_cast<int>( PLOT_FORMAT::FIRST_FORMAT ),
532  static_cast<int>( PLOT_FORMAT::LAST_FORMAT ) ) );
533  break;
534 
535  case T_mirror:
536  aPcbPlotParams->m_mirror = parseBool();
537  break;
538 
539  case T_drillshape:
540  aPcbPlotParams->m_drillMarks = static_cast<PCB_PLOT_PARAMS::DrillMarksType>
541  ( parseInt( 0, 2 ) );
542  break;
543 
544  case T_scaleselection:
545  aPcbPlotParams->m_scaleSelection = parseInt( 0, 4 );
546  break;
547 
548  case T_outputdirectory:
549  NeedSYMBOLorNUMBER(); // a dir name can be like a number
550  aPcbPlotParams->m_outputDirectory = FROM_UTF8( CurText() );
551  break;
552 
553  default:
554  skipCurrent(); // skip unknown or outdated plot parameter
555  skip_right = true; // the closing right token is already read.
556  break;
557  }
558 
559  if( ! skip_right )
560  NeedRIGHT();
561  }
562 }
563 
564 
566 {
567  T token = NeedSYMBOL();
568 
569  if( token != T_false && token != T_true )
570  Expecting( "true|false" );
571 
572  return token == T_true;
573 }
574 
575 
576 int PCB_PLOT_PARAMS_PARSER::parseInt( int aMin, int aMax )
577 {
578  T token = NextTok();
579 
580  if( token != T_NUMBER )
581  Expecting( T_NUMBER );
582 
583  int val = atoi( CurText() );
584 
585  if( val < aMin )
586  val = aMin;
587  else if( val > aMax )
588  val = aMax;
589 
590  return val;
591 }
592 
593 
595 {
596  T token = NextTok();
597 
598  if( token != T_NUMBER )
599  Expecting( T_NUMBER );
600 
601  double val = strtod( CurText(), NULL );
602 
603  return val;
604 }
605 
606 
608 {
609  int curr_level = 0;
610  T token;
611 
612  while( ( token = NextTok() ) != T_EOF )
613  {
614  if( token == T_LEFT )
615  curr_level--;
616 
617  if( token == T_RIGHT )
618  {
619  curr_level++;
620 
621  if( curr_level > 0 )
622  return;
623  }
624  }
625 }
double m_fineScaleAdjustX
fine scale adjust X axis
DXF_PLOTTER::DXF_UNITS m_DXFplotUnits
DXF format: Units to use when plotting the DXF.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
#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)
LINE_READER is an abstract class from which implementation specific LINE_READERs may be derived to re...
Definition: richio.h:81
double parseDouble()
Function parseDouble parses a double.
#define PLOT_LINEWIDTH_DEFAULT
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)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:114
bool m_mirror
Mirror the plot around the X axis.
PCB_PLOT_PARAMS_PARSER is the parser class for PCB_PLOT_PARAMS.
static constexpr double IU_PER_MM
Mock up a conversion function.
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
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.
OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a convenient ...
Definition: richio.h:327
bool m_useGerberProtelExtensions
When plotting gerber files, use a conventional set of Protel extensions instead of ....
bool SetHPGLPenSpeed(int aValue)
T
enum T contains all this lexer's tokens.
Definition: color4d.h:44
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.
#define NULL
PCB_PLOT_PARAMS_PARSER(LINE_READER *aReader)
bool m_sketchPadsOnFabLayers
Plots pads outlines on fab layers.
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
int g_DrawDefaultLineThickness
Default line thickness in internal units used to draw or plot items using a default thickness line va...
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.
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
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.
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.
EDA_DRAW_MODE_T m_plotMode
FILLED or SKETCH selects how to plot filled objects.
#define HPGL_PEN_NUMBER_MIN
#define HPGL_PEN_SPEED_MIN
bool IsSameAs(const PCB_PLOT_PARAMS &aPcbPlotParams, bool aCompareOnlySavedPrms) const
Compare current settings to aPcbPlotParams, including not saved parameters in brd file.
const T & Clamp(const T &lower, const T &value, const T &upper)
Function Clamp limits value within the range lower <= value <= upper.
Definition: util.h:46
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.
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404
#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)
Function ParseHex understands the output of FmtHex() and replaces this set's values with those given ...
Definition: lset.cpp:325
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_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,...