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>
34
35
36#define PLOT_LINEWIDTH_DEFAULT ( DEFAULT_TEXT_WIDTH * IU_PER_MM )
37
38using namespace PCBPLOTPARAMS_T;
39
40
41static const char* getTokenName( T aTok )
42{
43 return PCB_PLOT_PARAMS_LEXER::TokenName( aTok );
44}
45
46
48{
55 m_dashedLineDashRatio = 12.0; // From ISO 128-2
56 m_dashedLineGapRatio = 3.0; // From ISO 128-2
57
58 // we used 0.1mils for SVG step before, but nm precision is more accurate, so we use nm
60 m_svgFitPageToBoard = false;
62 m_pngAntialias = true;
63 m_plotDrawingSheet = false;
65 m_DXFPolygonMode = true;
67 m_useAuxOrigin = false;
68 m_negative = false;
69 m_A4Output = false;
70 m_plotReference = true;
71 m_plotValue = true;
72 m_plotFPText = true;
77 m_plotPadNumbers = false;
80 m_mirror = false;
82 m_autoScale = false;
83 m_scale = 1.0;
87 m_widthAdjust = 0.;
89 m_outputDirectory.clear();
92
95 m_PDFMetadata = true;
96 m_PDFSingle = false;
98
99 // This parameter controls if the NPTH pads will be plotted or not
100 // it is a "local" parameter
101 m_skipNPTH_Pads = false;
102
103 // line width to plot items in outline mode.
104 m_sketchPadLineWidth = pcbIUScale.mmToIU( 0.1 );
105
106 m_default_colors = std::make_shared<COLOR_SETTINGS>();
108
109 m_blackAndWhite = true;
110
112}
113
114
116{
117 // Currently Gerber files use mm.
118 // accepted precision is only 6 (max value, this is the resolution of Pcbnew)
119 // or 5, min value for professional boards, when 6 creates problems
120 // to board makers.
121
124}
125
126
127void PCB_PLOT_PARAMS::SetSvgPrecision( unsigned aPrecision )
128{
129 m_svgPrecision = std::clamp( aPrecision, SVG_PRECISION_MIN, SVG_PRECISION_MAX );
130}
131
132
134{
135 aFormatter->Print( "(pcbplotparams" );
136
137 aFormatter->Print( "(layerselection 0x%s)", m_layerSelection.FmtHex().c_str() );
138
139 LSET commonLayers;
140
141 for( PCB_LAYER_ID commonLayer : m_plotOnAllLayersSequence )
142 commonLayers.set( commonLayer );
143
144 aFormatter->Print( "(plot_on_all_layers_selection 0x%s)", commonLayers.FmtHex().c_str() );
145
146 KICAD_FORMAT::FormatBool( aFormatter, "disableapertmacros", m_gerberDisableApertMacros );
147 KICAD_FORMAT::FormatBool( aFormatter, "usegerberextensions", m_useGerberProtelExtensions );
148 KICAD_FORMAT::FormatBool( aFormatter, "usegerberattributes", GetUseGerberX2format() );
149 KICAD_FORMAT::FormatBool( aFormatter, "usegerberadvancedattributes", GetIncludeGerberNetlistInfo() );
150 KICAD_FORMAT::FormatBool( aFormatter, "creategerberjobfile", GetCreateGerberJobFile() );
151
152 // save this option only if it is not the default value,
153 // to avoid incompatibility with older Pcbnew version
155 aFormatter->Print( "(gerberprecision %d)", m_gerberPrecision );
156
157 aFormatter->Print( "(dashed_line_dash_ratio %s)", FormatDouble2Str( GetDashedLineDashRatio() ).c_str() );
158 aFormatter->Print( "(dashed_line_gap_ratio %s)", FormatDouble2Str( GetDashedLineGapRatio() ).c_str() );
159
160 // SVG options
161 aFormatter->Print( "(svgprecision %d)", m_svgPrecision );
162
163 // PNG options
164 aFormatter->Print( "(pngdpi %d)", m_pngDPI );
165 KICAD_FORMAT::FormatBool( aFormatter, "pngantialias", m_pngAntialias );
166
167 KICAD_FORMAT::FormatBool( aFormatter, "plotframeref", m_plotDrawingSheet );
168 aFormatter->Print( "(mode %d)", GetDXFPlotMode() == SKETCH ? 2 : 1 );
169 KICAD_FORMAT::FormatBool( aFormatter, "useauxorigin", m_useAuxOrigin );
170
171 // PDF options
172 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_front_fp_property_popups ),
174 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_back_fp_property_popups ),
176 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_metadata ), m_PDFMetadata );
177 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_pdf_single_document ), m_PDFSingle );
178
179 // DXF options
180 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfpolygonmode ), m_DXFPolygonMode );
181 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfimperialunits ),
183 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_dxfusepcbnewfont ),
185
186 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_psnegative ), m_negative );
187 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_psa4output ), m_A4Output );
188
189 KICAD_FORMAT::FormatBool( aFormatter, getTokenName( T_plot_black_and_white ), m_blackAndWhite );
190
191 KICAD_FORMAT::FormatBool( aFormatter, "sketchpadsonfab", m_sketchPadsOnFabLayers );
192 KICAD_FORMAT::FormatBool( aFormatter, "plotpadnumbers", m_plotPadNumbers );
193 KICAD_FORMAT::FormatBool( aFormatter, "hidednponfab", m_hideDNPFPsOnFabLayers );
194 KICAD_FORMAT::FormatBool( aFormatter, "sketchdnponfab", m_sketchDNPFPsOnFabLayers );
195 KICAD_FORMAT::FormatBool( aFormatter, "crossoutdnponfab", m_crossoutDNPFPsOnFabLayers );
196 KICAD_FORMAT::FormatBool( aFormatter, "subtractmaskfromsilk", m_subtractMaskFromSilk );
197 aFormatter->Print( "(outputformat %d)", static_cast<int>( m_format ) );
198 KICAD_FORMAT::FormatBool( aFormatter, "mirror", m_mirror );
199 aFormatter->Print( "(drillshape %d)", (int)m_drillMarks );
200 aFormatter->Print( "(scaleselection %d)", m_scaleSelection );
201 aFormatter->Print( "(outputdirectory %s)", aFormatter->Quotew( m_outputDirectory ).c_str() );
202 aFormatter->Print( ")" );
203}
204
205
207{
208 aParser->Parse( this );
209}
210
211
212bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
213{
214 if( m_layerSelection != aPcbPlotParams.m_layerSelection )
215 return false;
216
218 return false;
219
221 {
223 return false;
224
226 return false;
227
228 if( m_useGerberX2format != aPcbPlotParams.m_useGerberX2format )
229 return false;
230
232 return false;
233
234 if( m_createGerberJobFile != aPcbPlotParams.m_createGerberJobFile )
235 return false;
236
237 if( m_gerberPrecision != aPcbPlotParams.m_gerberPrecision )
238 return false;
239 }
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
251 {
252 if( m_DXFPlotMode != aPcbPlotParams.m_DXFPlotMode )
253 return false;
254
255 if( m_DXFPolygonMode != aPcbPlotParams.m_DXFPolygonMode )
256 return false;
257
258 if( m_DXFUnits != aPcbPlotParams.m_DXFUnits )
259 return false;
260
262 return false;
263 }
264
265 if( m_svgPrecision != aPcbPlotParams.m_svgPrecision )
266 return false;
267
268 if( m_pngDPI != aPcbPlotParams.m_pngDPI )
269 return false;
270
271 if( m_pngAntialias != aPcbPlotParams.m_pngAntialias )
272 return false;
273
275 {
276 if( m_useAuxOrigin != aPcbPlotParams.m_useAuxOrigin )
277 return false;
278 }
279
281 {
282 if( m_negative != aPcbPlotParams.m_negative )
283 return false;
284
285 if( m_mirror != aPcbPlotParams.m_mirror )
286 return false;
287 }
288
290 {
292 return false;
293
295 return false;
296
297 if( m_PDFMetadata != aPcbPlotParams.m_PDFMetadata )
298 return false;
299 }
300
301 if( m_plotReference != aPcbPlotParams.m_plotReference )
302 return false;
303
304 if( m_plotValue != aPcbPlotParams.m_plotValue )
305 return false;
306
307 if( m_plotFPText != aPcbPlotParams.m_plotFPText )
308 return false;
309
311 return false;
312
313 if( m_plotPadNumbers != aPcbPlotParams.m_plotPadNumbers )
314 return false;
315
317 return false;
318
320 return false;
321
323 return false;
324
325 if( m_subtractMaskFromSilk != aPcbPlotParams.m_subtractMaskFromSilk )
326 return false;
327
328 if( m_format != aPcbPlotParams.m_format )
329 return false;
330
332 {
333 if( m_drillMarks != aPcbPlotParams.m_drillMarks )
334 return false;
335
336 if( m_scaleSelection != aPcbPlotParams.m_scaleSelection )
337 return false;
338
339 if( m_autoScale != aPcbPlotParams.m_autoScale )
340 return false;
341
342 if( m_scale != aPcbPlotParams.m_scale )
343 return false;
344 }
345
347 {
348 if( m_A4Output != aPcbPlotParams.m_A4Output )
349 return false;
350
351 if( m_fineScaleAdjustX != aPcbPlotParams.m_fineScaleAdjustX )
352 return false;
353
354 if( m_fineScaleAdjustY != aPcbPlotParams.m_fineScaleAdjustY )
355 return false;
356
357 if( m_widthAdjust != aPcbPlotParams.m_widthAdjust )
358 return false;
359 }
360
361 if( m_textMode != aPcbPlotParams.m_textMode )
362 return false;
363
364 if( m_blackAndWhite != aPcbPlotParams.m_blackAndWhite )
365 return false;
366
367 if( !m_outputDirectory.IsSameAs( aPcbPlotParams.m_outputDirectory ) )
368 return false;
369
370 return true;
371}
372
373
375 PCB_PLOT_PARAMS_LEXER( aReader ),
376 m_boardFileVersion( aBoardFileVersion )
377{
378}
379
380
381PCB_PLOT_PARAMS_PARSER::PCB_PLOT_PARAMS_PARSER( char* aLine, const wxString& aSource ) :
382 PCB_PLOT_PARAMS_LEXER( aLine, aSource ),
384{
385}
386
387
393{
396
429
432
435
438
441
448
451
454
455 // User definable layers.
465
467
468 // Four reserved layers (60 - 63) for future expansion within the 64 bit integer limit.
469
471};
472
473/*
474 * Mapping to translate a legacy layer ID into the new PCB layer IDs.
475 */
476static const std::map<LEGACY_PCB_LAYER_ID, PCB_LAYER_ID> s_legacyLayerIdMap{
477 {LEGACY_F_Cu, F_Cu},
478 {LEGACY_B_Cu, B_Cu},
537};
538
539
540LSET remapLegacyLayerLSET( const BASE_SET& aLegacyLSET )
541{
542 LSET newLayers;
543
544 for( const auto& [legacyLayer, newLayer] : s_legacyLayerIdMap )
545 newLayers[newLayer] = aLegacyLSET[legacyLayer];
546
547 return newLayers;
548}
549
550
552{
553 T token;
554
555 while( ( token = NextTok() ) != T_RIGHT )
556 {
557 if( token == T_EOF)
558 Unexpected( T_EOF );
559
560 if( token == T_LEFT )
561 token = NextTok();
562
563 if( token == T_pcbplotparams )
564 continue;
565
566 bool skip_right = false;
567
568 switch( token )
569 {
570 case T_layerselection:
571 {
572 token = NeedSYMBOLorNUMBER();
573
574 const std::string& cur = CurStr();
575
576 if( token == T_NUMBER ) // pretty 3 format had legacy Cu stack.
577 {
578 // It's not possible to convert a legacy Cu layer number to a new Cu layer
579 // number without knowing the number or total Cu layers in the legacy board.
580 // We do not have that information here, so simply set all layers ON. User
581 // can turn them off in the UI.
582 aPcbPlotParams->m_layerSelection = LSET( { F_SilkS, B_SilkS } ) | LSET::AllCuMask();
583 }
584 else if( cur.find_first_of( "0x" ) == 0 ) // pretty ver. 4.
585 {
586 // The layers were renumbered in 5e0abadb23425765e164f49ee2f893e94ddb97fc, but there wasn't
587 // a board file version change with it, so this value is the one immediately after that happened.
588 if( m_boardFileVersion < 20240819 )
589 {
591
592 // skip the leading 2 0x bytes.
593 legacyLSET.ParseHex( cur.c_str() + 2, cur.size() - 2 );
594 aPcbPlotParams->SetLayerSelection( remapLegacyLayerLSET( legacyLSET ) );
595 }
596 else
597 {
598 // skip the leading 2 0x bytes.
599 aPcbPlotParams->m_layerSelection.ParseHex( cur.c_str() + 2, cur.size() - 2 );
600 }
601 }
602 else
603 {
604 Expecting( "integer or hex layerSelection" );
605 }
606
607 break;
608 }
609
610 case T_plot_on_all_layers_selection:
611 {
612 token = NeedSYMBOLorNUMBER();
613
614 const std::string& cur = CurStr();
615
616 if( cur.find_first_of( "0x" ) == 0 )
617 {
618 LSET layers;
619
620 // The layers were renumbered in 5e0abadb23425765e164f49ee2f893e94ddb97fc, but
621 // there wasn't a board file version change with it, so this value is the one
622 // immediately after that happened.
623 if( m_boardFileVersion < 20240819 )
624 {
626
627 // skip the leading 2 0x bytes.
628 legacyLSET.ParseHex( cur.c_str() + 2, cur.size() - 2 );
629
630 layers = remapLegacyLayerLSET( legacyLSET );
631 }
632 else
633 {
634 // skip the leading 2 0x bytes.
635 layers.ParseHex( cur.c_str() + 2, cur.size() - 2 );
636 }
637
638 aPcbPlotParams->SetPlotOnAllLayersSequence( layers.SeqStackupForPlotting() );
639 }
640 else
641 {
642 Expecting( "hex plot_on_all_layers_selection" );
643 }
644
645 break;
646 }
647
648 case T_disableapertmacros:
649 aPcbPlotParams->m_gerberDisableApertMacros = parseBool();
650 break;
651
652 case T_usegerberextensions:
653 aPcbPlotParams->m_useGerberProtelExtensions = parseBool();
654 break;
655
656 case T_usegerberattributes:
657 aPcbPlotParams->m_useGerberX2format = parseBool();
658 break;
659
660 case T_usegerberadvancedattributes:
661 aPcbPlotParams->m_includeGerberNetlistInfo = parseBool();
662 break;
663
664 case T_creategerberjobfile:
665 aPcbPlotParams->m_createGerberJobFile = parseBool();
666 break;
667
668 case T_gerberprecision:
669 aPcbPlotParams->m_gerberPrecision = parseInt( GBR_DEFAULT_PRECISION - 1,
671 break;
672
673 case T_dashed_line_dash_ratio:
674 aPcbPlotParams->m_dashedLineDashRatio = parseDouble();
675 break;
676
677 case T_dashed_line_gap_ratio:
678 aPcbPlotParams->m_dashedLineGapRatio = parseDouble();
679 break;
680
681 case T_svgprecision:
683 break;
684
685 case T_pngdpi:
686 aPcbPlotParams->m_pngDPI = parseInt( MIN_PNG_DPI, MAX_PNG_DPI );
687 break;
688
689 case T_pngantialias:
690 aPcbPlotParams->m_pngAntialias = parseBool();
691 break;
692
693 case T_svguseinch:
694 parseBool(); // Unused. For compatibility
695 break;
696
697 case T_psa4output:
698 aPcbPlotParams->m_A4Output = parseBool();
699 break;
700
701 case T_excludeedgelayer:
702 if( !parseBool() )
703 aPcbPlotParams->m_plotOnAllLayersSequence.push_back( Edge_Cuts );
704
705 break;
706
707 case T_plotframeref:
708 aPcbPlotParams->m_plotDrawingSheet = parseBool();
709 break;
710
711 case T_viasonmask:
712 aPcbPlotParams->m_plotViaOnMaskLayer = parseBool();
713 break;
714
715 case T_useauxorigin:
716 aPcbPlotParams->m_useAuxOrigin = parseBool();
717 break;
718
719 case T_mode:
720 case T_hpglpennumber:
721 case T_hpglpenspeed:
722 case T_hpglpenoverlay:
723 // HPGL is no longer supported
724 parseInt( std::numeric_limits<int>::min(), std::numeric_limits<int>::max() );
725 break;
726
727 case T_pdf_front_fp_property_popups:
728 aPcbPlotParams->m_PDFFrontFPPropertyPopups = parseBool();
729 break;
730
731 case T_pdf_back_fp_property_popups:
732 aPcbPlotParams->m_PDFBackFPPropertyPopups = parseBool();
733 break;
734
735 case T_pdf_metadata:
736 aPcbPlotParams->m_PDFMetadata = parseBool();
737 break;
738
739 case T_pdf_single_document:
740 aPcbPlotParams->m_PDFSingle = parseBool();
741 break;
742
743 case T_dxfpolygonmode:
744 aPcbPlotParams->m_DXFPolygonMode = parseBool();
745 break;
746
747 case T_dxfimperialunits:
748 aPcbPlotParams->m_DXFUnits = parseBool() ? DXF_UNITS::INCH : DXF_UNITS::MM;
749 break;
750
751 case T_dxfusepcbnewfont:
752 aPcbPlotParams->m_textMode = parseBool() ? PLOT_TEXT_MODE::DEFAULT
754 break;
755
756 case T_pscolor:
757 NeedSYMBOL(); // This actually was never used...
758 break;
759
760 case T_psnegative:
761 aPcbPlotParams->m_negative = parseBool();
762 break;
763
764 case T_plot_black_and_white:
765 aPcbPlotParams->m_blackAndWhite = parseBool();
766 break;
767
768 case T_plotinvisibletext: // legacy token; no longer supported
769 parseBool();
770 break;
771
772 case T_sketchpadsonfab:
773 aPcbPlotParams->m_sketchPadsOnFabLayers= parseBool();
774 break;
775
776 case T_plotpadnumbers:
777 aPcbPlotParams->m_plotPadNumbers = parseBool();
778 break;
779
780 case T_hidednponfab:
781 aPcbPlotParams->m_hideDNPFPsOnFabLayers = parseBool();
782 break;
783
784 case T_sketchdnponfab:
785 aPcbPlotParams->m_sketchDNPFPsOnFabLayers = parseBool();
786 break;
787
788 case T_crossoutdnponfab:
789 aPcbPlotParams->m_crossoutDNPFPsOnFabLayers = parseBool();
790 break;
791
792 case T_subtractmaskfromsilk:
793 aPcbPlotParams->m_subtractMaskFromSilk = parseBool();
794 break;
795
796 case T_outputformat:
797 aPcbPlotParams->m_format = static_cast<PLOT_FORMAT>(
798 parseInt( static_cast<int>( PLOT_FORMAT::FIRST_FORMAT ),
799 static_cast<int>( PLOT_FORMAT::LAST_FORMAT ) ) );
800 break;
801
802 case T_mirror:
803 aPcbPlotParams->m_mirror = parseBool();
804 break;
805
806 case T_drillshape:
807 aPcbPlotParams->m_drillMarks = static_cast<DRILL_MARKS> ( parseInt( 0, 2 ) );
808 break;
809
810 case T_scaleselection:
811 aPcbPlotParams->m_scaleSelection = parseInt( 0, 4 );
812 break;
813
814 case T_outputdirectory:
815 NeedSYMBOLorNUMBER(); // a dir name can be like a number
816 aPcbPlotParams->m_outputDirectory = From_UTF8( CurText() );
817 break;
818
819 default:
820 skipCurrent(); // skip unknown or outdated plot parameter
821 skip_right = true; // the closing right token is already read.
822 break;
823 }
824
825 if( ! skip_right )
826 NeedRIGHT();
827 }
828}
829
830
832{
833 T token = NeedSYMBOL();
834
835 switch( token )
836 {
837 case T_false:
838 case T_no:
839 return false;
840
841 case T_true:
842 case T_yes:
843 return true;
844
845 default:
846 Expecting( "true, false, yes, or no" );
847 return false;
848 }
849}
850
851
852int PCB_PLOT_PARAMS_PARSER::parseInt( int aMin, int aMax )
853{
854 T token = NextTok();
855
856 if( token != T_NUMBER )
857 Expecting( T_NUMBER );
858
859 int val = atoi( CurText() );
860
861 if( val < aMin )
862 val = aMin;
863 else if( val > aMax )
864 val = aMax;
865
866 return val;
867}
868
869
871{
872 T token = NextTok();
873
874 if( token != T_NUMBER )
875 Expecting( T_NUMBER );
876
877 return DSNLEXER::parseDouble();
878}
879
880
882{
883 int curr_level = 0;
884 T token;
885
886 while( ( token = NextTok() ) != T_EOF )
887 {
888 if( token == T_LEFT )
889 curr_level--;
890
891 if( token == T_RIGHT )
892 {
893 curr_level++;
894
895 if( curr_level > 0 )
896 return;
897 }
898 }
899}
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:128
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:358
BASE_SET & set(size_t pos)
Definition base_set.h:126
std::string FmtHex() const
Return a hex string showing contents of this set.
Definition base_set.h:312
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:400
double parseDouble()
Parse the current token as an ASCII numeric string with possible leading whitespace into a double pre...
Definition dsnlexer.cpp:867
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition richio.h:65
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:294
std::string Quotew(const wxString &aWrapee) const
Definition richio.cpp:505
int PRINTF_FUNC_N Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition richio.cpp:432
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
Deprecated; only used for reading legacy files.
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
Dummy colors object that can be created if there is no Pgm context.
bool m_A4Output
Autoscale the plot to fit an A4 (landscape?) sheet.
int m_scaleSelection
Scale ratio index (UI only)
PLOT_TEXT_MODE m_textMode
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
When true set the scale to fit the board in the page.
bool m_useGerberProtelExtensions
When plotting gerber files, use a conventional set of Protel extensions instead of ....
bool GetCreateGerberJobFile() const
bool m_useAuxOrigin
Plot gerbers using auxiliary (drill) origin instead of absolute coordinates.
double m_scale
Global scale factor, 1.0 plots a board at actual size.
COLOR4D m_backgroundColor
Background color to use for PNG and PDF plotting.
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 black and white only.
DXF_OUTLINE_MODE GetDXFPlotMode() const override
PLOT_FORMAT m_format
Plot format type (chooses the driver to be used)
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
On gerbers 'scrape' away the solder mask from silkscreen (trim silks)
COLOR_SETTINGS * m_colors
Pointer to color settings to be used for plotting.
bool GetUseGerberX2format() const
bool m_mirror
Mirror the plot around the X axis.
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
FILLED or SKETCH for filled objects.
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_skipNPTH_Pads
Used to disable NPTH pads plotting on copper layers.
double GetDashedLineDashRatio() const
void SetSvgPrecision(unsigned aPrecision)
DRILL_MARKS m_drillMarks
Holes can be not plotted, have a small mark, or be plotted in actual size.
bool m_useGerberX2format
Include attributes from the Gerber X2 format (chapter 5 in revision J2)
bool m_negative
Plot in negative color (supported only by some drivers)
void Format(OUTPUTFORMATTER *aFormatter) const
bool m_DXFExportAsMultiLayeredFile
bool m_plotPadNumbers
Plot pad numbers when sketching pads on fab layers.
bool m_DXFPolygonMode
In polygon mode, each item to plot is converted to a polygon and all polygons are merged.
static const char * getTokenName(T aTok)
static const bool FILLED
Definition gr_basic.cpp:30
static wxString From_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition idf_helpers.h:44
static const int GBR_DEFAULT_PRECISION
#define SVG_PRECISION_MIN
#define SVG_PRECISION_MAX
#define SVG_PRECISION_DEFAULT
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])
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
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:83
PLOT_FORMAT
The set of supported output plot formats.
Definition plotter.h:65
@ LAST_FORMAT
Definition plotter.h:75
@ FIRST_FORMAT
Definition plotter.h:67
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
std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...