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 The 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#include <lseq.h>
35
36
37#define PLOT_LINEWIDTH_DEFAULT ( DEFAULT_TEXT_WIDTH * IU_PER_MM )
38
39#define SVG_PRECISION_MIN 3U
40#define SVG_PRECISION_MAX 6U
41#define SVG_PRECISION_DEFAULT 4
42
43
44// default trailing digits in Gerber coordinates, when units are mm
45// This is also the max usable precision (i.e. internal Pcbnew Units)
46static const int gbrDefaultPrecision = 6;
47
48
49using namespace PCBPLOTPARAMS_T;
50
51
52static const char* getTokenName( T aTok )
53{
54 return PCB_PLOT_PARAMS_LEXER::TokenName( aTok );
55}
56
57
59{
66 m_dashedLineDashRatio = 12.0; // From ISO 128-2
67 m_dashedLineGapRatio = 3.0; // From ISO 128-2
68
69 // we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm
71 m_svgFitPageToBoard = false;
72 m_plotDrawingSheet = false;
74 m_DXFPolygonMode = true;
75 m_DXFUnits = DXF_UNITS::INCH;
76 m_useAuxOrigin = false;
77 m_negative = false;
78 m_A4Output = false;
79 m_plotReference = true;
80 m_plotValue = true;
81 m_plotFPText = true;
86 m_plotPadNumbers = false;
88 m_format = PLOT_FORMAT::GERBER;
89 m_mirror = false;
90 m_drillMarks = DRILL_MARKS::SMALL_DRILL_SHAPE;
91 m_autoScale = false;
92 m_scale = 1.0;
96 m_widthAdjust = 0.;
97 m_textMode = PLOT_TEXT_MODE::DEFAULT;
98 m_outputDirectory.clear();
101 | LSET::AllCuMask();
102
105 m_PDFMetadata = true;
106 m_PDFSingle = false;
107
108 // This parameter controls if the NPTH pads will be plotted or not
109 // it is a "local" parameter
110 m_skipNPTH_Pads = false;
111
112 // line width to plot items in outline mode.
114
115 m_default_colors = std::make_shared<COLOR_SETTINGS>();
117
118 m_blackAndWhite = true;
119}
120
121
123{
124 // Currently Gerber files use mm.
125 // accepted precision is only 6 (max value, this is the resolution of Pcbnew)
126 // or 5, min value for professional boards, when 6 creates problems
127 // to board makers.
128
131}
132
133
134void PCB_PLOT_PARAMS::SetSvgPrecision( unsigned aPrecision )
135{
136 m_svgPrecision = std::clamp( aPrecision, SVG_PRECISION_MIN, SVG_PRECISION_MAX );
137}
138
139
141{
142 aFormatter->Print( "(pcbplotparams" );
143
144 aFormatter->Print( "(layerselection 0x%s)", m_layerSelection.FmtHex().c_str() );
145
146 LSET commonLayers;
147
148 for( PCB_LAYER_ID commonLayer : m_plotOnAllLayersSequence )
149 commonLayers.set( commonLayer );
150
151 aFormatter->Print( "(plot_on_all_layers_selection 0x%s)", commonLayers.FmtHex().c_str() );
152
153 KICAD_FORMAT::FormatBool( aFormatter, "disableapertmacros", m_gerberDisableApertMacros );
154 KICAD_FORMAT::FormatBool( aFormatter, "usegerberextensions", m_useGerberProtelExtensions );
155 KICAD_FORMAT::FormatBool( aFormatter, "usegerberattributes", GetUseGerberX2format() );
156 KICAD_FORMAT::FormatBool( aFormatter, "usegerberadvancedattributes", GetIncludeGerberNetlistInfo() );
157 KICAD_FORMAT::FormatBool( aFormatter, "creategerberjobfile", GetCreateGerberJobFile() );
158
159 // save this option only if it is not the default value,
160 // to avoid incompatibility with older Pcbnew version
162 aFormatter->Print( "(gerberprecision %d)", m_gerberPrecision );
163
164 aFormatter->Print( "(dashed_line_dash_ratio %s)", FormatDouble2Str( GetDashedLineDashRatio() ).c_str() );
165 aFormatter->Print( "(dashed_line_gap_ratio %s)", FormatDouble2Str( GetDashedLineGapRatio() ).c_str() );
166
167 // SVG options
168 aFormatter->Print( "(svgprecision %d)", m_svgPrecision );
169
170 KICAD_FORMAT::FormatBool( aFormatter, "plotframeref", m_plotDrawingSheet );
171 aFormatter->Print( "(mode %d)", GetDXFPlotMode() == SKETCH ? 2 : 1 );
172 KICAD_FORMAT::FormatBool( aFormatter, "useauxorigin", m_useAuxOrigin );
173
174 // PDF options
175 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_front_fp_property_popups ),
177 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_back_fp_property_popups ),
179 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_metadata ), m_PDFMetadata );
180 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_single_document ), m_PDFSingle );
181
182 // DXF options
183 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfpolygonmode ), m_DXFPolygonMode );
184 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfimperialunits ),
185 m_DXFUnits == DXF_UNITS::INCH );
186 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfusepcbnewfont ),
187 m_textMode != PLOT_TEXT_MODE::NATIVE );
188
189 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_psnegative ), m_negative );
190 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_psa4output ), m_A4Output );
191
192 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_plot_black_and_white ), m_blackAndWhite );
193
194 KICAD_FORMAT::FormatBool( aFormatter, "sketchpadsonfab", m_sketchPadsOnFabLayers );
195 KICAD_FORMAT::FormatBool( aFormatter, "plotpadnumbers", m_plotPadNumbers );
196 KICAD_FORMAT::FormatBool( aFormatter, "hidednponfab", m_hideDNPFPsOnFabLayers );
197 KICAD_FORMAT::FormatBool( aFormatter, "sketchdnponfab", m_sketchDNPFPsOnFabLayers );
198 KICAD_FORMAT::FormatBool( aFormatter, "crossoutdnponfab", m_crossoutDNPFPsOnFabLayers );
199 KICAD_FORMAT::FormatBool( aFormatter, "subtractmaskfromsilk", m_subtractMaskFromSilk );
200 aFormatter->Print( "(outputformat %d)", static_cast<int>( m_format ) );
201 KICAD_FORMAT::FormatBool( aFormatter, "mirror", m_mirror );
202 aFormatter->Print( "(drillshape %d)", (int)m_drillMarks );
203 aFormatter->Print( "(scaleselection %d)", m_scaleSelection );
204 aFormatter->Print( "(outputdirectory %s)", aFormatter->Quotew( m_outputDirectory ).c_str() );
205 aFormatter->Print( ")" );
206}
207
208
210{
211 aParser->Parse( this );
212}
213
214
215bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
216{
217 if( m_layerSelection != aPcbPlotParams.m_layerSelection )
218 return false;
219
221 return false;
222
224 return false;
225
227 return false;
228
229 if( m_useGerberX2format != aPcbPlotParams.m_useGerberX2format )
230 return false;
231
233 return false;
234
235 if( m_createGerberJobFile != aPcbPlotParams.m_createGerberJobFile )
236 return false;
237
238 if( m_gerberPrecision != aPcbPlotParams.m_gerberPrecision )
239 return false;
240
241 if( m_dashedLineDashRatio != aPcbPlotParams.m_dashedLineDashRatio )
242 return false;
243
244 if( m_dashedLineGapRatio != aPcbPlotParams.m_dashedLineGapRatio )
245 return false;
246
247 if( m_plotDrawingSheet != aPcbPlotParams.m_plotDrawingSheet )
248 return false;
249
250 if( m_DXFPlotMode != aPcbPlotParams.m_DXFPlotMode )
251 return false;
252
253 if( m_DXFPolygonMode != aPcbPlotParams.m_DXFPolygonMode )
254 return false;
255
256 if( m_DXFUnits != aPcbPlotParams.m_DXFUnits )
257 return false;
258
259 if( m_svgPrecision != aPcbPlotParams.m_svgPrecision )
260 return false;
261
262 if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
263 return false;
264
265 if( m_negative != aPcbPlotParams.m_negative )
266 return false;
267
269 return false;
270
272 return false;
273
274 if( m_PDFMetadata != aPcbPlotParams.m_PDFMetadata )
275 return false;
276
277 if( m_A4Output != aPcbPlotParams.m_A4Output )
278 return false;
279
280 if( m_plotReference != aPcbPlotParams.m_plotReference )
281 return false;
282
283 if( m_plotValue != aPcbPlotParams.m_plotValue )
284 return false;
285
286 if( m_plotFPText != aPcbPlotParams.m_plotFPText )
287 return false;
288
290 return false;
291
292 if( m_plotPadNumbers != aPcbPlotParams.m_plotPadNumbers )
293 return false;
294
296 return false;
297
299 return false;
300
302 return false;
303
304 if( m_subtractMaskFromSilk != aPcbPlotParams.m_subtractMaskFromSilk )
305 return false;
306
307 if( m_format != aPcbPlotParams.m_format )
308 return false;
309
310 if( m_mirror != aPcbPlotParams.m_mirror )
311 return false;
312
313 if( m_drillMarks != aPcbPlotParams.m_drillMarks )
314 return false;
315
316 if( m_scaleSelection != aPcbPlotParams.m_scaleSelection )
317 return false;
318
319 if( m_autoScale != aPcbPlotParams.m_autoScale )
320 return false;
321
322 if( m_scale != aPcbPlotParams.m_scale )
323 return false;
324
325 if( m_fineScaleAdjustX != aPcbPlotParams.m_fineScaleAdjustX )
326 return false;
327
328 if( m_fineScaleAdjustY != aPcbPlotParams.m_fineScaleAdjustY )
329 return false;
330
331 if( m_widthAdjust != aPcbPlotParams.m_widthAdjust )
332 return false;
333
334 if( m_textMode != aPcbPlotParams.m_textMode )
335 return false;
336
337 if( m_blackAndWhite != aPcbPlotParams.m_blackAndWhite )
338 return false;
339
340 if( !m_outputDirectory.IsSameAs( aPcbPlotParams.m_outputDirectory ) )
341 return false;
342
343 return true;
344}
345
346
348 PCB_PLOT_PARAMS_LEXER( aReader ),
349 m_boardFileVersion( aBoardFileVersion )
350{
351}
352
353
354PCB_PLOT_PARAMS_PARSER::PCB_PLOT_PARAMS_PARSER( char* aLine, const wxString& aSource ) :
355 PCB_PLOT_PARAMS_LEXER( aLine, aSource ),
356 m_boardFileVersion( 0 )
357{
358}
359
360
366{
369
402
405
408
411
414
421
424
427
428 // User definable layers.
438
440
441 // Four reserved layers (60 - 63) for future expansion within the 64 bit integer limit.
442
445
446/*
447 * Mapping to translate a legacy layer ID into the new PCB layer IDs.
448 */
449static const std::map<LEGACY_PCB_LAYER_ID, PCB_LAYER_ID> s_legacyLayerIdMap{
450 {LEGACY_F_Cu, F_Cu},
451 {LEGACY_B_Cu, B_Cu},
510};
511
512
513LSET remapLegacyLayerLSET( const BASE_SET& aLegacyLSET )
514{
515 LSET newLayers;
516
517 for( const auto& [legacyLayer, newLayer] : s_legacyLayerIdMap )
518 newLayers[newLayer] = aLegacyLSET[legacyLayer];
519
520 return newLayers;
521}
522
523
525{
526 T token;
527
528 while( ( token = NextTok() ) != T_RIGHT )
529 {
530 if( token == T_EOF)
531 Unexpected( T_EOF );
532
533 if( token == T_LEFT )
534 token = NextTok();
535
536 if( token == T_pcbplotparams )
537 continue;
538
539 bool skip_right = false;
540
541 switch( token )
542 {
543 case T_layerselection:
544 {
545 token = NeedSYMBOLorNUMBER();
546
547 const std::string& cur = CurStr();
548
549 if( token == T_NUMBER ) // pretty 3 format had legacy Cu stack.
550 {
551 // It's not possible to convert a legacy Cu layer number to a new Cu layer
552 // number without knowing the number or total Cu layers in the legacy board.
553 // We do not have that information here, so simply set all layers ON. User
554 // can turn them off in the UI.
555 aPcbPlotParams->m_layerSelection = LSET( { F_SilkS, B_SilkS } ) | LSET::AllCuMask();
556 }
557 else if( cur.find_first_of( "0x" ) == 0 ) // pretty ver. 4.
558 {
559 // The layers were renumbered in 5e0abadb23425765e164f49ee2f893e94ddb97fc, but there wasn't
560 // a board file version change with it, so this value is the one immediately after that happened.
561 if( m_boardFileVersion < 20240819 )
562 {
564
565 // skip the leading 2 0x bytes.
566 legacyLSET.ParseHex( cur.c_str() + 2, cur.size() - 2 );
567 aPcbPlotParams->SetLayerSelection( remapLegacyLayerLSET( legacyLSET ) );
568 }
569 else
570 {
571 // skip the leading 2 0x bytes.
572 aPcbPlotParams->m_layerSelection.ParseHex( cur.c_str() + 2, cur.size() - 2 );
573 }
574 }
575 else
576 {
577 Expecting( "integer or hex layerSelection" );
578 }
579
580 break;
581 }
582
583 case T_plot_on_all_layers_selection:
584 {
585 token = NeedSYMBOLorNUMBER();
586
587 const std::string& cur = CurStr();
588
589 if( cur.find_first_of( "0x" ) == 0 )
590 {
591 LSET layers;
592
593 // The layers were renumbered in 5e0abadb23425765e164f49ee2f893e94ddb97fc, but
594 // there wasn't a board file version change with it, so this value is the one
595 // immediately after that happened.
596 if( m_boardFileVersion < 20240819 )
597 {
599
600 // skip the leading 2 0x bytes.
601 legacyLSET.ParseHex( cur.c_str() + 2, cur.size() - 2 );
602
603 layers = remapLegacyLayerLSET( legacyLSET );
604 }
605 else
606 {
607 // skip the leading 2 0x bytes.
608 layers.ParseHex( cur.c_str() + 2, cur.size() - 2 );
609 }
610
611 aPcbPlotParams->SetPlotOnAllLayersSequence( layers.SeqStackupForPlotting() );
612 }
613 else
614 {
615 Expecting( "hex plot_on_all_layers_selection" );
616 }
617
618 break;
619 }
620
621 case T_disableapertmacros:
622 aPcbPlotParams->m_gerberDisableApertMacros = parseBool();
623 break;
624
625 case T_usegerberextensions:
626 aPcbPlotParams->m_useGerberProtelExtensions = parseBool();
627 break;
628
629 case T_usegerberattributes:
630 aPcbPlotParams->m_useGerberX2format = parseBool();
631 break;
632
633 case T_usegerberadvancedattributes:
634 aPcbPlotParams->m_includeGerberNetlistInfo = parseBool();
635 break;
636
637 case T_creategerberjobfile:
638 aPcbPlotParams->m_createGerberJobFile = parseBool();
639 break;
640
641 case T_gerberprecision:
642 aPcbPlotParams->m_gerberPrecision = parseInt( gbrDefaultPrecision - 1,
644 break;
645
646 case T_dashed_line_dash_ratio:
647 aPcbPlotParams->m_dashedLineDashRatio = parseDouble();
648 break;
649
650 case T_dashed_line_gap_ratio:
651 aPcbPlotParams->m_dashedLineGapRatio = parseDouble();
652 break;
653
654 case T_svgprecision:
656 break;
657
658 case T_svguseinch:
659 parseBool(); // Unused. For compatibility
660 break;
661
662 case T_psa4output:
663 aPcbPlotParams->m_A4Output = parseBool();
664 break;
665
666 case T_excludeedgelayer:
667 if( !parseBool() )
668 aPcbPlotParams->m_plotOnAllLayersSequence.push_back( Edge_Cuts );
669
670 break;
671
672 case T_plotframeref:
673 aPcbPlotParams->m_plotDrawingSheet = parseBool();
674 break;
675
676 case T_viasonmask:
677 aPcbPlotParams->m_plotViaOnMaskLayer = parseBool();
678 break;
679
680 case T_useauxorigin:
681 aPcbPlotParams->m_useAuxOrigin = parseBool();
682 break;
683
684 case T_mode:
685 case T_hpglpennumber:
686 case T_hpglpenspeed:
687 case T_hpglpenoverlay:
688 // HPGL is no longer supported
689 parseInt( std::numeric_limits<int>::min(), std::numeric_limits<int>::max() );
690 break;
691
692 case T_pdf_front_fp_property_popups:
693 aPcbPlotParams->m_PDFFrontFPPropertyPopups = parseBool();
694 break;
695
696 case T_pdf_back_fp_property_popups:
697 aPcbPlotParams->m_PDFBackFPPropertyPopups = parseBool();
698 break;
699
700 case T_pdf_metadata:
701 aPcbPlotParams->m_PDFMetadata = parseBool();
702 break;
703
704 case T_pdf_single_document:
705 aPcbPlotParams->m_PDFSingle = parseBool();
706 break;
707
708 case T_dxfpolygonmode:
709 aPcbPlotParams->m_DXFPolygonMode = parseBool();
710 break;
711
712 case T_dxfimperialunits:
713 aPcbPlotParams->m_DXFUnits = parseBool() ? DXF_UNITS::INCH : DXF_UNITS::MM;
714 break;
715
716 case T_dxfusepcbnewfont:
717 aPcbPlotParams->m_textMode = parseBool() ? PLOT_TEXT_MODE::DEFAULT
718 : PLOT_TEXT_MODE::NATIVE;
719 break;
720
721 case T_pscolor:
722 NeedSYMBOL(); // This actually was never used...
723 break;
724
725 case T_psnegative:
726 aPcbPlotParams->m_negative = parseBool();
727 break;
728
729 case T_plot_black_and_white:
730 aPcbPlotParams->m_blackAndWhite = parseBool();
731 break;
732
733 case T_plotinvisibletext: // legacy token; no longer supported
734 parseBool();
735 break;
736
737 case T_sketchpadsonfab:
738 aPcbPlotParams->m_sketchPadsOnFabLayers= parseBool();
739 break;
740
741 case T_plotpadnumbers:
742 aPcbPlotParams->m_plotPadNumbers = parseBool();
743 break;
744
745 case T_hidednponfab:
746 aPcbPlotParams->m_hideDNPFPsOnFabLayers = parseBool();
747 break;
748
749 case T_sketchdnponfab:
750 aPcbPlotParams->m_sketchDNPFPsOnFabLayers = parseBool();
751 break;
752
753 case T_crossoutdnponfab:
754 aPcbPlotParams->m_crossoutDNPFPsOnFabLayers = parseBool();
755 break;
756
757 case T_subtractmaskfromsilk:
758 aPcbPlotParams->m_subtractMaskFromSilk = parseBool();
759 break;
760
761 case T_outputformat:
762 aPcbPlotParams->m_format = static_cast<PLOT_FORMAT>(
763 parseInt( static_cast<int>( PLOT_FORMAT::FIRST_FORMAT ),
764 static_cast<int>( PLOT_FORMAT::LAST_FORMAT ) ) );
765 break;
766
767 case T_mirror:
768 aPcbPlotParams->m_mirror = parseBool();
769 break;
770
771 case T_drillshape:
772 aPcbPlotParams->m_drillMarks = static_cast<DRILL_MARKS> ( parseInt( 0, 2 ) );
773 break;
774
775 case T_scaleselection:
776 aPcbPlotParams->m_scaleSelection = parseInt( 0, 4 );
777 break;
778
779 case T_outputdirectory:
780 NeedSYMBOLorNUMBER(); // a dir name can be like a number
781 aPcbPlotParams->m_outputDirectory = From_UTF8( CurText() );
782 break;
783
784 default:
785 skipCurrent(); // skip unknown or outdated plot parameter
786 skip_right = true; // the closing right token is already read.
787 break;
788 }
789
790 if( ! skip_right )
791 NeedRIGHT();
792 }
793}
794
795
797{
798 T token = NeedSYMBOL();
799
800 switch( token )
801 {
802 case T_false:
803 case T_no:
804 return false;
805
806 case T_true:
807 case T_yes:
808 return true;
809
810 default:
811 Expecting( "true, false, yes, or no" );
812 return false;
813 }
814}
815
816
817int PCB_PLOT_PARAMS_PARSER::parseInt( int aMin, int aMax )
818{
819 T token = NextTok();
820
821 if( token != T_NUMBER )
822 Expecting( T_NUMBER );
823
824 int val = atoi( CurText() );
825
826 if( val < aMin )
827 val = aMin;
828 else if( val > aMax )
829 val = aMax;
830
831 return val;
832}
833
834
836{
837 T token = NextTok();
838
839 if( token != T_NUMBER )
840 Expecting( T_NUMBER );
841
842 return DSNLEXER::parseDouble();
843}
844
845
847{
848 int curr_level = 0;
849 T token;
850
851 while( ( token = NextTok() ) != T_EOF )
852 {
853 if( token == T_LEFT )
854 curr_level--;
855
856 if( token == T_RIGHT )
857 {
858 curr_level++;
859
860 if( curr_level > 0 )
861 return;
862 }
863 }
864}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:112
int ParseHex(const std::string &str)
Convert the output of FmtHex() and replaces this set's values with those given in the input string.
Definition: base_set.h:348
BASE_SET & set(size_t pos)
Definition: base_set.h:116
std::string FmtHex() const
Return a hex string showing contents of this set.
Definition: base_set.h:302
double parseDouble()
Parse the current token as an ASCII numeric string with possible leading whitespace into a double pre...
Definition: dsnlexer.cpp:854
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:37
LSEQ SeqStackupForPlotting() const
Return the sequence that is typical for a bottom-to-top stack-up.
Definition: lset.cpp:388
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:583
An interface used to output 8 bit text in a convenient way.
Definition: richio.h:322
std::string Quotew(const wxString &aWrapee) const
Definition: richio.cpp:548
int PRINTF_FUNC_N Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:463
The parser for PCB_PLOT_PARAMS.
void skipCurrent()
Skip the current token level.
PCB_PLOT_PARAMS_PARSER(LINE_READER *aReader, int aBoardFileVersion)
int parseInt(int aMin, int aMax)
Parse an integer and constrains it between two values.
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.
bool m_crossoutDNPFPsOnFabLayers
double m_dashedLineGapRatio
std::optional< bool > m_plotViaOnMaskLayer
void SetLayerSelection(const LSET &aSelection)
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.
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
FILLED or SKETCH for filled objects.
PLOT_TEXT_MODE m_textMode
Holes can be not plotted, have a small mark, or be plotted in actual size.
void SetPlotOnAllLayersSequence(LSEQ aSeq)
bool m_plotValue
Enable plotting of part values.
LSEQ m_plotOnAllLayersSequence
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)
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 m_PDFFrontFPPropertyPopups
Generate PDF property popup menus for footprints.
double m_fineScaleAdjustX
Compensation for printer scale errors (and therefore.
double m_dashedLineDashRatio
void SetGerberPrecision(int aPrecision)
bool m_blackAndWhite
Plot in negative color (supported only by some drivers)
DXF_OUTLINE_MODE GetDXFPlotMode() const override
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).
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 ?)
DXF_OUTLINE_MODE m_DXFPlotMode
unsigned m_svgPrecision
Precision of coordinates in SVG: accepted 3 - 6; 6 is the internal resolution of Pcbnew.
bool GetIncludeGerberNetlistInfo() const
bool m_PDFSingle
Generate a single PDF file for all layers.
double GetDashedLineGapRatio() const
bool m_PDFBackFPPropertyPopups
on front and/or back of board
bool m_sketchDNPFPsOnFabLayers
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.
void Format(OUTPUTFORMATTER *aFormatter) const
LSET m_layerSelection
Plot format type (chooses the driver to be used)
bool m_plotPadNumbers
Used to disable NPTH pads plotting on copper layers.
static const char * getTokenName(T aTok)
static const bool FILLED
Definition: gr_basic.cpp:30
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ In22_Cu
Definition: layer_ids.h:87
@ In11_Cu
Definition: layer_ids.h:76
@ In29_Cu
Definition: layer_ids.h:94
@ In30_Cu
Definition: layer_ids.h:95
@ User_8
Definition: layer_ids.h:131
@ F_CrtYd
Definition: layer_ids.h:116
@ In17_Cu
Definition: layer_ids.h:82
@ B_Adhes
Definition: layer_ids.h:103
@ Edge_Cuts
Definition: layer_ids.h:112
@ Dwgs_User
Definition: layer_ids.h:107
@ F_Paste
Definition: layer_ids.h:104
@ In9_Cu
Definition: layer_ids.h:74
@ Cmts_User
Definition: layer_ids.h:108
@ User_6
Definition: layer_ids.h:129
@ User_7
Definition: layer_ids.h:130
@ In19_Cu
Definition: layer_ids.h:84
@ In7_Cu
Definition: layer_ids.h:72
@ In28_Cu
Definition: layer_ids.h:93
@ In26_Cu
Definition: layer_ids.h:91
@ F_Adhes
Definition: layer_ids.h:102
@ B_Mask
Definition: layer_ids.h:98
@ B_Cu
Definition: layer_ids.h:65
@ User_5
Definition: layer_ids.h:128
@ Eco1_User
Definition: layer_ids.h:109
@ F_Mask
Definition: layer_ids.h:97
@ In21_Cu
Definition: layer_ids.h:86
@ In23_Cu
Definition: layer_ids.h:88
@ B_Paste
Definition: layer_ids.h:105
@ In15_Cu
Definition: layer_ids.h:80
@ In2_Cu
Definition: layer_ids.h:67
@ User_9
Definition: layer_ids.h:132
@ F_Fab
Definition: layer_ids.h:119
@ In10_Cu
Definition: layer_ids.h:75
@ Margin
Definition: layer_ids.h:113
@ F_SilkS
Definition: layer_ids.h:100
@ In4_Cu
Definition: layer_ids.h:69
@ B_CrtYd
Definition: layer_ids.h:115
@ Eco2_User
Definition: layer_ids.h:110
@ In16_Cu
Definition: layer_ids.h:81
@ In24_Cu
Definition: layer_ids.h:89
@ In1_Cu
Definition: layer_ids.h:66
@ Rescue
Definition: layer_ids.h:121
@ User_3
Definition: layer_ids.h:126
@ User_1
Definition: layer_ids.h:124
@ B_SilkS
Definition: layer_ids.h:101
@ In13_Cu
Definition: layer_ids.h:78
@ User_4
Definition: layer_ids.h:127
@ In8_Cu
Definition: layer_ids.h:73
@ In14_Cu
Definition: layer_ids.h:79
@ User_2
Definition: layer_ids.h:125
@ In12_Cu
Definition: layer_ids.h:77
@ In27_Cu
Definition: layer_ids.h:92
@ In6_Cu
Definition: layer_ids.h:71
@ In5_Cu
Definition: layer_ids.h:70
@ In3_Cu
Definition: layer_ids.h:68
@ In20_Cu
Definition: layer_ids.h:85
@ F_Cu
Definition: layer_ids.h:64
@ In18_Cu
Definition: layer_ids.h:83
@ In25_Cu
Definition: layer_ids.h:90
@ B_Fab
Definition: layer_ids.h:118
void FormatBool(OUTPUTFORMATTER *aOut, const wxString &aKey, bool aValue)
Writes a boolean to the formatter, in the style (aKey [yes|no])
#define SVG_PRECISION_MIN
static const char * getTokenName(T aTok)
static const std::map< LEGACY_PCB_LAYER_ID, PCB_LAYER_ID > s_legacyLayerIdMap
LEGACY_PCB_LAYER_ID
These are the layer IDs from before 5e0abadb23425765e164f49ee2f893e94ddb97fc, and are needed for mapp...
@ LEGACY_In2_Cu
@ LEGACY_User_8
@ LEGACY_UNSELECTED_LAYER
@ LEGACY_PCB_LAYER_ID_COUNT
@ LEGACY_Eco2_User
@ LEGACY_In21_Cu
@ LEGACY_Dwgs_User
@ LEGACY_F_Cu
@ LEGACY_In23_Cu
@ LEGACY_In7_Cu
@ LEGACY_In18_Cu
@ LEGACY_Cmts_User
@ LEGACY_UNDEFINED_LAYER
@ LEGACY_In27_Cu
@ LEGACY_User_9
@ LEGACY_F_SilkS
@ LEGACY_In14_Cu
@ LEGACY_B_CrtYd
@ LEGACY_User_6
@ LEGACY_User_4
@ LEGACY_In11_Cu
@ LEGACY_In6_Cu
@ LEGACY_B_Paste
@ LEGACY_Margin
@ LEGACY_B_Cu
@ LEGACY_In4_Cu
@ LEGACY_In16_Cu
@ LEGACY_In28_Cu
@ LEGACY_In22_Cu
@ LEGACY_User_2
@ LEGACY_F_Mask
@ LEGACY_B_Adhes
@ LEGACY_In15_Cu
@ LEGACY_In29_Cu
@ LEGACY_B_Fab
@ LEGACY_In13_Cu
@ LEGACY_In17_Cu
@ LEGACY_In1_Cu
@ LEGACY_In24_Cu
@ LEGACY_B_Mask
@ LEGACY_User_1
@ LEGACY_User_3
@ LEGACY_Eco1_User
@ LEGACY_F_CrtYd
@ LEGACY_Rescue
@ LEGACY_In26_Cu
@ LEGACY_In19_Cu
@ LEGACY_In12_Cu
@ LEGACY_Edge_Cuts
@ LEGACY_In10_Cu
@ LEGACY_F_Adhes
@ LEGACY_In5_Cu
@ LEGACY_User_5
@ LEGACY_F_Paste
@ LEGACY_In9_Cu
@ LEGACY_B_SilkS
@ LEGACY_In25_Cu
@ LEGACY_User_7
@ LEGACY_In20_Cu
@ LEGACY_F_Fab
@ LEGACY_In30_Cu
@ LEGACY_In8_Cu
@ LEGACY_In3_Cu
static const int gbrDefaultPrecision
#define SVG_PRECISION_MAX
#define SVG_PRECISION_DEFAULT
LSET remapLegacyLayerLSET(const BASE_SET &aLegacyLSET)
DRILL_MARKS
Plots and prints can show holes in pads and vias 3 options are available:
@ SKETCH
Definition: plotter.h:81
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:64
wxString From_UTF8(const char *cstring)
std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...
constexpr int mmToIU(double mm) const
Definition: base_units.h:92