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, see <https://www.gnu.org/licenses/>.
18 */
19
21#include <charconv>
22#include <layer_ids.h>
23#include <lset.h>
24#include <string_utils.h>
25#include <pcb_plot_params.h>
27#include <plotters/plotter.h>
31#include <lseq.h>
32
33
34#define PLOT_LINEWIDTH_DEFAULT ( DEFAULT_TEXT_WIDTH * IU_PER_MM )
35
36#define SVG_PRECISION_MIN 3U
37#define SVG_PRECISION_MAX 6U
38#define SVG_PRECISION_DEFAULT 4
39
40
41// default trailing digits in Gerber coordinates, when units are mm
42// This is also the max usable precision (i.e. internal Pcbnew Units)
43static const int gbrDefaultPrecision = 6;
44
45
46using namespace PCBPLOTPARAMS_T;
47
48
49static const char* getTokenName( T aTok )
50{
51 return PCB_PLOT_PARAMS_LEXER::TokenName( aTok );
52}
53
54
56{
63 m_dashedLineDashRatio = 12.0; // From ISO 128-2
64 m_dashedLineGapRatio = 3.0; // From ISO 128-2
65
66 // we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm
68 m_svgFitPageToBoard = false;
70 m_pngAntialias = true;
71 m_plotDrawingSheet = false;
73 m_DXFPolygonMode = true;
75 m_useAuxOrigin = false;
76 m_negative = false;
77 m_A4Output = false;
78 m_plotReference = true;
79 m_plotValue = true;
80 m_plotFPText = true;
85 m_plotPadNumbers = false;
88 m_mirror = false;
90 m_autoScale = false;
91 m_scale = 1.0;
95 m_widthAdjust = 0.;
97 m_outputDirectory.clear();
100
103 m_PDFMetadata = true;
104 m_PDFSingle = false;
106
107 // This parameter controls if the NPTH pads will be plotted or not
108 // it is a "local" parameter
109 m_skipNPTH_Pads = false;
110
111 // line width to plot items in outline mode.
112 m_sketchPadLineWidth = pcbIUScale.mmToIU( 0.1 );
113
114 m_default_colors = std::make_shared<COLOR_SETTINGS>();
116
117 m_blackAndWhite = true;
118
120}
121
122
124{
125 // Currently Gerber files use mm.
126 // accepted precision is only 6 (max value, this is the resolution of Pcbnew)
127 // or 5, min value for professional boards, when 6 creates problems
128 // to board makers.
129
132}
133
134
135void PCB_PLOT_PARAMS::SetSvgPrecision( unsigned aPrecision )
136{
137 m_svgPrecision = std::clamp( aPrecision, SVG_PRECISION_MIN, SVG_PRECISION_MAX );
138}
139
140
142{
143 aFormatter->Print( "(pcbplotparams" );
144
145 aFormatter->Print( "(layerselection 0x%s)", m_layerSelection.FmtHex().c_str() );
146
147 LSET commonLayers;
148
149 for( PCB_LAYER_ID commonLayer : m_plotOnAllLayersSequence )
150 commonLayers.set( commonLayer );
151
152 aFormatter->Print( "(plot_on_all_layers_selection 0x%s)", commonLayers.FmtHex().c_str() );
153
154 KICAD_FORMAT::FormatBool( aFormatter, "disableapertmacros", m_gerberDisableApertMacros );
155 KICAD_FORMAT::FormatBool( aFormatter, "usegerberextensions", m_useGerberProtelExtensions );
156 KICAD_FORMAT::FormatBool( aFormatter, "usegerberattributes", GetUseGerberX2format() );
157 KICAD_FORMAT::FormatBool( aFormatter, "usegerberadvancedattributes", GetIncludeGerberNetlistInfo() );
158 KICAD_FORMAT::FormatBool( aFormatter, "creategerberjobfile", GetCreateGerberJobFile() );
159
160 // save this option only if it is not the default value,
161 // to avoid incompatibility with older Pcbnew version
163 aFormatter->Print( "(gerberprecision %d)", m_gerberPrecision );
164
165 aFormatter->Print( "(dashed_line_dash_ratio %s)", FormatDouble2Str( GetDashedLineDashRatio() ).c_str() );
166 aFormatter->Print( "(dashed_line_gap_ratio %s)", FormatDouble2Str( GetDashedLineGapRatio() ).c_str() );
167
168 // SVG options
169 aFormatter->Print( "(svgprecision %d)", m_svgPrecision );
170
171 // PNG options
172 aFormatter->Print( "(pngdpi %d)", m_pngDPI );
173 KICAD_FORMAT::FormatBool( aFormatter, "pngantialias", m_pngAntialias );
174
175 KICAD_FORMAT::FormatBool( aFormatter, "plotframeref", m_plotDrawingSheet );
176 aFormatter->Print( "(mode %d)", GetDXFPlotMode() == SKETCH ? 2 : 1 );
177 KICAD_FORMAT::FormatBool( aFormatter, "useauxorigin", m_useAuxOrigin );
178
179 // PDF options
180 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_front_fp_property_popups ),
182 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_back_fp_property_popups ),
184 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_metadata ), m_PDFMetadata );
185 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_single_document ), m_PDFSingle );
186
187 // DXF options
188 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfpolygonmode ), m_DXFPolygonMode );
189 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfimperialunits ),
191 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfusepcbnewfont ),
193
194 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_psnegative ), m_negative );
195 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_psa4output ), m_A4Output );
196
197 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_plot_black_and_white ), m_blackAndWhite );
198
199 KICAD_FORMAT::FormatBool( aFormatter, "sketchpadsonfab", m_sketchPadsOnFabLayers );
200 KICAD_FORMAT::FormatBool( aFormatter, "plotpadnumbers", m_plotPadNumbers );
201 KICAD_FORMAT::FormatBool( aFormatter, "hidednponfab", m_hideDNPFPsOnFabLayers );
202 KICAD_FORMAT::FormatBool( aFormatter, "sketchdnponfab", m_sketchDNPFPsOnFabLayers );
203 KICAD_FORMAT::FormatBool( aFormatter, "crossoutdnponfab", m_crossoutDNPFPsOnFabLayers );
204 KICAD_FORMAT::FormatBool( aFormatter, "subtractmaskfromsilk", m_subtractMaskFromSilk );
205 aFormatter->Print( "(outputformat %d)", static_cast<int>( m_format ) );
206 KICAD_FORMAT::FormatBool( aFormatter, "mirror", m_mirror );
207 aFormatter->Print( "(drillshape %d)", (int)m_drillMarks );
208 aFormatter->Print( "(scaleselection %d)", m_scaleSelection );
209 aFormatter->Print( "(outputdirectory %s)", aFormatter->Quotew( m_outputDirectory ).c_str() );
210 aFormatter->Print( ")" );
211}
212
213
215{
216 aParser->Parse( this );
217}
218
219
220bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
221{
222 if( m_layerSelection != aPcbPlotParams.m_layerSelection )
223 return false;
224
226 return false;
227
229 {
231 return false;
232
234 return false;
235
236 if( m_useGerberX2format != aPcbPlotParams.m_useGerberX2format )
237 return false;
238
240 return false;
241
242 if( m_createGerberJobFile != aPcbPlotParams.m_createGerberJobFile )
243 return false;
244
245 if( m_gerberPrecision != aPcbPlotParams.m_gerberPrecision )
246 return false;
247 }
248
249 if( m_dashedLineDashRatio != aPcbPlotParams.m_dashedLineDashRatio )
250 return false;
251
252 if( m_dashedLineGapRatio != aPcbPlotParams.m_dashedLineGapRatio )
253 return false;
254
255 if( m_plotDrawingSheet != aPcbPlotParams.m_plotDrawingSheet )
256 return false;
257
259 {
260 if( m_DXFPlotMode != aPcbPlotParams.m_DXFPlotMode )
261 return false;
262
263 if( m_DXFPolygonMode != aPcbPlotParams.m_DXFPolygonMode )
264 return false;
265
266 if( m_DXFUnits != aPcbPlotParams.m_DXFUnits )
267 return false;
268
270 return false;
271 }
272
273 if( m_svgPrecision != aPcbPlotParams.m_svgPrecision )
274 return false;
275
276 if( m_pngDPI != aPcbPlotParams.m_pngDPI )
277 return false;
278
279 if( m_pngAntialias != aPcbPlotParams.m_pngAntialias )
280 return false;
281
283 {
284 if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
285 return false;
286 }
287
289 {
290 if( m_negative != aPcbPlotParams.m_negative )
291 return false;
292
293 if( m_mirror != aPcbPlotParams.m_mirror )
294 return false;
295 }
296
298 {
300 return false;
301
303 return false;
304
305 if( m_PDFMetadata != aPcbPlotParams.m_PDFMetadata )
306 return false;
307 }
308
309 if( m_plotReference != aPcbPlotParams.m_plotReference )
310 return false;
311
312 if( m_plotValue != aPcbPlotParams.m_plotValue )
313 return false;
314
315 if( m_plotFPText != aPcbPlotParams.m_plotFPText )
316 return false;
317
319 return false;
320
321 if( m_plotPadNumbers != aPcbPlotParams.m_plotPadNumbers )
322 return false;
323
325 return false;
326
328 return false;
329
331 return false;
332
333 if( m_subtractMaskFromSilk != aPcbPlotParams.m_subtractMaskFromSilk )
334 return false;
335
336 if( m_format != aPcbPlotParams.m_format )
337 return false;
338
340 {
341 if( m_drillMarks != aPcbPlotParams.m_drillMarks )
342 return false;
343
344 if( m_scaleSelection != aPcbPlotParams.m_scaleSelection )
345 return false;
346
347 if( m_autoScale != aPcbPlotParams.m_autoScale )
348 return false;
349
350 if( m_scale != aPcbPlotParams.m_scale )
351 return false;
352 }
353
355 {
356 if( m_A4Output != aPcbPlotParams.m_A4Output )
357 return false;
358
359 if( m_fineScaleAdjustX != aPcbPlotParams.m_fineScaleAdjustX )
360 return false;
361
362 if( m_fineScaleAdjustY != aPcbPlotParams.m_fineScaleAdjustY )
363 return false;
364
365 if( m_widthAdjust != aPcbPlotParams.m_widthAdjust )
366 return false;
367 }
368
369 if( m_textMode != aPcbPlotParams.m_textMode )
370 return false;
371
372 if( m_blackAndWhite != aPcbPlotParams.m_blackAndWhite )
373 return false;
374
375 if( !m_outputDirectory.IsSameAs( aPcbPlotParams.m_outputDirectory ) )
376 return false;
377
378 return true;
379}
380
381
383 PCB_PLOT_PARAMS_LEXER( aReader ),
384 m_boardFileVersion( aBoardFileVersion )
385{
386}
387
388
389PCB_PLOT_PARAMS_PARSER::PCB_PLOT_PARAMS_PARSER( char* aLine, const wxString& aSource ) :
390 PCB_PLOT_PARAMS_LEXER( aLine, aSource ),
392{
393}
394
395
401{
404
437
440
443
446
449
456
459
462
463 // User definable layers.
473
475
476 // Four reserved layers (60 - 63) for future expansion within the 64 bit integer limit.
477
479};
480
481/*
482 * Mapping to translate a legacy layer ID into the new PCB layer IDs.
483 */
484static const std::map<LEGACY_PCB_LAYER_ID, PCB_LAYER_ID> s_legacyLayerIdMap{
485 {LEGACY_F_Cu, F_Cu},
486 {LEGACY_B_Cu, B_Cu},
545};
546
547
548LSET remapLegacyLayerLSET( const BASE_SET& aLegacyLSET )
549{
550 LSET newLayers;
551
552 for( const auto& [legacyLayer, newLayer] : s_legacyLayerIdMap )
553 newLayers[newLayer] = aLegacyLSET[legacyLayer];
554
555 return newLayers;
556}
557
558
560{
561 T token;
562
563 while( ( token = NextTok() ) != T_RIGHT )
564 {
565 if( token == T_EOF)
566 Unexpected( T_EOF );
567
568 if( token == T_LEFT )
569 token = NextTok();
570
571 if( token == T_pcbplotparams )
572 continue;
573
574 bool skip_right = false;
575
576 switch( token )
577 {
578 case T_layerselection:
579 {
580 token = NeedSYMBOLorNUMBER();
581
582 const std::string& cur = CurStr();
583
584 if( token == T_NUMBER ) // pretty 3 format had legacy Cu stack.
585 {
586 // It's not possible to convert a legacy Cu layer number to a new Cu layer
587 // number without knowing the number or total Cu layers in the legacy board.
588 // We do not have that information here, so simply set all layers ON. User
589 // can turn them off in the UI.
590 aPcbPlotParams->m_layerSelection = LSET( { F_SilkS, B_SilkS } ) | LSET::AllCuMask();
591 }
592 else if( cur.find_first_of( "0x" ) == 0 ) // pretty ver. 4.
593 {
594 // The layers were renumbered in 5e0abadb23425765e164f49ee2f893e94ddb97fc, but there wasn't
595 // a board file version change with it, so this value is the one 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 aPcbPlotParams->SetLayerSelection( remapLegacyLayerLSET( legacyLSET ) );
603 }
604 else
605 {
606 // skip the leading 2 0x bytes.
607 aPcbPlotParams->m_layerSelection.ParseHex( cur.c_str() + 2, cur.size() - 2 );
608 }
609 }
610 else
611 {
612 Expecting( "integer or hex layerSelection" );
613 }
614
615 break;
616 }
617
618 case T_plot_on_all_layers_selection:
619 {
620 token = NeedSYMBOLorNUMBER();
621
622 const std::string& cur = CurStr();
623
624 if( cur.find_first_of( "0x" ) == 0 )
625 {
626 LSET layers;
627
628 // The layers were renumbered in 5e0abadb23425765e164f49ee2f893e94ddb97fc, but
629 // there wasn't a board file version change with it, so this value is the one
630 // immediately after that happened.
631 if( m_boardFileVersion < 20240819 )
632 {
634
635 // skip the leading 2 0x bytes.
636 legacyLSET.ParseHex( cur.c_str() + 2, cur.size() - 2 );
637
638 layers = remapLegacyLayerLSET( legacyLSET );
639 }
640 else
641 {
642 // skip the leading 2 0x bytes.
643 layers.ParseHex( cur.c_str() + 2, cur.size() - 2 );
644 }
645
646 aPcbPlotParams->SetPlotOnAllLayersSequence( layers.SeqStackupForPlotting() );
647 }
648 else
649 {
650 Expecting( "hex plot_on_all_layers_selection" );
651 }
652
653 break;
654 }
655
656 case T_disableapertmacros:
657 aPcbPlotParams->m_gerberDisableApertMacros = parseBool();
658 break;
659
660 case T_usegerberextensions:
661 aPcbPlotParams->m_useGerberProtelExtensions = parseBool();
662 break;
663
664 case T_usegerberattributes:
665 aPcbPlotParams->m_useGerberX2format = parseBool();
666 break;
667
668 case T_usegerberadvancedattributes:
669 aPcbPlotParams->m_includeGerberNetlistInfo = parseBool();
670 break;
671
672 case T_creategerberjobfile:
673 aPcbPlotParams->m_createGerberJobFile = parseBool();
674 break;
675
676 case T_gerberprecision:
677 aPcbPlotParams->m_gerberPrecision = parseInt( gbrDefaultPrecision - 1,
679 break;
680
681 case T_dashed_line_dash_ratio:
682 aPcbPlotParams->m_dashedLineDashRatio = parseDouble();
683 break;
684
685 case T_dashed_line_gap_ratio:
686 aPcbPlotParams->m_dashedLineGapRatio = parseDouble();
687 break;
688
689 case T_svgprecision:
691 break;
692
693 case T_pngdpi:
694 aPcbPlotParams->m_pngDPI = parseInt( MIN_PNG_DPI, MAX_PNG_DPI );
695 break;
696
697 case T_pngantialias:
698 aPcbPlotParams->m_pngAntialias = parseBool();
699 break;
700
701 case T_svguseinch:
702 parseBool(); // Unused. For compatibility
703 break;
704
705 case T_psa4output:
706 aPcbPlotParams->m_A4Output = parseBool();
707 break;
708
709 case T_excludeedgelayer:
710 if( !parseBool() )
711 aPcbPlotParams->m_plotOnAllLayersSequence.push_back( Edge_Cuts );
712
713 break;
714
715 case T_plotframeref:
716 aPcbPlotParams->m_plotDrawingSheet = parseBool();
717 break;
718
719 case T_viasonmask:
720 aPcbPlotParams->m_plotViaOnMaskLayer = parseBool();
721 break;
722
723 case T_useauxorigin:
724 aPcbPlotParams->m_useAuxOrigin = parseBool();
725 break;
726
727 case T_mode:
728 case T_hpglpennumber:
729 case T_hpglpenspeed:
730 case T_hpglpenoverlay:
731 // HPGL is no longer supported
732 parseInt( std::numeric_limits<int>::min(), std::numeric_limits<int>::max() );
733 break;
734
735 case T_pdf_front_fp_property_popups:
736 aPcbPlotParams->m_PDFFrontFPPropertyPopups = parseBool();
737 break;
738
739 case T_pdf_back_fp_property_popups:
740 aPcbPlotParams->m_PDFBackFPPropertyPopups = parseBool();
741 break;
742
743 case T_pdf_metadata:
744 aPcbPlotParams->m_PDFMetadata = parseBool();
745 break;
746
747 case T_pdf_single_document:
748 aPcbPlotParams->m_PDFSingle = parseBool();
749 break;
750
751 case T_dxfpolygonmode:
752 aPcbPlotParams->m_DXFPolygonMode = parseBool();
753 break;
754
755 case T_dxfimperialunits:
756 aPcbPlotParams->m_DXFUnits = parseBool() ? DXF_UNITS::INCH : DXF_UNITS::MM;
757 break;
758
759 case T_dxfusepcbnewfont:
760 aPcbPlotParams->m_textMode = parseBool() ? PLOT_TEXT_MODE::DEFAULT
762 break;
763
764 case T_pscolor:
765 NeedSYMBOL(); // This actually was never used...
766 break;
767
768 case T_psnegative:
769 aPcbPlotParams->m_negative = parseBool();
770 break;
771
772 case T_plot_black_and_white:
773 aPcbPlotParams->m_blackAndWhite = parseBool();
774 break;
775
776 case T_plotinvisibletext: // legacy token; no longer supported
777 parseBool();
778 break;
779
780 case T_sketchpadsonfab:
781 aPcbPlotParams->m_sketchPadsOnFabLayers= parseBool();
782 break;
783
784 case T_plotpadnumbers:
785 aPcbPlotParams->m_plotPadNumbers = parseBool();
786 break;
787
788 case T_hidednponfab:
789 aPcbPlotParams->m_hideDNPFPsOnFabLayers = parseBool();
790 break;
791
792 case T_sketchdnponfab:
793 aPcbPlotParams->m_sketchDNPFPsOnFabLayers = parseBool();
794 break;
795
796 case T_crossoutdnponfab:
797 aPcbPlotParams->m_crossoutDNPFPsOnFabLayers = parseBool();
798 break;
799
800 case T_subtractmaskfromsilk:
801 aPcbPlotParams->m_subtractMaskFromSilk = parseBool();
802 break;
803
804 case T_outputformat:
805 aPcbPlotParams->m_format = static_cast<PLOT_FORMAT>(
806 parseInt( static_cast<int>( PLOT_FORMAT::FIRST_FORMAT ),
807 static_cast<int>( PLOT_FORMAT::LAST_FORMAT ) ) );
808 break;
809
810 case T_mirror:
811 aPcbPlotParams->m_mirror = parseBool();
812 break;
813
814 case T_drillshape:
815 aPcbPlotParams->m_drillMarks = static_cast<DRILL_MARKS> ( parseInt( 0, 2 ) );
816 break;
817
818 case T_scaleselection:
819 aPcbPlotParams->m_scaleSelection = parseInt( 0, 4 );
820 break;
821
822 case T_outputdirectory:
823 NeedSYMBOLorNUMBER(); // a dir name can be like a number
824 aPcbPlotParams->m_outputDirectory = From_UTF8( CurText() );
825 break;
826
827 default:
828 skipCurrent(); // skip unknown or outdated plot parameter
829 skip_right = true; // the closing right token is already read.
830 break;
831 }
832
833 if( ! skip_right )
834 NeedRIGHT();
835 }
836}
837
838
840{
841 T token = NeedSYMBOL();
842
843 switch( token )
844 {
845 case T_false:
846 case T_no:
847 return false;
848
849 case T_true:
850 case T_yes:
851 return true;
852
853 default:
854 Expecting( "true, false, yes, or no" );
855 return false;
856 }
857}
858
859
860int PCB_PLOT_PARAMS_PARSER::parseInt( int aMin, int aMax )
861{
862 T token = NextTok();
863
864 if( token != T_NUMBER )
865 Expecting( T_NUMBER );
866
867 int val = atoi( CurText() );
868
869 if( val < aMin )
870 val = aMin;
871 else if( val > aMax )
872 val = aMax;
873
874 return val;
875}
876
877
879{
880 T token = NextTok();
881
882 if( token != T_NUMBER )
883 Expecting( T_NUMBER );
884
885 return DSNLEXER::parseDouble();
886}
887
888
890{
891 int curr_level = 0;
892 T token;
893
894 while( ( token = NextTok() ) != T_EOF )
895 {
896 if( token == T_LEFT )
897 curr_level--;
898
899 if( token == T_RIGHT )
900 {
901 curr_level++;
902
903 if( curr_level > 0 )
904 return;
905 }
906 }
907}
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:121
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
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:398
double parseDouble()
Parse the current token as an ASCII numeric string with possible leading whitespace into a double pre...
Definition dsnlexer.cpp:860
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition richio.h:62
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:400
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition lset.cpp:595
An interface used to output 8 bit text in a convenient way.
Definition richio.h:291
std::string Quotew(const wxString &aWrapee) const
Definition richio.cpp:507
int PRINTF_FUNC_N Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition richio.cpp:422
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.
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.
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.
friend class PCB_PLOT_PARAMS_PARSER
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
COLOR4D m_PDFBackgroundColor
Background color to use if m_PDFUseBackgroundColor is true.
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
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
bool m_DXFExportAsMultiLayeredFile
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:56
@ In22_Cu
Definition layer_ids.h:83
@ In11_Cu
Definition layer_ids.h:72
@ In29_Cu
Definition layer_ids.h:90
@ In30_Cu
Definition layer_ids.h:91
@ User_8
Definition layer_ids.h:127
@ F_CrtYd
Definition layer_ids.h:112
@ In17_Cu
Definition layer_ids.h:78
@ B_Adhes
Definition layer_ids.h:99
@ Edge_Cuts
Definition layer_ids.h:108
@ Dwgs_User
Definition layer_ids.h:103
@ F_Paste
Definition layer_ids.h:100
@ In9_Cu
Definition layer_ids.h:70
@ Cmts_User
Definition layer_ids.h:104
@ User_6
Definition layer_ids.h:125
@ User_7
Definition layer_ids.h:126
@ In19_Cu
Definition layer_ids.h:80
@ In7_Cu
Definition layer_ids.h:68
@ In28_Cu
Definition layer_ids.h:89
@ In26_Cu
Definition layer_ids.h:87
@ F_Adhes
Definition layer_ids.h:98
@ B_Mask
Definition layer_ids.h:94
@ B_Cu
Definition layer_ids.h:61
@ User_5
Definition layer_ids.h:124
@ Eco1_User
Definition layer_ids.h:105
@ F_Mask
Definition layer_ids.h:93
@ In21_Cu
Definition layer_ids.h:82
@ In23_Cu
Definition layer_ids.h:84
@ B_Paste
Definition layer_ids.h:101
@ In15_Cu
Definition layer_ids.h:76
@ In2_Cu
Definition layer_ids.h:63
@ User_9
Definition layer_ids.h:128
@ F_Fab
Definition layer_ids.h:115
@ In10_Cu
Definition layer_ids.h:71
@ Margin
Definition layer_ids.h:109
@ F_SilkS
Definition layer_ids.h:96
@ In4_Cu
Definition layer_ids.h:65
@ B_CrtYd
Definition layer_ids.h:111
@ Eco2_User
Definition layer_ids.h:106
@ In16_Cu
Definition layer_ids.h:77
@ In24_Cu
Definition layer_ids.h:85
@ In1_Cu
Definition layer_ids.h:62
@ Rescue
Definition layer_ids.h:117
@ User_3
Definition layer_ids.h:122
@ User_1
Definition layer_ids.h:120
@ B_SilkS
Definition layer_ids.h:97
@ In13_Cu
Definition layer_ids.h:74
@ User_4
Definition layer_ids.h:123
@ In8_Cu
Definition layer_ids.h:69
@ In14_Cu
Definition layer_ids.h:75
@ User_2
Definition layer_ids.h:121
@ In12_Cu
Definition layer_ids.h:73
@ In27_Cu
Definition layer_ids.h:88
@ In6_Cu
Definition layer_ids.h:67
@ In5_Cu
Definition layer_ids.h:66
@ In3_Cu
Definition layer_ids.h:64
@ In20_Cu
Definition layer_ids.h:81
@ F_Cu
Definition layer_ids.h:60
@ In18_Cu
Definition layer_ids.h:79
@ In25_Cu
Definition layer_ids.h:86
@ B_Fab
Definition layer_ids.h:114
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:78
PLOT_FORMAT
The set of supported output plot formats.
Definition plotter.h:60
@ LAST_FORMAT
Definition plotter.h:70
@ FIRST_FORMAT
Definition plotter.h:62
constexpr int DEFAULT_PNG_DPI
Definition plotter_png.h:28
constexpr int MIN_PNG_DPI
Definition plotter_png.h:29
constexpr int MAX_PNG_DPI
Definition plotter_png.h:30
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...