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-2021 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>
26 #include <layer_ids.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 <plotters/plotter.h>
33 
34 
35 #define PLOT_LINEWIDTH_DEFAULT ( DEFAULT_TEXT_WIDTH * IU_PER_MM )
36 
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
43 
44 #define SVG_PRECISION_MIN 3U
45 #define SVG_PRECISION_MAX 6U
46 #define SVG_PRECISION_DEFAULT 6
47 
48 
49 // default trailing digits in Gerber coordinates, when units are mm
50 // This is also the max usable precision (i.e. internal Pcbnew Units)
51 static const int gbrDefaultPrecision = 6;
52 
53 
54 using namespace PCBPLOTPARAMS_T;
55 
56 
57 static const char* getTokenName( T aTok )
58 {
59  return PCB_PLOT_PARAMS_LEXER::TokenName( aTok );
60 }
61 
62 
63 static bool setInt( int* aTarget, int aValue, int aMin, int aMax )
64 {
65  int temp = aValue;
66 
67  if( aValue < aMin )
68  temp = aMin;
69  else if( aValue > aMax )
70  temp = aMax;
71 
72  *aTarget = temp;
73  return ( temp == aValue );
74 }
75 
76 
77 static bool setDouble( double* aTarget, double aValue, double aMin, double aMax )
78 {
79  double temp = aValue;
80 
81  if( aValue < aMin )
82  temp = aMin;
83  else if( aValue > aMax )
84  temp = aMax;
85 
86  *aTarget = temp;
87  return ( temp == aValue );
88 }
89 
90 
92 {
93  m_useGerberProtelExtensions = false;
94  m_gerberDisableApertMacros = false;
95  m_useGerberX2format = true;
96  m_includeGerberNetlistInfo = true;
97  m_createGerberJobFile = true;
98  m_gerberPrecision = gbrDefaultPrecision;
99 
100  // we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm
101  m_svgPrecision = SVG_PRECISION_DEFAULT;
102  m_svgUseInch = false;
103  m_excludeEdgeLayer = true;
104  m_plotFrameRef = false;
105  m_plotViaOnMaskLayer = false;
106  m_plotMode = FILLED;
107  m_DXFplotPolygonMode = true;
108  m_DXFplotUnits = DXF_UNITS::INCHES;
109  m_useAuxOrigin = false;
110  m_HPGLPenNum = 1;
111  m_HPGLPenSpeed = 20; // this param is always in cm/s
112  m_HPGLPenDiam = 15; // in mils
113  m_negative = false;
114  m_A4Output = false;
115  m_plotReference = true;
116  m_plotValue = true;
117  m_plotInvisibleText = false;
118  m_sketchPadsOnFabLayers = false;
119  m_subtractMaskFromSilk = false;
120  m_format = PLOT_FORMAT::GERBER;
121  m_mirror = false;
122  m_drillMarks = SMALL_DRILL_SHAPE;
123  m_autoScale = false;
124  m_scale = 1.0;
125  m_scaleSelection = 1;
126  m_fineScaleAdjustX = 1.0;
127  m_fineScaleAdjustY = 1.0;
128  m_widthAdjust = 0.;
129  m_textMode = PLOT_TEXT_MODE::DEFAULT;
130  m_outputDirectory.clear();
131  m_layerSelection = LSET( 7, F_SilkS, B_SilkS, F_Mask, B_Mask,
133  | LSET::AllCuMask();
134 
135  // This parameter controls if the NPTH pads will be plotted or not
136  // it is a "local" parameter
137  m_skipNPTH_Pads = false;
138 
139  // line width to plot items in outline mode.
140  m_sketchPadLineWidth = Millimeter2iu( 0.1 );
141 
142  m_default_colors = std::make_shared<COLOR_SETTINGS>();
143  m_colors = m_default_colors.get();
144 }
145 
146 
148 {
149  // Currently Gerber files use mm.
150  // accepted precision is only 6 (max value, this is the resolution of Pcbnew)
151  // or 5, min value for professional boards, when 6 creates problems
152  // to board makers.
153 
154  m_gerberPrecision = aPrecision == gbrDefaultPrecision-1 ? gbrDefaultPrecision-1 :
156 }
157 
158 
159 void PCB_PLOT_PARAMS::SetSvgPrecision( unsigned aPrecision, bool aUseInch )
160 {
161  m_svgUseInch = aUseInch;
162  m_svgPrecision = Clamp( SVG_PRECISION_MIN, aPrecision, SVG_PRECISION_MAX );
163 }
164 
165 
167  int aNestLevel, int aControl ) const
168 {
169  const char* falseStr = getTokenName( T_false );
170  const char* trueStr = getTokenName( T_true );
171 
172  aFormatter->Print( aNestLevel, "(%s\n", getTokenName( T_pcbplotparams ) );
173 
174  aFormatter->Print( aNestLevel+1, "(%s 0x%s)\n", getTokenName( T_layerselection ),
175  m_layerSelection.FmtHex().c_str() );
176 
177  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_disableapertmacros ),
178  m_gerberDisableApertMacros ? trueStr : falseStr );
179 
180  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberextensions ),
181  m_useGerberProtelExtensions ? trueStr : falseStr );
182 
183  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberattributes ),
184  GetUseGerberX2format() ? trueStr : falseStr );
185 
186  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberadvancedattributes ),
187  GetIncludeGerberNetlistInfo() ? trueStr : falseStr );
188 
189  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_creategerberjobfile ),
190  GetCreateGerberJobFile() ? trueStr : falseStr );
191 
192  // save this option only if it is not the default value,
193  // to avoid incompatibility with older Pcbnew version
194  if( m_gerberPrecision != gbrDefaultPrecision )
195  aFormatter->Print( aNestLevel+1, "(%s %d)\n",
196  getTokenName( T_gerberprecision ), m_gerberPrecision );
197 
198  // SVG options
199  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_svguseinch ),
200  m_svgUseInch ? trueStr : falseStr );
201  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_svgprecision ),
202  m_svgPrecision );
203 
204  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_excludeedgelayer ),
205  m_excludeEdgeLayer ? trueStr : falseStr );
206  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotframeref ),
207  m_plotFrameRef ? trueStr : falseStr );
208  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_viasonmask ),
209  m_plotViaOnMaskLayer ? trueStr : falseStr );
210  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_mode ),
211  GetPlotMode() == SKETCH ? 2 : 1 ); // Value 0 (LINE mode) no more used
212  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_useauxorigin ),
213  m_useAuxOrigin ? trueStr : falseStr );
214 
215  // HPGL options
216  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpennumber ),
217  m_HPGLPenNum );
218  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpenspeed ),
219  m_HPGLPenSpeed );
220  aFormatter->Print( aNestLevel+1, "(%s %f)\n", getTokenName( T_hpglpendiameter ),
221  m_HPGLPenDiam );
222 
223  // DXF options
224  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_dxfpolygonmode ),
225  m_DXFplotPolygonMode ? trueStr : falseStr );
226  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_dxfimperialunits ),
227  m_DXFplotUnits == DXF_UNITS::INCHES ? trueStr : falseStr );
228  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_dxfusepcbnewfont ),
229  m_textMode == PLOT_TEXT_MODE::NATIVE ? falseStr : trueStr );
230 
231  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_psnegative ),
232  m_negative ? trueStr : falseStr );
233  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_psa4output ),
234  m_A4Output ? trueStr : falseStr );
235  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotreference ),
236  m_plotReference ? trueStr : falseStr );
237  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotvalue ),
238  m_plotValue ? trueStr : falseStr );
239  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotinvisibletext ),
240  m_plotInvisibleText ? trueStr : falseStr );
241  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_sketchpadsonfab ),
242  m_sketchPadsOnFabLayers ? trueStr : falseStr );
243  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_subtractmaskfromsilk ),
244  m_subtractMaskFromSilk ? trueStr : falseStr );
245  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_outputformat ),
246  static_cast<int>( m_format ) );
247  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_mirror ),
248  m_mirror ? trueStr : falseStr );
249  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_drillshape ),
250  m_drillMarks );
251  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_scaleselection ),
252  m_scaleSelection );
253  aFormatter->Print( aNestLevel+1, "(%s \"%s\")", getTokenName( T_outputdirectory ),
254  (const char*) m_outputDirectory.utf8_str() );
255  aFormatter->Print( 0, "\n" );
256  aFormatter->Print( aNestLevel, ")\n" );
257 }
258 
259 
261 {
262  aParser->Parse( this );
263 }
264 
265 
266 bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
267 {
268  if( m_layerSelection != aPcbPlotParams.m_layerSelection )
269  return false;
270 
271  if( m_useGerberProtelExtensions != aPcbPlotParams.m_useGerberProtelExtensions )
272  return false;
273 
274  if( m_gerberDisableApertMacros != aPcbPlotParams.m_gerberDisableApertMacros )
275  return false;
276 
277  if( m_useGerberX2format != aPcbPlotParams.m_useGerberX2format )
278  return false;
279 
280  if( m_includeGerberNetlistInfo != aPcbPlotParams.m_includeGerberNetlistInfo )
281  return false;
282 
283  if( m_createGerberJobFile != aPcbPlotParams.m_createGerberJobFile )
284  return false;
285 
286  if( m_gerberPrecision != aPcbPlotParams.m_gerberPrecision )
287  return false;
288 
289  if( m_excludeEdgeLayer != aPcbPlotParams.m_excludeEdgeLayer )
290  return false;
291 
292  if( m_plotFrameRef != aPcbPlotParams.m_plotFrameRef )
293  return false;
294 
295  if( m_plotViaOnMaskLayer != aPcbPlotParams.m_plotViaOnMaskLayer )
296  return false;
297 
298  if( m_plotMode != aPcbPlotParams.m_plotMode )
299  return false;
300 
301  if( m_DXFplotPolygonMode != aPcbPlotParams.m_DXFplotPolygonMode )
302  return false;
303 
304  if( m_DXFplotUnits != aPcbPlotParams.m_DXFplotUnits )
305  return false;
306 
307  if( m_svgPrecision != aPcbPlotParams.m_svgPrecision )
308  return false;
309 
310  if( m_svgUseInch != aPcbPlotParams.m_svgUseInch )
311  return false;
312 
313  if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
314  return false;
315 
316  if( m_HPGLPenNum != aPcbPlotParams.m_HPGLPenNum )
317  return false;
318 
319  if( m_HPGLPenSpeed != aPcbPlotParams.m_HPGLPenSpeed )
320  return false;
321 
322  if( m_HPGLPenDiam != aPcbPlotParams.m_HPGLPenDiam )
323  return false;
324 
325  if( m_negative != aPcbPlotParams.m_negative )
326  return false;
327 
328  if( m_A4Output != aPcbPlotParams.m_A4Output )
329  return false;
330 
331  if( m_plotReference != aPcbPlotParams.m_plotReference )
332  return false;
333 
334  if( m_plotValue != aPcbPlotParams.m_plotValue )
335  return false;
336 
337  if( m_plotInvisibleText != aPcbPlotParams.m_plotInvisibleText )
338  return false;
339 
340  if( m_sketchPadsOnFabLayers != aPcbPlotParams.m_sketchPadsOnFabLayers )
341  return false;
342 
343  if( m_subtractMaskFromSilk != aPcbPlotParams.m_subtractMaskFromSilk )
344  return false;
345 
346  if( m_format != aPcbPlotParams.m_format )
347  return false;
348 
349  if( m_mirror != aPcbPlotParams.m_mirror )
350  return false;
351 
352  if( m_drillMarks != aPcbPlotParams.m_drillMarks )
353  return false;
354 
355  if( m_scaleSelection != aPcbPlotParams.m_scaleSelection )
356  return false;
357 
358  if( m_autoScale != aPcbPlotParams.m_autoScale )
359  return false;
360 
361  if( m_scale != aPcbPlotParams.m_scale )
362  return false;
363 
364  if( m_fineScaleAdjustX != aPcbPlotParams.m_fineScaleAdjustX )
365  return false;
366 
367  if( m_fineScaleAdjustY != aPcbPlotParams.m_fineScaleAdjustY )
368  return false;
369 
370  if( m_widthAdjust != aPcbPlotParams.m_widthAdjust )
371  return false;
372 
373  if( m_textMode != aPcbPlotParams.m_textMode )
374  return false;
375 
376  if( !m_outputDirectory.IsSameAs( aPcbPlotParams.m_outputDirectory ) )
377  return false;
378 
379  return true;
380 }
381 
382 
384 {
385  return setDouble( &m_HPGLPenDiam, aValue, HPGL_PEN_DIAMETER_MIN, HPGL_PEN_DIAMETER_MAX );
386 }
387 
388 
390 {
391  return setInt( &m_HPGLPenSpeed, aValue, HPGL_PEN_SPEED_MIN, HPGL_PEN_SPEED_MAX );
392 }
393 
394 
396  PCB_PLOT_PARAMS_LEXER( aReader )
397 {
398 }
399 
400 
401 PCB_PLOT_PARAMS_PARSER::PCB_PLOT_PARAMS_PARSER( char* aLine, const wxString& aSource ) :
402  PCB_PLOT_PARAMS_LEXER( aLine, aSource )
403 {
404 }
405 
406 
408 {
409  T token;
410 
411  while( ( token = NextTok() ) != T_RIGHT )
412  {
413  if( token == T_EOF)
414  Unexpected( T_EOF );
415 
416  if( token == T_LEFT )
417  token = NextTok();
418 
419  if( token == T_pcbplotparams )
420  continue;
421 
422  bool skip_right = false;
423 
424  switch( token )
425  {
426  case T_layerselection:
427  {
428  token = NeedSYMBOLorNUMBER();
429 
430  const std::string& cur = CurStr();
431 
432  if( token == T_NUMBER ) // pretty 3 format had legacy Cu stack.
433  {
434  // It's not possible to convert a legacy Cu layer number to a new Cu layer
435  // number without knowing the number or total Cu layers in the legacy board.
436  // We do not have that information here, so simply set all layers ON. User
437  // can turn them off in the UI.
438  aPcbPlotParams->m_layerSelection = LSET( 2, F_SilkS, B_SilkS ) | LSET::AllCuMask();
439  }
440  else if( cur.find_first_of( "0x" ) == 0 ) // pretty ver. 4.
441  {
442  // skip the leading 2 0x bytes.
443  aPcbPlotParams->m_layerSelection.ParseHex( cur.c_str() + 2, cur.size() - 2 );
444  }
445  else
446  {
447  Expecting( "integer or hex layerSelection" );
448  }
449 
450  break;
451  }
452 
453  case T_disableapertmacros:
454  aPcbPlotParams->m_gerberDisableApertMacros = parseBool();
455  break;
456 
457  case T_usegerberextensions:
458  aPcbPlotParams->m_useGerberProtelExtensions = parseBool();
459  break;
460 
461  case T_usegerberattributes:
462  aPcbPlotParams->m_useGerberX2format = parseBool();
463  break;
464 
465  case T_usegerberadvancedattributes:
466  aPcbPlotParams->m_includeGerberNetlistInfo = parseBool();
467  break;
468 
469  case T_creategerberjobfile:
470  aPcbPlotParams->m_createGerberJobFile = parseBool();
471  break;
472 
473  case T_gerberprecision:
474  aPcbPlotParams->m_gerberPrecision = parseInt( gbrDefaultPrecision - 1,
476  break;
477 
478  case T_svgprecision:
480  break;
481 
482  case T_svguseinch:
483  aPcbPlotParams->m_svgUseInch = parseBool();
484  break;
485 
486  case T_psa4output:
487  aPcbPlotParams->m_A4Output = parseBool();
488  break;
489 
490  case T_excludeedgelayer:
491  aPcbPlotParams->m_excludeEdgeLayer = parseBool();
492  break;
493 
494  case T_plotframeref:
495  aPcbPlotParams->m_plotFrameRef = parseBool();
496  break;
497 
498  case T_viasonmask:
499  aPcbPlotParams->m_plotViaOnMaskLayer = parseBool();
500  break;
501 
502  case T_mode:
503  aPcbPlotParams->SetPlotMode( parseInt( 0, 2 ) > 1 ? SKETCH : FILLED );
504  break;
505 
506  case T_useauxorigin:
507  aPcbPlotParams->m_useAuxOrigin = parseBool();
508  break;
509 
510  case T_hpglpennumber:
512  break;
513 
514  case T_hpglpenspeed:
516  break;
517 
518  case T_hpglpendiameter:
519  aPcbPlotParams->m_HPGLPenDiam = parseDouble();
520  break;
521 
522  case T_hpglpenoverlay:
523  // No more used. just here for compatibility with old versions
525  break;
526 
527  case T_dxfpolygonmode:
528  aPcbPlotParams->m_DXFplotPolygonMode = parseBool();
529  break;
530 
531  case T_dxfimperialunits:
532  aPcbPlotParams->m_DXFplotUnits = parseBool() ? DXF_UNITS::INCHES
534  break;
535 
536  case T_dxfusepcbnewfont:
537  aPcbPlotParams->m_textMode = parseBool() ? PLOT_TEXT_MODE::DEFAULT
539  break;
540 
541  case T_pscolor:
542  NeedSYMBOL(); // This actually was never used...
543  break;
544 
545  case T_psnegative:
546  aPcbPlotParams->m_negative = parseBool();
547  break;
548 
549  case T_plotreference:
550  aPcbPlotParams->m_plotReference = parseBool();
551  break;
552 
553  case T_plotvalue:
554  aPcbPlotParams->m_plotValue = parseBool();
555  break;
556 
557  case T_plotinvisibletext:
558  aPcbPlotParams->m_plotInvisibleText = parseBool();
559  break;
560 
561  case T_sketchpadsonfab:
562  aPcbPlotParams->m_sketchPadsOnFabLayers= parseBool();
563  break;
564 
565  case T_subtractmaskfromsilk:
566  aPcbPlotParams->m_subtractMaskFromSilk = parseBool();
567  break;
568 
569  case T_outputformat:
570  aPcbPlotParams->m_format = static_cast<PLOT_FORMAT>(
571  parseInt( static_cast<int>( PLOT_FORMAT::FIRST_FORMAT ),
572  static_cast<int>( PLOT_FORMAT::LAST_FORMAT ) ) );
573  break;
574 
575  case T_mirror:
576  aPcbPlotParams->m_mirror = parseBool();
577  break;
578 
579  case T_drillshape:
580  aPcbPlotParams->m_drillMarks = static_cast<PCB_PLOT_PARAMS::DrillMarksType>
581  ( parseInt( 0, 2 ) );
582  break;
583 
584  case T_scaleselection:
585  aPcbPlotParams->m_scaleSelection = parseInt( 0, 4 );
586  break;
587 
588  case T_outputdirectory:
589  NeedSYMBOLorNUMBER(); // a dir name can be like a number
590  aPcbPlotParams->m_outputDirectory = FROM_UTF8( CurText() );
591  break;
592 
593  default:
594  skipCurrent(); // skip unknown or outdated plot parameter
595  skip_right = true; // the closing right token is already read.
596  break;
597  }
598 
599  if( ! skip_right )
600  NeedRIGHT();
601  }
602 }
603 
604 
606 {
607  T token = NeedSYMBOL();
608 
609  if( token != T_false && token != T_true )
610  Expecting( "true|false" );
611 
612  return token == T_true;
613 }
614 
615 
616 int PCB_PLOT_PARAMS_PARSER::parseInt( int aMin, int aMax )
617 {
618  T token = NextTok();
619 
620  if( token != T_NUMBER )
621  Expecting( T_NUMBER );
622 
623  int val = atoi( CurText() );
624 
625  if( val < aMin )
626  val = aMin;
627  else if( val > aMax )
628  val = aMax;
629 
630  return val;
631 }
632 
633 
635 {
636  T token = NextTok();
637 
638  if( token != T_NUMBER )
639  Expecting( T_NUMBER );
640 
641  double val = strtod( CurText(), nullptr );
642 
643  return val;
644 }
645 
646 
648 {
649  int curr_level = 0;
650  T token;
651 
652  while( ( token = NextTok() ) != T_EOF )
653  {
654  if( token == T_LEFT )
655  curr_level--;
656 
657  if( token == T_RIGHT )
658  {
659  curr_level++;
660 
661  if( curr_level > 0 )
662  return;
663  }
664  }
665 }
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.
Definition: lset.cpp:750
#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...
Definition: richio.h:80
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.
Definition: macros.h:110
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.
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:309
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.
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.
Definition: layer_ids.h:504
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)
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 absolute 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 aperture macros in Gerber format (only for broken Gerber readers) Ideally,...
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 ...
#define HPGL_PEN_NUMBER_MIN
#define HPGL_PEN_SPEED_MIN
const T & Clamp(const T &lower, const T &value, const T &upper)
Limit value within the range lower <= value <= upper.
Definition: util.h:52
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,...)
Format and write text to the output stream.
Definition: richio.cpp:426
#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.
Definition: lset.cpp:359
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,...