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 <math/util.h> // for KiROUND
30#include <pcb_plot_params.h>
32#include <plotters/plotter.h>
35
36
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 4
49
50
51// default trailing digits in Gerber coordinates, when units are mm
52// This is also the max usable precision (i.e. internal Pcbnew Units)
53static const int gbrDefaultPrecision = 6;
54
55
56using namespace PCBPLOTPARAMS_T;
57
58
59static const char* getTokenName( T aTok )
60{
61 return PCB_PLOT_PARAMS_LEXER::TokenName( aTok );
62}
63
64
65static bool setInt( int* aTarget, int aValue, int aMin, int aMax )
66{
67 int temp = aValue;
68
69 if( aValue < aMin )
70 temp = aMin;
71 else if( aValue > aMax )
72 temp = aMax;
73
74 *aTarget = temp;
75 return ( temp == aValue );
76}
77
78
79static bool setDouble( double* aTarget, double aValue, double aMin, double aMax )
80{
81 double temp = aValue;
82
83 if( aValue < aMin )
84 temp = aMin;
85 else if( aValue > aMax )
86 temp = aMax;
87
88 *aTarget = temp;
89 return ( temp == aValue );
90}
91
92
94{
101 m_dashedLineDashRatio = 12.0; // From ISO 128-2
102 m_dashedLineGapRatio = 3.0; // From ISO 128-2
103
104 // we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm
106 m_plotDrawingSheet = false;
108 m_DXFPolygonMode = true;
109 m_DXFUnits = DXF_UNITS::INCHES;
110 m_useAuxOrigin = false;
111 m_HPGLPenNum = 1;
112 m_HPGLPenSpeed = 20; // this param is always in cm/s
113 m_HPGLPenDiam = 15; // in mils
114 m_negative = false;
115 m_A4Output = false;
116 m_plotReference = true;
117 m_plotValue = true;
118 m_plotFPText = true;
119 m_plotInvisibleText = false;
121 m_plotPadNumbers = false;
123 m_format = PLOT_FORMAT::GERBER;
124 m_mirror = false;
125 m_drillMarks = DRILL_MARKS::SMALL_DRILL_SHAPE;
126 m_autoScale = false;
127 m_scale = 1.0;
129 m_fineScaleAdjustX = 1.0;
130 m_fineScaleAdjustY = 1.0;
131 m_widthAdjust = 0.;
132 m_textMode = PLOT_TEXT_MODE::DEFAULT;
133 m_outputDirectory.clear();
136 | LSET::AllCuMask();
137
140 m_PDFMetadata = true;
141
142 // This parameter controls if the NPTH pads will be plotted or not
143 // it is a "local" parameter
144 m_skipNPTH_Pads = false;
145
146 // line width to plot items in outline mode.
148
149 m_default_colors = std::make_shared<COLOR_SETTINGS>();
151
152 m_blackAndWhite = true;
153}
154
155
157{
158 // Currently Gerber files use mm.
159 // accepted precision is only 6 (max value, this is the resolution of Pcbnew)
160 // or 5, min value for professional boards, when 6 creates problems
161 // to board makers.
162
165}
166
167
168void PCB_PLOT_PARAMS::SetSvgPrecision( unsigned aPrecision )
169{
171}
172
173
175 int aNestLevel, int aControl ) const
176{
177 aFormatter->Print( aNestLevel, "(pcbplotparams\n" );
178
179 aFormatter->Print( aNestLevel+1, "(layerselection 0x%s)\n",
180 m_layerSelection.FmtHex().c_str() );
181
182 aFormatter->Print( aNestLevel+1, "(plot_on_all_layers_selection 0x%s)\n",
184
185 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "disableapertmacros",
187
188 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "usegerberextensions",
190
191 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "usegerberattributes",
193
194 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "usegerberadvancedattributes",
196
197 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "creategerberjobfile",
199
200 // save this option only if it is not the default value,
201 // to avoid incompatibility with older Pcbnew version
203 aFormatter->Print( aNestLevel+1, "(gerberprecision %d)\n", m_gerberPrecision );
204
205 aFormatter->Print( aNestLevel+1, "(dashed_line_dash_ratio %f)\n", GetDashedLineDashRatio() );
206 aFormatter->Print( aNestLevel+1, "(dashed_line_gap_ratio %f)\n", GetDashedLineGapRatio() );
207
208 // SVG options
209 aFormatter->Print( aNestLevel+1, "(svgprecision %d)\n", m_svgPrecision );
210
211 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotframeref", m_plotDrawingSheet );
212 aFormatter->Print( aNestLevel+1, "(mode %d)\n", GetPlotMode() == SKETCH ? 2 : 1 );
213 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "useauxorigin", m_useAuxOrigin );
214
215 // HPGL options
216 aFormatter->Print( aNestLevel+1, "(hpglpennumber %d)\n", m_HPGLPenNum );
217 aFormatter->Print( aNestLevel+1, "(hpglpenspeed %d)\n", m_HPGLPenSpeed );
218 aFormatter->Print( aNestLevel+1, "(hpglpendiameter %f)\n", m_HPGLPenDiam );
219
220 // PDF options
221 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1,
222 getTokenName( T_pdf_front_fp_property_popups ),
224 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1,
225 getTokenName( T_pdf_back_fp_property_popups ),
227 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1,
228 getTokenName( T_pdf_metadata ),
230
231 // DXF options
232 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, getTokenName( T_dxfpolygonmode ),
234 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, getTokenName( T_dxfimperialunits ),
235 m_DXFUnits == DXF_UNITS::INCHES );
236 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, getTokenName( T_dxfusepcbnewfont ),
237 m_textMode != PLOT_TEXT_MODE::NATIVE );
238
239 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, getTokenName( T_psnegative ),
240 m_negative );
241 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, getTokenName( T_psa4output ),
242 m_A4Output );
243
244 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotreference", m_plotReference );
245 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotvalue", m_plotValue );
246 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotfptext", m_plotFPText );
247 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotinvisibletext", m_plotInvisibleText );
248 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "sketchpadsonfab", m_sketchPadsOnFabLayers );
249 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "plotpadnumbers", m_plotPadNumbers );
250 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "subtractmaskfromsilk", m_subtractMaskFromSilk );
251 aFormatter->Print( aNestLevel+1, "(outputformat %d)\n", static_cast<int>( m_format ) );
252 KICAD_FORMAT::FormatBool( aFormatter, aNestLevel + 1, "mirror", m_mirror );
253 aFormatter->Print( aNestLevel+1, "(drillshape %d)\n", (int)m_drillMarks );
254 aFormatter->Print( aNestLevel+1, "(scaleselection %d)\n", m_scaleSelection );
255 aFormatter->Print( aNestLevel+1, "(outputdirectory \"%s\")",
256 (const char*) m_outputDirectory.utf8_str() );
257 aFormatter->Print( 0, "\n" );
258 aFormatter->Print( aNestLevel, ")\n" );
259}
260
261
263{
264 aParser->Parse( this );
265}
266
267
268bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
269{
270 if( m_layerSelection != aPcbPlotParams.m_layerSelection )
271 return false;
272
274 return false;
275
277 return false;
278
280 return false;
281
282 if( m_useGerberX2format != aPcbPlotParams.m_useGerberX2format )
283 return false;
284
286 return false;
287
288 if( m_createGerberJobFile != aPcbPlotParams.m_createGerberJobFile )
289 return false;
290
291 if( m_gerberPrecision != aPcbPlotParams.m_gerberPrecision )
292 return false;
293
294 if( m_dashedLineDashRatio != aPcbPlotParams.m_dashedLineDashRatio )
295 return false;
296
297 if( m_dashedLineGapRatio != aPcbPlotParams.m_dashedLineGapRatio )
298 return false;
299
300 if( m_plotDrawingSheet != aPcbPlotParams.m_plotDrawingSheet )
301 return false;
302
303 if( m_plotMode != aPcbPlotParams.m_plotMode )
304 return false;
305
306 if( m_DXFPolygonMode != aPcbPlotParams.m_DXFPolygonMode )
307 return false;
308
309 if( m_DXFUnits != aPcbPlotParams.m_DXFUnits )
310 return false;
311
312 if( m_svgPrecision != aPcbPlotParams.m_svgPrecision )
313 return false;
314
315 if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
316 return false;
317
318 if( m_HPGLPenNum != aPcbPlotParams.m_HPGLPenNum )
319 return false;
320
321 if( m_HPGLPenSpeed != aPcbPlotParams.m_HPGLPenSpeed )
322 return false;
323
324 if( m_HPGLPenDiam != aPcbPlotParams.m_HPGLPenDiam )
325 return false;
326
327 if( m_negative != aPcbPlotParams.m_negative )
328 return false;
329
331 return false;
332
334 return false;
335
336 if( m_PDFMetadata != aPcbPlotParams.m_PDFMetadata )
337 return false;
338
339 if( m_A4Output != aPcbPlotParams.m_A4Output )
340 return false;
341
342 if( m_plotReference != aPcbPlotParams.m_plotReference )
343 return false;
344
345 if( m_plotValue != aPcbPlotParams.m_plotValue )
346 return false;
347
348 if( m_plotFPText != aPcbPlotParams.m_plotFPText )
349 return false;
350
351 if( m_plotInvisibleText != aPcbPlotParams.m_plotInvisibleText )
352 return false;
353
355 return false;
356
357 if( m_plotPadNumbers != aPcbPlotParams.m_plotPadNumbers )
358 return false;
359
360 if( m_subtractMaskFromSilk != aPcbPlotParams.m_subtractMaskFromSilk )
361 return false;
362
363 if( m_format != aPcbPlotParams.m_format )
364 return false;
365
366 if( m_mirror != aPcbPlotParams.m_mirror )
367 return false;
368
369 if( m_drillMarks != aPcbPlotParams.m_drillMarks )
370 return false;
371
372 if( m_scaleSelection != aPcbPlotParams.m_scaleSelection )
373 return false;
374
375 if( m_autoScale != aPcbPlotParams.m_autoScale )
376 return false;
377
378 if( m_scale != aPcbPlotParams.m_scale )
379 return false;
380
381 if( m_fineScaleAdjustX != aPcbPlotParams.m_fineScaleAdjustX )
382 return false;
383
384 if( m_fineScaleAdjustY != aPcbPlotParams.m_fineScaleAdjustY )
385 return false;
386
387 if( m_widthAdjust != aPcbPlotParams.m_widthAdjust )
388 return false;
389
390 if( m_textMode != aPcbPlotParams.m_textMode )
391 return false;
392
393 if( m_blackAndWhite != aPcbPlotParams.m_blackAndWhite )
394 return false;
395
396 if( !m_outputDirectory.IsSameAs( aPcbPlotParams.m_outputDirectory ) )
397 return false;
398
399 return true;
400}
401
402
404{
406}
407
408
410{
412}
413
414
416 PCB_PLOT_PARAMS_LEXER( aReader )
417{
418}
419
420
421PCB_PLOT_PARAMS_PARSER::PCB_PLOT_PARAMS_PARSER( char* aLine, const wxString& aSource ) :
422 PCB_PLOT_PARAMS_LEXER( aLine, aSource )
423{
424}
425
426
428{
429 T token;
430
431 while( ( token = NextTok() ) != T_RIGHT )
432 {
433 if( token == T_EOF)
434 Unexpected( T_EOF );
435
436 if( token == T_LEFT )
437 token = NextTok();
438
439 if( token == T_pcbplotparams )
440 continue;
441
442 bool skip_right = false;
443
444 switch( token )
445 {
446 case T_layerselection:
447 {
448 token = NeedSYMBOLorNUMBER();
449
450 const std::string& cur = CurStr();
451
452 if( token == T_NUMBER ) // pretty 3 format had legacy Cu stack.
453 {
454 // It's not possible to convert a legacy Cu layer number to a new Cu layer
455 // number without knowing the number or total Cu layers in the legacy board.
456 // We do not have that information here, so simply set all layers ON. User
457 // can turn them off in the UI.
458 aPcbPlotParams->m_layerSelection = LSET( { F_SilkS, B_SilkS } ) | LSET::AllCuMask();
459 }
460 else if( cur.find_first_of( "0x" ) == 0 ) // pretty ver. 4.
461 {
462 // skip the leading 2 0x bytes.
463 aPcbPlotParams->m_layerSelection.ParseHex( cur.c_str() + 2, cur.size() - 2 );
464 }
465 else
466 {
467 Expecting( "integer or hex layerSelection" );
468 }
469
470 break;
471 }
472
473 case T_plot_on_all_layers_selection:
474 {
475 token = NeedSYMBOLorNUMBER();
476
477 const std::string& cur = CurStr();
478
479 if( cur.find_first_of( "0x" ) == 0 )
480 {
481 // skip the leading 2 0x bytes.
482 aPcbPlotParams->m_plotOnAllLayersSelection.ParseHex( cur.c_str() + 2,
483 cur.size() - 2 );
484 }
485 else
486 {
487 Expecting( "hex plot_on_all_layers_selection" );
488 }
489
490 break;
491 }
492
493 case T_disableapertmacros:
494 aPcbPlotParams->m_gerberDisableApertMacros = parseBool();
495 break;
496
497 case T_usegerberextensions:
498 aPcbPlotParams->m_useGerberProtelExtensions = parseBool();
499 break;
500
501 case T_usegerberattributes:
502 aPcbPlotParams->m_useGerberX2format = parseBool();
503 break;
504
505 case T_usegerberadvancedattributes:
506 aPcbPlotParams->m_includeGerberNetlistInfo = parseBool();
507 break;
508
509 case T_creategerberjobfile:
510 aPcbPlotParams->m_createGerberJobFile = parseBool();
511 break;
512
513 case T_gerberprecision:
514 aPcbPlotParams->m_gerberPrecision = parseInt( gbrDefaultPrecision - 1,
516 break;
517
518 case T_dashed_line_dash_ratio:
519 aPcbPlotParams->m_dashedLineDashRatio = parseDouble();
520 break;
521
522 case T_dashed_line_gap_ratio:
523 aPcbPlotParams->m_dashedLineGapRatio = parseDouble();
524 break;
525
526 case T_svgprecision:
528 break;
529
530 case T_svguseinch:
531 parseBool(); // Unused. For compatibility
532 break;
533
534 case T_psa4output:
535 aPcbPlotParams->m_A4Output = parseBool();
536 break;
537
538 case T_excludeedgelayer:
539 if( !parseBool() )
540 aPcbPlotParams->m_plotOnAllLayersSelection.set( Edge_Cuts );
541
542 break;
543
544 case T_plotframeref:
545 aPcbPlotParams->m_plotDrawingSheet = parseBool();
546 break;
547
548 case T_viasonmask:
549 aPcbPlotParams->m_plotViaOnMaskLayer = parseBool();
550 break;
551
552 case T_mode:
553 aPcbPlotParams->SetPlotMode( parseInt( 0, 2 ) > 1 ? SKETCH : FILLED );
554 break;
555
556 case T_useauxorigin:
557 aPcbPlotParams->m_useAuxOrigin = parseBool();
558 break;
559
560 case T_hpglpennumber:
562 break;
563
564 case T_hpglpenspeed:
566 break;
567
568 case T_hpglpendiameter:
569 aPcbPlotParams->m_HPGLPenDiam = parseDouble();
570 break;
571
572 case T_hpglpenoverlay:
573 // No more used. just here for compatibility with old versions
575 break;
576
577 case T_pdf_front_fp_property_popups:
578 aPcbPlotParams->m_PDFFrontFPPropertyPopups = parseBool();
579 break;
580
581 case T_pdf_back_fp_property_popups:
582 aPcbPlotParams->m_PDFFrontFPPropertyPopups = parseBool();
583 break;
584
585 case T_pdf_metadata:
586 aPcbPlotParams->m_PDFMetadata = parseBool();
587 break;
588
589 case T_dxfpolygonmode:
590 aPcbPlotParams->m_DXFPolygonMode = parseBool();
591 break;
592
593 case T_dxfimperialunits:
594 aPcbPlotParams->m_DXFUnits = parseBool() ? DXF_UNITS::INCHES
595 : DXF_UNITS::MILLIMETERS;
596 break;
597
598 case T_dxfusepcbnewfont:
599 aPcbPlotParams->m_textMode = parseBool() ? PLOT_TEXT_MODE::DEFAULT
600 : PLOT_TEXT_MODE::NATIVE;
601 break;
602
603 case T_pscolor:
604 NeedSYMBOL(); // This actually was never used...
605 break;
606
607 case T_psnegative:
608 aPcbPlotParams->m_negative = parseBool();
609 break;
610
611 case T_plotreference:
612 aPcbPlotParams->m_plotReference = parseBool();
613 break;
614
615 case T_plotfptext:
616 aPcbPlotParams->m_plotFPText = parseBool();
617 break;
618
619 case T_plotvalue:
620 aPcbPlotParams->m_plotValue = parseBool();
621 break;
622
623 case T_plotinvisibletext:
624 aPcbPlotParams->m_plotInvisibleText = parseBool();
625 break;
626
627 case T_sketchpadsonfab:
628 aPcbPlotParams->m_sketchPadsOnFabLayers= parseBool();
629 break;
630
631 case T_plotpadnumbers:
632 aPcbPlotParams->m_plotPadNumbers = parseBool();
633 break;
634
635 case T_subtractmaskfromsilk:
636 aPcbPlotParams->m_subtractMaskFromSilk = parseBool();
637 break;
638
639 case T_outputformat:
640 aPcbPlotParams->m_format = static_cast<PLOT_FORMAT>(
641 parseInt( static_cast<int>( PLOT_FORMAT::FIRST_FORMAT ),
642 static_cast<int>( PLOT_FORMAT::LAST_FORMAT ) ) );
643 break;
644
645 case T_mirror:
646 aPcbPlotParams->m_mirror = parseBool();
647 break;
648
649 case T_drillshape:
650 aPcbPlotParams->m_drillMarks = static_cast<DRILL_MARKS> ( parseInt( 0, 2 ) );
651 break;
652
653 case T_scaleselection:
654 aPcbPlotParams->m_scaleSelection = parseInt( 0, 4 );
655 break;
656
657 case T_outputdirectory:
658 NeedSYMBOLorNUMBER(); // a dir name can be like a number
659 aPcbPlotParams->m_outputDirectory = From_UTF8( CurText() );
660 break;
661
662 default:
663 skipCurrent(); // skip unknown or outdated plot parameter
664 skip_right = true; // the closing right token is already read.
665 break;
666 }
667
668 if( ! skip_right )
669 NeedRIGHT();
670 }
671}
672
673
675{
676 T token = NeedSYMBOL();
677
678 switch( token )
679 {
680 case T_false:
681 case T_no:
682 return false;
683
684 case T_true:
685 case T_yes:
686 return true;
687
688 default:
689 Expecting( "true, false, yes, or no" );
690 return false;
691 }
692}
693
694
695int PCB_PLOT_PARAMS_PARSER::parseInt( int aMin, int aMax )
696{
697 T token = NextTok();
698
699 if( token != T_NUMBER )
700 Expecting( T_NUMBER );
701
702 int val = atoi( CurText() );
703
704 if( val < aMin )
705 val = aMin;
706 else if( val > aMax )
707 val = aMax;
708
709 return val;
710}
711
712
714{
715 T token = NextTok();
716
717 if( token != T_NUMBER )
718 Expecting( T_NUMBER );
719
720 return DSNLEXER::parseDouble();
721}
722
723
725{
726 int curr_level = 0;
727 T token;
728
729 while( ( token = NextTok() ) != T_EOF )
730 {
731 if( token == T_LEFT )
732 curr_level--;
733
734 if( token == T_RIGHT )
735 {
736 curr_level++;
737
738 if( curr_level > 0 )
739 return;
740 }
741 }
742}
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:61
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
constexpr T Clamp(const T &lower, const T &value, const T &upper)
Limit value within the range lower <= value <= upper.
Definition: util.h:65