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 <pgm_base.h>
32 #include <plotter.h>
35 
36 
37 #define PLOT_LINEWIDTH_MIN ( 0.02 * IU_PER_MM ) // min value for default line thickness
38 #define PLOT_LINEWIDTH_MAX ( 2 * IU_PER_MM ) // max value for default line thickness
39 #define PLOT_LINEWIDTH_DEFAULT ( DEFAULT_TEXT_WIDTH * IU_PER_MM )
40 #define HPGL_PEN_DIAMETER_MIN 0
41 #define HPGL_PEN_DIAMETER_MAX 100.0 // Unit = mil
42 #define HPGL_PEN_SPEED_MIN 1 // this param is always in cm/s
43 #define HPGL_PEN_SPEED_MAX 99 // this param is always in cm/s
44 #define HPGL_PEN_NUMBER_MIN 1
45 #define HPGL_PEN_NUMBER_MAX 16
46 
47 
53 
54 // default trailing digits in Gerber coordinates, when units are mm
55 // This is also the max usable precision (i.e. internal Pcbnew Units)
56 static const int gbrDefaultPrecision = 6;
57 
58 
59 using namespace PCBPLOTPARAMS_T;
60 
61 
62 static const char* getTokenName( T aTok )
63 {
64  return PCB_PLOT_PARAMS_LEXER::TokenName( aTok );
65 }
66 
67 
68 static bool setInt( int* aTarget, int aValue, int aMin, int aMax )
69 {
70  int temp = aValue;
71 
72  if( aValue < aMin )
73  temp = aMin;
74  else if( aValue > aMax )
75  temp = aMax;
76 
77  *aTarget = temp;
78  return (temp == aValue);
79 }
80 
81 
82 static bool setDouble( double* aTarget, double aValue, double aMin, double aMax )
83 {
84  double temp = aValue;
85 
86  if( aValue < aMin )
87  temp = aMin;
88  else if( aValue > aMax )
89  temp = aMax;
90 
91  *aTarget = temp;
92  return (temp == aValue);
93 }
94 
95 // PCB_PLOT_PARAMS
96 
98 {
99  m_useGerberProtelExtensions = false;
100  m_useGerberX2format = false;
101  m_includeGerberNetlistInfo = false;
102  m_createGerberJobFile = false;
103  m_gerberPrecision = gbrDefaultPrecision;
104  m_excludeEdgeLayer = true;
105  m_lineWidth = g_DrawDefaultLineThickness;
106  m_plotFrameRef = false;
107  m_plotViaOnMaskLayer = false;
108  m_plotMode = FILLED;
109  m_DXFplotPolygonMode = true;
110  m_DXFplotUnits = DXF_PLOTTER::DXF_UNITS::INCHES;
111  m_useAuxOrigin = false;
112  m_HPGLPenNum = 1;
113  m_HPGLPenSpeed = 20; // this param is always in cm/s
114  m_HPGLPenDiam = 15; // in mils
115  m_negative = false;
116  m_A4Output = false;
117  m_plotReference = true;
118  m_plotValue = true;
119  m_plotInvisibleText = false;
120  m_plotPadsOnSilkLayer = false;
121  m_subtractMaskFromSilk = false;
122  m_format = PLOT_FORMAT::GERBER;
123  m_mirror = false;
124  m_drillMarks = SMALL_DRILL_SHAPE;
125  m_autoScale = false;
126  m_scale = 1.0;
127  m_scaleSelection = 1;
128  m_fineScaleAdjustX = 1.0;
129  m_fineScaleAdjustY = 1.0;
130  m_widthAdjust = 0.;
131  m_color = BLACK;
132  m_textMode = PLOT_TEXT_MODE::DEFAULT;
133  m_outputDirectory.clear();
134  m_layerSelection = LSET( 7, F_SilkS, B_SilkS, F_Mask, B_Mask,
136  | LSET::AllCuMask();
137  // This parameter controls if the NPTH pads will be plotted or not
138  // it is a "local" parameter
139  m_skipNPTH_Pads = false;
140 
141  // TODO(JE) Is it an issue for this to be tied to Pgm()?
142  m_colors = PgmOrNull() ? Pgm().GetSettingsManager().GetColorSettings() : nullptr;
143 }
144 
146 {
147  // Currently geber files use mm.
148  // accepted precision is only 6 (max value, this is the resolution of Pcbnew)
149  // or 5, min value for professional boards, when 6 creates problems
150  // to board makers.
151 
152  m_gerberPrecision = aPrecision == gbrDefaultPrecision-1 ? gbrDefaultPrecision-1 :
154 }
155 
156 
157 // PLEASE NOTE: only plot dialog options are processed
159  int aNestLevel, int aControl ) const
160 {
161  const char* falseStr = getTokenName( T_false );
162  const char* trueStr = getTokenName( T_true );
163 
164  aFormatter->Print( aNestLevel, "(%s\n", getTokenName( T_pcbplotparams ) );
165 
166  aFormatter->Print( aNestLevel+1, "(%s 0x%s)\n", getTokenName( T_layerselection ),
167  m_layerSelection.FmtHex().c_str() );
168 
169  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberextensions ),
170  m_useGerberProtelExtensions ? trueStr : falseStr );
171 
172  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberattributes ),
173  GetUseGerberX2format() ? trueStr : falseStr );
174 
175  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberadvancedattributes ),
176  GetIncludeGerberNetlistInfo() ? trueStr : falseStr );
177 
178  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_creategerberjobfile ),
179  GetCreateGerberJobFile() ? trueStr : falseStr );
180 
181  if( m_gerberPrecision != gbrDefaultPrecision ) // save this option only if it is not the default value,
182  // to avoid incompatibility with older Pcbnew version
183  aFormatter->Print( aNestLevel+1, "(%s %d)\n",
184  getTokenName( T_gerberprecision ), m_gerberPrecision );
185 
186  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_excludeedgelayer ),
187  m_excludeEdgeLayer ? trueStr : falseStr );
188  aFormatter->Print( aNestLevel+1, "(%s %f)\n", getTokenName( T_linewidth ),
189  m_lineWidth / IU_PER_MM );
190  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotframeref ),
191  m_plotFrameRef ? trueStr : falseStr );
192  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_viasonmask ),
193  m_plotViaOnMaskLayer ? trueStr : falseStr );
194  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_mode ),
195  GetPlotMode() == SKETCH ? 2 : 1 ); // Value 0 (LINE mode) no more used
196  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_useauxorigin ),
197  m_useAuxOrigin ? trueStr : falseStr );
198  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpennumber ),
199  m_HPGLPenNum );
200 
201  // Obsolete parameter, pen speed is no more managed, because hpgl format
202  // is now an export format, and for this, pen speed has no meaning
203  // aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpenspeed ),
204  // m_HPGLPenSpeed );
205 
206  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_hpglpenspeed ),
207  m_HPGLPenSpeed );
208  aFormatter->Print( aNestLevel+1, "(%s %f)\n", getTokenName( T_hpglpendiameter ),
209  m_HPGLPenDiam );
210  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_psnegative ),
211  m_negative ? trueStr : falseStr );
212  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_psa4output ),
213  m_A4Output ? trueStr : falseStr );
214  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotreference ),
215  m_plotReference ? trueStr : falseStr );
216  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotvalue ),
217  m_plotValue ? trueStr : falseStr );
218  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotinvisibletext ),
219  m_plotInvisibleText ? trueStr : falseStr );
220  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_padsonsilk ),
221  m_plotPadsOnSilkLayer ? trueStr : falseStr );
222  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_subtractmaskfromsilk ),
223  m_subtractMaskFromSilk ? trueStr : falseStr );
224  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_outputformat ),
225  static_cast<int>( m_format ) );
226  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_mirror ),
227  m_mirror ? trueStr : falseStr );
228  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_drillshape ),
229  m_drillMarks );
230  aFormatter->Print( aNestLevel+1, "(%s %d)\n", getTokenName( T_scaleselection ),
231  m_scaleSelection );
232  aFormatter->Print( aNestLevel+1, "(%s \"%s\")", getTokenName( T_outputdirectory ),
233  (const char*) m_outputDirectory.utf8_str() );
234  aFormatter->Print( 0, "\n" );
235  aFormatter->Print( aNestLevel, ")\n" );
236 }
237 
238 
240 {
241  aParser->Parse( this );
242 }
243 
244 
245 bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams, bool aCompareOnlySavedPrms ) const
246 {
247  if( m_layerSelection != aPcbPlotParams.m_layerSelection )
248  return false;
249  if( m_useGerberProtelExtensions != aPcbPlotParams.m_useGerberProtelExtensions )
250  return false;
251  if( m_useGerberX2format != aPcbPlotParams.m_useGerberX2format )
252  return false;
253  if( m_includeGerberNetlistInfo != aPcbPlotParams.m_includeGerberNetlistInfo )
254  return false;
255  if( m_createGerberJobFile != aPcbPlotParams.m_createGerberJobFile )
256  return false;
257  if( m_gerberPrecision != aPcbPlotParams.m_gerberPrecision )
258  return false;
259  if( m_excludeEdgeLayer != aPcbPlotParams.m_excludeEdgeLayer )
260  return false;
261  if( m_lineWidth != aPcbPlotParams.m_lineWidth )
262  return false;
263  if( m_plotFrameRef != aPcbPlotParams.m_plotFrameRef )
264  return false;
265  if( m_plotViaOnMaskLayer != aPcbPlotParams.m_plotViaOnMaskLayer )
266  return false;
267  if( m_plotMode != aPcbPlotParams.m_plotMode )
268  return false;
269  if( !aCompareOnlySavedPrms )
270  {
271  if( m_DXFplotPolygonMode != aPcbPlotParams.m_DXFplotPolygonMode )
272  return false;
273  if( m_DXFplotUnits != aPcbPlotParams.m_DXFplotUnits )
274  return false;
275  }
276  if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
277  return false;
278  if( m_HPGLPenNum != aPcbPlotParams.m_HPGLPenNum )
279  return false;
280  if( m_HPGLPenSpeed != aPcbPlotParams.m_HPGLPenSpeed )
281  return false;
282  if( m_HPGLPenDiam != aPcbPlotParams.m_HPGLPenDiam )
283  return false;
284  if( m_negative != aPcbPlotParams.m_negative )
285  return false;
286  if( m_A4Output != aPcbPlotParams.m_A4Output )
287  return false;
288  if( m_plotReference != aPcbPlotParams.m_plotReference )
289  return false;
290  if( m_plotValue != aPcbPlotParams.m_plotValue )
291  return false;
292  if( m_plotInvisibleText != aPcbPlotParams.m_plotInvisibleText )
293  return false;
294  if( m_plotPadsOnSilkLayer != aPcbPlotParams.m_plotPadsOnSilkLayer )
295  return false;
296  if( m_subtractMaskFromSilk != aPcbPlotParams.m_subtractMaskFromSilk )
297  return false;
298  if( m_format != aPcbPlotParams.m_format )
299  return false;
300  if( m_mirror != aPcbPlotParams.m_mirror )
301  return false;
302  if( m_drillMarks != aPcbPlotParams.m_drillMarks )
303  return false;
304  if( m_scaleSelection != aPcbPlotParams.m_scaleSelection )
305  return false;
306  if( m_autoScale != aPcbPlotParams.m_autoScale )
307  return false;
308  if( m_scale != aPcbPlotParams.m_scale )
309  return false;
310  if( m_fineScaleAdjustX != aPcbPlotParams.m_fineScaleAdjustX )
311  return false;
312  if( m_fineScaleAdjustY != aPcbPlotParams.m_fineScaleAdjustY )
313  return false;
314  if( m_widthAdjust != aPcbPlotParams.m_widthAdjust )
315  return false;
316  if( !aCompareOnlySavedPrms )
317  {
318  if( m_color != aPcbPlotParams.m_color )
319  return false;
320  }
321  if( m_textMode != aPcbPlotParams.m_textMode )
322  return false;
323  if( !m_outputDirectory.IsSameAs( aPcbPlotParams.m_outputDirectory ) )
324  return false;
325 
326  return true;
327 }
328 
329 
331 {
332  return setDouble( &m_HPGLPenDiam, aValue, HPGL_PEN_DIAMETER_MIN, HPGL_PEN_DIAMETER_MAX );
333 }
334 
335 
337 {
338  return setInt( &m_HPGLPenSpeed, aValue, HPGL_PEN_SPEED_MIN, HPGL_PEN_SPEED_MAX );
339 }
340 
341 
343 {
344  return setInt( &m_lineWidth, aValue, PLOT_LINEWIDTH_MIN, PLOT_LINEWIDTH_MAX );
345 }
346 
347 // PCB_PLOT_PARAMS_PARSER
348 
350  PCB_PLOT_PARAMS_LEXER( aReader )
351 {
352 }
353 
354 
355 PCB_PLOT_PARAMS_PARSER::PCB_PLOT_PARAMS_PARSER( char* aLine, const wxString& aSource ) :
356  PCB_PLOT_PARAMS_LEXER( aLine, aSource )
357 {
358 }
359 
360 
362 {
363  T token;
364 
365  while( ( token = NextTok() ) != T_RIGHT )
366  {
367  if( token == T_EOF)
368  Unexpected( T_EOF );
369 
370  if( token == T_LEFT )
371  token = NextTok();
372 
373  if( token == T_pcbplotparams )
374  continue;
375 
376  bool skip_right = false;
377 
378  switch( token )
379  {
380  case T_layerselection:
381  {
382  token = NeedSYMBOLorNUMBER();
383 
384  const std::string& cur = CurStr();
385 
386  if( token == T_NUMBER ) // pretty 3 format had legacy Cu stack.
387  {
388  // unsigned legacy_mask = atol( cur.c_str() );
389 
390  /* It's not possible to convert a legacy Cu layer number to a new
391  Cu layer number without knowing the number or total Cu layers
392  in the legacy board. We do not have that information here.
393  So simply set all layers ON. User can turn them off in the UI.
394  This is one of the superiorities of the new Cu sequence.
395  aPcbPlotParams->m_layerSelection = LEGACY_PLUGIN::leg_mask2new( cu_count, legacy_mask );
396  */
397 
398  // sorry, use the UI once to fix:
399  aPcbPlotParams->m_layerSelection = LSET( 2, F_SilkS, B_SilkS) | LSET::AllCuMask();
400  }
401  else if( cur.find_first_of( "0x" ) == 0 ) // pretty ver. 4.
402  {
403  // skip the leading 2 0x bytes.
404  aPcbPlotParams->m_layerSelection.ParseHex( cur.c_str()+2, cur.size()-2 );
405  }
406  else
407  Expecting( "integer or hex layerSelection" );
408  }
409  break;
410 
411  case T_usegerberextensions:
412  aPcbPlotParams->m_useGerberProtelExtensions = parseBool();
413  break;
414 
415  case T_usegerberattributes:
416  aPcbPlotParams->m_useGerberX2format = parseBool();
417  break;
418 
419  case T_usegerberadvancedattributes:
420  aPcbPlotParams->m_includeGerberNetlistInfo = parseBool();
421  break;
422 
423  case T_creategerberjobfile:
424  aPcbPlotParams->m_createGerberJobFile = parseBool();
425  break;
426 
427  case T_gerberprecision:
428  aPcbPlotParams->m_gerberPrecision =
430  break;
431 
432  case T_psa4output:
433  aPcbPlotParams->m_A4Output = parseBool();
434  break;
435 
436  case T_excludeedgelayer:
437  aPcbPlotParams->m_excludeEdgeLayer = parseBool();
438  break;
439 
440  case T_linewidth:
441  {
442  // Due to a bug, this (minor) parameter was saved in biu
443  // and now is saved in mm
444  // If the read value is outside bounds, force a default value
445  double tmp = parseDouble();
446  if( !aPcbPlotParams->SetLineWidth( KiROUND( tmp * IU_PER_MM ) ) )
447  aPcbPlotParams->SetLineWidth( PLOT_LINEWIDTH_DEFAULT );
448  }
449  break;
450 
451  case T_plotframeref:
452  aPcbPlotParams->m_plotFrameRef = parseBool();
453  break;
454 
455  case T_viasonmask:
456  aPcbPlotParams->m_plotViaOnMaskLayer = parseBool();
457  break;
458 
459  case T_mode:
460  aPcbPlotParams->SetPlotMode( parseInt( 0, 2 ) > 1 ? SKETCH : FILLED );
461  break;
462 
463  case T_useauxorigin:
464  aPcbPlotParams->m_useAuxOrigin = parseBool();
465  break;
466 
467  case T_hpglpennumber:
468  aPcbPlotParams->m_HPGLPenNum = parseInt( HPGL_PEN_NUMBER_MIN,
470  break;
471 
472  case T_hpglpenspeed:
473  aPcbPlotParams->m_HPGLPenSpeed = parseInt( HPGL_PEN_SPEED_MIN,
475  break;
476 
477  case T_hpglpendiameter:
478  aPcbPlotParams->m_HPGLPenDiam = parseDouble();
479  break;
480 
481  case T_hpglpenoverlay:
482  // No more used. juste here for compatibility with old versions
484  break;
485 
486  case T_pscolor:
487  NeedSYMBOL(); // This actually was never used...
488  break;
489 
490  case T_psnegative:
491  aPcbPlotParams->m_negative = parseBool();
492  break;
493 
494  case T_plotreference:
495  aPcbPlotParams->m_plotReference = parseBool();
496  break;
497 
498  case T_plotvalue:
499  aPcbPlotParams->m_plotValue = parseBool();
500  break;
501 
502  case T_plotinvisibletext:
503  aPcbPlotParams->m_plotInvisibleText = parseBool();
504  break;
505 
506  case T_padsonsilk:
507  aPcbPlotParams->m_plotPadsOnSilkLayer= parseBool();
508  break;
509 
510  case T_subtractmaskfromsilk:
511  aPcbPlotParams->m_subtractMaskFromSilk = parseBool();
512  break;
513 
514  case T_outputformat:
515  aPcbPlotParams->m_format = static_cast<PLOT_FORMAT>(
516  parseInt( static_cast<int>( PLOT_FORMAT::FIRST_FORMAT ),
517  static_cast<int>( PLOT_FORMAT::LAST_FORMAT ) ) );
518  break;
519 
520  case T_mirror:
521  aPcbPlotParams->m_mirror = parseBool();
522  break;
523 
524  case T_drillshape:
525  aPcbPlotParams->m_drillMarks = static_cast<PCB_PLOT_PARAMS::DrillMarksType>
526  ( parseInt( 0, 2 ) );
527  break;
528 
529  case T_scaleselection:
530  aPcbPlotParams->m_scaleSelection = parseInt( 0, 4 );
531  break;
532 
533  case T_outputdirectory:
534  NeedSYMBOLorNUMBER(); // a dir name can be like a number
535  aPcbPlotParams->m_outputDirectory = FROM_UTF8( CurText() );
536  break;
537 
538  default:
539  skipCurrent(); // skip unknown or outdated plot parameter
540  skip_right = true; // the closing right token is already read.
541  break;
542  }
543 
544  if( ! skip_right )
545  NeedRIGHT();
546  }
547 }
548 
549 
551 {
552  T token = NeedSYMBOL();
553 
554  if( token != T_false && token != T_true )
555  Expecting( "true|false" );
556 
557  return token == T_true;
558 }
559 
560 
561 int PCB_PLOT_PARAMS_PARSER::parseInt( int aMin, int aMax )
562 {
563  T token = NextTok();
564 
565  if( token != T_NUMBER )
566  Expecting( T_NUMBER );
567 
568  int val = atoi( CurText() );
569 
570  if( val < aMin )
571  val = aMin;
572  else if( val > aMax )
573  val = aMax;
574 
575  return val;
576 }
577 
578 
580 {
581  T token = NextTok();
582 
583  if( token != T_NUMBER )
584  Expecting( T_NUMBER );
585 
586  double val = strtod( CurText(), NULL );
587 
588  return val;
589 }
590 
591 
593 {
594  int curr_level = 0;
595  T token;
596 
597  while( ( token = NextTok() ) != T_EOF )
598  {
599  if( token == T_LEFT )
600  curr_level--;
601 
602  if( token == T_RIGHT )
603  {
604  curr_level++;
605 
606  if( curr_level > 0 )
607  return;
608  }
609  }
610 }
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:686
#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
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:103
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:62
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
static const int gbrDefaultPrecision
bool m_plotPadsOnSilkLayer
Allows pads outlines on silkscreen layer (when pads are also on silk screen)
#define PLOT_LINEWIDTH_MAX
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)
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.
bool SetLineWidth(int aValue)
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.
LSET is a set of PCB_LAYER_IDs.
#define NULL
PCB_PLOT_PARAMS_PARSER(LINE_READER *aReader)
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)
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.
see class PGM_BASE
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 PLOT_LINEWIDTH_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.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:61
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)
Definition: colors.h:45
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
PGM_BASE * PgmOrNull()
similat to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
void Parse(PCB_PLOT_PARAMS *aPcbPlotParams)
void Parse(PCB_PLOT_PARAMS_PARSER *aParser)
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
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,...