KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2022 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
25#include <charconv>
26#include <layer_ids.h>
27#include <lset.h>
28#include <string_utils.h>
29#include <pcb_plot_params.h>
31#include <plotters/plotter.h>
34
35
36#define PLOT_LINEWIDTH_DEFAULT ( DEFAULT_TEXT_WIDTH * IU_PER_MM )
37
38#define HPGL_PEN_DIAMETER_MIN 0
39#define HPGL_PEN_DIAMETER_MAX 100.0 // Unit = mil
40#define HPGL_PEN_SPEED_MIN 1 // this param is always in cm/s
41#define HPGL_PEN_SPEED_MAX 99 // this param is always in cm/s
42#define HPGL_PEN_NUMBER_MIN 1
43#define HPGL_PEN_NUMBER_MAX 16
44
45#define SVG_PRECISION_MIN 3U
46#define SVG_PRECISION_MAX 6U
47#define SVG_PRECISION_DEFAULT 4
48
49
50// default trailing digits in Gerber coordinates, when units are mm
51// This is also the max usable precision (i.e. internal Pcbnew Units)
52static const int gbrDefaultPrecision = 6;
53
54
55using namespace PCBPLOTPARAMS_T;
56
57
58static const char* getTokenName( T aTok )
59{
60 return PCB_PLOT_PARAMS_LEXER::TokenName( aTok );
61}
62
63
64static bool setInt( int* aTarget, int aValue, int aMin, int aMax )
65{
66 int temp = aValue;
67
68 if( aValue < aMin )
69 temp = aMin;
70 else if( aValue > aMax )
71 temp = aMax;
72
73 *aTarget = temp;
74 return ( temp == aValue );
75}
76
77
78static bool setDouble( double* aTarget, double aValue, double aMin, double aMax )
79{
80 double temp = aValue;
81
82 if( aValue < aMin )
83 temp = aMin;
84 else if( aValue > aMax )
85 temp = aMax;
86
87 *aTarget = temp;
88 return ( temp == aValue );
89}
90
91
93{
100 m_dashedLineDashRatio = 12.0; // From ISO 128-2
101 m_dashedLineGapRatio = 3.0; // From ISO 128-2
102
103 // we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm
105 m_plotDrawingSheet = false;
107 m_DXFPolygonMode = true;
108 m_DXFUnits = 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_plotFPText = true;
118 m_plotInvisibleText = false;
120 m_plotPadNumbers = false;
122 m_format = PLOT_FORMAT::GERBER;
123 m_mirror = false;
124 m_drillMarks = DRILL_MARKS::SMALL_DRILL_SHAPE;
125 m_autoScale = false;
126 m_scale = 1.0;
128 m_fineScaleAdjustX = 1.0;
129 m_fineScaleAdjustY = 1.0;
130 m_widthAdjust = 0.;
131 m_textMode = PLOT_TEXT_MODE::DEFAULT;
132 m_outputDirectory.clear();
135 | LSET::AllCuMask();
136
139 m_PDFMetadata = true;
140
141 // This parameter controls if the NPTH pads will be plotted or not
142 // it is a "local" parameter
143 m_skipNPTH_Pads = false;
144
145 // line width to plot items in outline mode.
147
148 m_default_colors = std::make_shared<COLOR_SETTINGS>();
150
151 m_blackAndWhite = true;
152}
153
154
156{
157 // Currently Gerber files use mm.
158 // accepted precision is only 6 (max value, this is the resolution of Pcbnew)
159 // or 5, min value for professional boards, when 6 creates problems
160 // to board makers.
161
164}
165
166
167void PCB_PLOT_PARAMS::SetSvgPrecision( unsigned aPrecision )
168{
169 m_svgPrecision = std::clamp( aPrecision, SVG_PRECISION_MIN, SVG_PRECISION_MAX );
170}
171
172
174 int aNestLevel, int aControl ) const
175{
176 aFormatter->Print( aNestLevel, "(pcbplotparams\n" );
177
178 aFormatter->Print( aNestLevel+1, "(layerselection 0x%s)\n",
179 m_layerSelection.FmtHex().c_str() );
180
181 aFormatter->Print( aNestLevel+1, "(plot_on_all_layers_selection 0x%s)\n",
183
184 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "disableapertmacros",
186
187 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "usegerberextensions",
189
190 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "usegerberattributes",
192
193 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "usegerberadvancedattributes",
195
196 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "creategerberjobfile",
198
199 // save this option only if it is not the default value,
200 // to avoid incompatibility with older Pcbnew version
202 aFormatter->Print( aNestLevel+1, "(gerberprecision %d)\n", m_gerberPrecision );
203
204 aFormatter->Print( aNestLevel+1, "(dashed_line_dash_ratio %f)\n", GetDashedLineDashRatio() );
205 aFormatter->Print( aNestLevel+1, "(dashed_line_gap_ratio %f)\n", GetDashedLineGapRatio() );
206
207 // SVG options
208 aFormatter->Print( aNestLevel+1, "(svgprecision %d)\n", m_svgPrecision );
209
210 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotframeref", m_plotDrawingSheet );
211 aFormatter->Print( aNestLevel+1, "(mode %d)\n", GetPlotMode() == SKETCH ? 2 : 1 );
212 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "useauxorigin", m_useAuxOrigin );
213
214 // HPGL options
215 aFormatter->Print( aNestLevel+1, "(hpglpennumber %d)\n", m_HPGLPenNum );
216 aFormatter->Print( aNestLevel+1, "(hpglpenspeed %d)\n", m_HPGLPenSpeed );
217 aFormatter->Print( aNestLevel+1, "(hpglpendiameter %f)\n", m_HPGLPenDiam );
218
219 // PDF options
220 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1,
221 getTokenName( T_pdf_front_fp_property_popups ),
223 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1,
224 getTokenName( T_pdf_back_fp_property_popups ),
226 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1,
227 getTokenName( T_pdf_metadata ),
229
230 // DXF options
231 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, getTokenName( T_dxfpolygonmode ),
233 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, getTokenName( T_dxfimperialunits ),
234 m_DXFUnits == DXF_UNITS::INCHES );
235 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, getTokenName( T_dxfusepcbnewfont ),
236 m_textMode != PLOT_TEXT_MODE::NATIVE );
237
238 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, getTokenName( T_psnegative ),
239 m_negative );
240 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, getTokenName( T_psa4output ),
241 m_A4Output );
242
243 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotreference", m_plotReference );
244 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotvalue", m_plotValue );
245 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotfptext", m_plotFPText );
246 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotinvisibletext", m_plotInvisibleText );
247 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "sketchpadsonfab", m_sketchPadsOnFabLayers );
248 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotpadnumbers", m_plotPadNumbers );
249 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "subtractmaskfromsilk", m_subtractMaskFromSilk );
250 aFormatter->Print( aNestLevel+1, "(outputformat %d)\n", static_cast<int>( m_format ) );
251 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "mirror", m_mirror );
252 aFormatter->Print( aNestLevel+1, "(drillshape %d)\n", (int)m_drillMarks );
253 aFormatter->Print( aNestLevel+1, "(scaleselection %d)\n", m_scaleSelection );
254 aFormatter->Print( aNestLevel+1, "(outputdirectory \"%s\")",
255 (const char*) m_outputDirectory.utf8_str() );
256 aFormatter->Print( 0, "\n" );
257 aFormatter->Print( aNestLevel, ")\n" );
258}
259
260
262{
263 aParser->Parse( this );
264}
265
266
267bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
268{
269 if( m_layerSelection != aPcbPlotParams.m_layerSelection )
270 return false;
271
273 return false;
274
276 return false;
277
279 return false;
280
281 if( m_useGerberX2format != aPcbPlotParams.m_useGerberX2format )
282 return false;
283
285 return false;
286
287 if( m_createGerberJobFile != aPcbPlotParams.m_createGerberJobFile )
288 return false;
289
290 if( m_gerberPrecision != aPcbPlotParams.m_gerberPrecision )
291 return false;
292
293 if( m_dashedLineDashRatio != aPcbPlotParams.m_dashedLineDashRatio )
294 return false;
295
296 if( m_dashedLineGapRatio != aPcbPlotParams.m_dashedLineGapRatio )
297 return false;
298
299 if( m_plotDrawingSheet != aPcbPlotParams.m_plotDrawingSheet )
300 return false;
301
302 if( m_plotMode != aPcbPlotParams.m_plotMode )
303 return false;
304
305 if( m_DXFPolygonMode != aPcbPlotParams.m_DXFPolygonMode )
306 return false;
307
308 if( m_DXFUnits != aPcbPlotParams.m_DXFUnits )
309 return false;
310
311 if( m_svgPrecision != aPcbPlotParams.m_svgPrecision )
312 return false;
313
314 if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
315 return false;
316
317 if( m_HPGLPenNum != aPcbPlotParams.m_HPGLPenNum )
318 return false;
319
320 if( m_HPGLPenSpeed != aPcbPlotParams.m_HPGLPenSpeed )
321 return false;
322
323 if( m_HPGLPenDiam != aPcbPlotParams.m_HPGLPenDiam )
324 return false;
325
326 if( m_negative != aPcbPlotParams.m_negative )
327 return false;
328
330 return false;
331
333 return false;
334
335 if( m_PDFMetadata != aPcbPlotParams.m_PDFMetadata )
336 return false;
337
338 if( m_A4Output != aPcbPlotParams.m_A4Output )
339 return false;
340
341 if( m_plotReference != aPcbPlotParams.m_plotReference )
342 return false;
343
344 if( m_plotValue != aPcbPlotParams.m_plotValue )
345 return false;
346
347 if( m_plotFPText != aPcbPlotParams.m_plotFPText )
348 return false;
349
350 if( m_plotInvisibleText != aPcbPlotParams.m_plotInvisibleText )
351 return false;
352
354 return false;
355
356 if( m_plotPadNumbers != aPcbPlotParams.m_plotPadNumbers )
357 return false;
358
359 if( m_subtractMaskFromSilk != aPcbPlotParams.m_subtractMaskFromSilk )
360 return false;
361
362 if( m_format != aPcbPlotParams.m_format )
363 return false;
364
365 if( m_mirror != aPcbPlotParams.m_mirror )
366 return false;
367
368 if( m_drillMarks != aPcbPlotParams.m_drillMarks )
369 return false;
370
371 if( m_scaleSelection != aPcbPlotParams.m_scaleSelection )
372 return false;
373
374 if( m_autoScale != aPcbPlotParams.m_autoScale )
375 return false;
376
377 if( m_scale != aPcbPlotParams.m_scale )
378 return false;
379
380 if( m_fineScaleAdjustX != aPcbPlotParams.m_fineScaleAdjustX )
381 return false;
382
383 if( m_fineScaleAdjustY != aPcbPlotParams.m_fineScaleAdjustY )
384 return false;
385
386 if( m_widthAdjust != aPcbPlotParams.m_widthAdjust )
387 return false;
388
389 if( m_textMode != aPcbPlotParams.m_textMode )
390 return false;
391
392 if( m_blackAndWhite != aPcbPlotParams.m_blackAndWhite )
393 return false;
394
395 if( !m_outputDirectory.IsSameAs( aPcbPlotParams.m_outputDirectory ) )
396 return false;
397
398 return true;
399}
400
401
403{
405}
406
407
409{
411}
412
413
415 PCB_PLOT_PARAMS_LEXER( aReader )
416{
417}
418
419
420PCB_PLOT_PARAMS_PARSER::PCB_PLOT_PARAMS_PARSER( char* aLine, const wxString& aSource ) :
421 PCB_PLOT_PARAMS_LEXER( aLine, aSource )
422{
423}
424
425
427{
428 T token;
429
430 while( ( token = NextTok() ) != T_RIGHT )
431 {
432 if( token == T_EOF)
433 Unexpected( T_EOF );
434
435 if( token == T_LEFT )
436 token = NextTok();
437
438 if( token == T_pcbplotparams )
439 continue;
440
441 bool skip_right = false;
442
443 switch( token )
444 {
445 case T_layerselection:
446 {
447 token = NeedSYMBOLorNUMBER();
448
449 const std::string& cur = CurStr();
450
451 if( token == T_NUMBER ) // pretty 3 format had legacy Cu stack.
452 {
453 // It's not possible to convert a legacy Cu layer number to a new Cu layer
454 // number without knowing the number or total Cu layers in the legacy board.
455 // We do not have that information here, so simply set all layers ON. User
456 // can turn them off in the UI.
457 aPcbPlotParams->m_layerSelection = LSET( { F_SilkS, B_SilkS } ) | LSET::AllCuMask();
458 }
459 else if( cur.find_first_of( "0x" ) == 0 ) // pretty ver. 4.
460 {
461 // skip the leading 2 0x bytes.
462 aPcbPlotParams->m_layerSelection.ParseHex( cur.c_str() + 2, cur.size() - 2 );
463 }
464 else
465 {
466 Expecting( "integer or hex layerSelection" );
467 }
468
469 break;
470 }
471
472 case T_plot_on_all_layers_selection:
473 {
474 token = NeedSYMBOLorNUMBER();
475
476 const std::string& cur = CurStr();
477
478 if( cur.find_first_of( "0x" ) == 0 )
479 {
480 // skip the leading 2 0x bytes.
481 aPcbPlotParams->m_plotOnAllLayersSelection.ParseHex( cur.c_str() + 2,
482 cur.size() - 2 );
483 }
484 else
485 {
486 Expecting( "hex plot_on_all_layers_selection" );
487 }
488
489 break;
490 }
491
492 case T_disableapertmacros:
493 aPcbPlotParams->m_gerberDisableApertMacros = parseBool();
494 break;
495
496 case T_usegerberextensions:
497 aPcbPlotParams->m_useGerberProtelExtensions = parseBool();
498 break;
499
500 case T_usegerberattributes:
501 aPcbPlotParams->m_useGerberX2format = parseBool();
502 break;
503
504 case T_usegerberadvancedattributes:
505 aPcbPlotParams->m_includeGerberNetlistInfo = parseBool();
506 break;
507
508 case T_creategerberjobfile:
509 aPcbPlotParams->m_createGerberJobFile = parseBool();
510 break;
511
512 case T_gerberprecision:
513 aPcbPlotParams->m_gerberPrecision = parseInt( gbrDefaultPrecision - 1,
515 break;
516
517 case T_dashed_line_dash_ratio:
518 aPcbPlotParams->m_dashedLineDashRatio = parseDouble();
519 break;
520
521 case T_dashed_line_gap_ratio:
522 aPcbPlotParams->m_dashedLineGapRatio = parseDouble();
523 break;
524
525 case T_svgprecision:
527 break;
528
529 case T_svguseinch:
530 parseBool(); // Unused. For compatibility
531 break;
532
533 case T_psa4output:
534 aPcbPlotParams->m_A4Output = parseBool();
535 break;
536
537 case T_excludeedgelayer:
538 if( !parseBool() )
539 aPcbPlotParams->m_plotOnAllLayersSelection.set( Edge_Cuts );
540
541 break;
542
543 case T_plotframeref:
544 aPcbPlotParams->m_plotDrawingSheet = parseBool();
545 break;
546
547 case T_viasonmask:
548 aPcbPlotParams->m_plotViaOnMaskLayer = parseBool();
549 break;
550
551 case T_mode:
552 aPcbPlotParams->SetPlotMode( parseInt( 0, 2 ) > 1 ? SKETCH : FILLED );
553 break;
554
555 case T_useauxorigin:
556 aPcbPlotParams->m_useAuxOrigin = parseBool();
557 break;
558
559 case T_hpglpennumber:
561 break;
562
563 case T_hpglpenspeed:
565 break;
566
567 case T_hpglpendiameter:
568 aPcbPlotParams->m_HPGLPenDiam = parseDouble();
569 break;
570
571 case T_hpglpenoverlay:
572 // No more used. just here for compatibility with old versions
574 break;
575
576 case T_pdf_front_fp_property_popups:
577 aPcbPlotParams->m_PDFFrontFPPropertyPopups = parseBool();
578 break;
579
580 case T_pdf_back_fp_property_popups:
581 aPcbPlotParams->m_PDFFrontFPPropertyPopups = parseBool();
582 break;
583
584 case T_pdf_metadata:
585 aPcbPlotParams->m_PDFMetadata = parseBool();
586 break;
587
588 case T_dxfpolygonmode:
589 aPcbPlotParams->m_DXFPolygonMode = parseBool();
590 break;
591
592 case T_dxfimperialunits:
593 aPcbPlotParams->m_DXFUnits = parseBool() ? DXF_UNITS::INCHES
594 : DXF_UNITS::MILLIMETERS;
595 break;
596
597 case T_dxfusepcbnewfont:
598 aPcbPlotParams->m_textMode = parseBool() ? PLOT_TEXT_MODE::DEFAULT
599 : PLOT_TEXT_MODE::NATIVE;
600 break;
601
602 case T_pscolor:
603 NeedSYMBOL(); // This actually was never used...
604 break;
605
606 case T_psnegative:
607 aPcbPlotParams->m_negative = parseBool();
608 break;
609
610 case T_plotreference:
611 aPcbPlotParams->m_plotReference = parseBool();
612 break;
613
614 case T_plotfptext:
615 aPcbPlotParams->m_plotFPText = parseBool();
616 break;
617
618 case T_plotvalue:
619 aPcbPlotParams->m_plotValue = parseBool();
620 break;
621
622 case T_plotinvisibletext:
623 aPcbPlotParams->m_plotInvisibleText = parseBool();
624 break;
625
626 case T_sketchpadsonfab:
627 aPcbPlotParams->m_sketchPadsOnFabLayers= parseBool();
628 break;
629
630 case T_plotpadnumbers:
631 aPcbPlotParams->m_plotPadNumbers = parseBool();
632 break;
633
634 case T_subtractmaskfromsilk:
635 aPcbPlotParams->m_subtractMaskFromSilk = parseBool();
636 break;
637
638 case T_outputformat:
639 aPcbPlotParams->m_format = static_cast<PLOT_FORMAT>(
640 parseInt( static_cast<int>( PLOT_FORMAT::FIRST_FORMAT ),
641 static_cast<int>( PLOT_FORMAT::LAST_FORMAT ) ) );
642 break;
643
644 case T_mirror:
645 aPcbPlotParams->m_mirror = parseBool();
646 break;
647
648 case T_drillshape:
649 aPcbPlotParams->m_drillMarks = static_cast<DRILL_MARKS> ( parseInt( 0, 2 ) );
650 break;
651
652 case T_scaleselection:
653 aPcbPlotParams->m_scaleSelection = parseInt( 0, 4 );
654 break;
655
656 case T_outputdirectory:
657 NeedSYMBOLorNUMBER(); // a dir name can be like a number
658 aPcbPlotParams->m_outputDirectory = From_UTF8( CurText() );
659 break;
660
661 default:
662 skipCurrent(); // skip unknown or outdated plot parameter
663 skip_right = true; // the closing right token is already read.
664 break;
665 }
666
667 if( ! skip_right )
668 NeedRIGHT();
669 }
670}
671
672
674{
675 T token = NeedSYMBOL();
676
677 switch( token )
678 {
679 case T_false:
680 case T_no:
681 return false;
682
683 case T_true:
684 case T_yes:
685 return true;
686
687 default:
688 Expecting( "true, false, yes, or no" );
689 return false;
690 }
691}
692
693
694int PCB_PLOT_PARAMS_PARSER::parseInt( int aMin, int aMax )
695{
696 T token = NextTok();
697
698 if( token != T_NUMBER )
699 Expecting( T_NUMBER );
700
701 int val = atoi( CurText() );
702
703 if( val < aMin )
704 val = aMin;
705 else if( val > aMax )
706 val = aMax;
707
708 return val;
709}
710
711
713{
714 T token = NextTok();
715
716 if( token != T_NUMBER )
717 Expecting( T_NUMBER );
718
719 return DSNLEXER::parseDouble();
720}
721
722
724{
725 int curr_level = 0;
726 T token;
727
728 while( ( token = NextTok() ) != T_EOF )
729 {
730 if( token == T_LEFT )
731 curr_level--;
732
733 if( token == T_RIGHT )
734 {
735 curr_level++;
736
737 if( curr_level > 0 )
738 return;
739 }
740 }
741}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
BASE_SET & set(size_t pos=std::numeric_limits< size_t >::max(), bool value=true)
Definition: base_set.h:62
double parseDouble()
Parse the current token as an ASCII numeric string with possible leading whitespace into a double pre...
Definition: dsnlexer.cpp:844
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:93
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:35
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:340
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:732
std::string FmtHex() const
Return a hex string showing contents of this LSEQ.
Definition: lset.cpp:302
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:322
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:458
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
std::optional< bool > m_plotViaOnMaskLayer
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)
DXF_UNITS m_DXFUnits
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_PDFMetadata
Generate PDF metadata for SUBJECT and AUTHOR.
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.
PLOT_FORMAT m_format
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
Deprecated; only used for reading legacy files.
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
Plot pad numbers when sketching pads on fab layers.
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.
OUTLINE_MODE GetPlotMode() const
LSET m_layerSelection
Plot format type (chooses the driver to be used)
bool m_plotPadNumbers
FILLED or SKETCH for filled objects.
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)
static const bool FILLED
Definition: gr_basic.cpp:30
@ Edge_Cuts
Definition: layer_ids.h:113
@ F_Paste
Definition: layer_ids.h:101
@ B_Mask
Definition: layer_ids.h:106
@ F_Mask
Definition: layer_ids.h:107
@ B_Paste
Definition: layer_ids.h:100
@ F_SilkS
Definition: layer_ids.h:104
@ B_SilkS
Definition: layer_ids.h:103
void FormatBool(OUTPUTFORMATTER *aOut, int aNestLevel, const wxString &aKey, bool aValue, char aSuffix)
Writes a boolean to the formatter, in the style (aKey [yes|no])
@ SKETCH
Definition: outline_mode.h:26
#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.
Definition: plotter.h:65
wxString From_UTF8(const char *cstring)
constexpr int mmToIU(double mm) const
Definition: base_units.h:88