KiCad PCB EDA Suite
dialog_plot.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
24#include <wx/bmpbuttn.h>
25#include <wx/clntdata.h>
26#include <wx/rearrangectrl.h>
27
28#include <kiface_base.h>
29#include <plotters/plotter.h>
30#include <confirm.h>
31#include <pcb_edit_frame.h>
32#include <pcbnew_settings.h>
33#include <pcbplot.h>
34#include <pgm_base.h>
36#include <reporter.h>
38#include <layer_ids.h>
39#include <locale_io.h>
40#include <bitmaps.h>
41#include <board.h>
43#include <dialog_plot.h>
44#include <dialog_gendrill.h>
46#include <tool/tool_manager.h>
48#include <tools/drc_tool.h>
49#include <math/util.h> // for KiROUND
50#include <macros.h>
51
52#include <wx/dirdlg.h>
53
54
57
58
62class PCB_LAYER_ID_CLIENT_DATA : public wxClientData
63{
64public:
67
68 void SetData( PCB_LAYER_ID aId ) { m_id = aId; }
69
70 PCB_LAYER_ID GetData() const { return m_id; }
71
72private:
74};
75
76
78 DIALOG_PLOT_BASE( aParent ),
79 m_parent( aParent ),
80 m_defaultPenSize( aParent, m_hpglPenLabel, m_hpglPenCtrl, m_hpglPenUnits ),
81 m_trackWidthCorrection( aParent, m_widthAdjustLabel, m_widthAdjustCtrl, m_widthAdjustUnits )
82{
83 BOARD* board = m_parent->GetBoard();
84
85 SetName( DLG_WINDOW_NAME );
86 m_plotOpts = aParent->GetPlotSettings();
88
89 m_messagesPanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
90
91 int order = 0;
92 LSET plotOnAllLayersSelection = m_plotOpts.GetPlotOnAllLayersSelection();
93 wxArrayInt plotAllLayersOrder;
94 wxArrayString plotAllLayersChoicesStrings;
95 std::vector<PCB_LAYER_ID> layersIdChoiceList;
96 int textWidth = 0;
97
98 for( LSEQ seq = board->GetEnabledLayers().UIOrder(); seq; ++seq )
99 {
100 PCB_LAYER_ID id = *seq;
101 wxString layerName = board->GetLayerName( id );
102
103 // wxCOL_WIDTH_AUTOSIZE doesn't work on all platforms, so we calculate width here
104 textWidth = std::max( textWidth, KIUI::GetTextSize( layerName, m_layerCheckListBox ).x );
105
106 plotAllLayersChoicesStrings.Add( layerName );
107 layersIdChoiceList.push_back( id );
108
109 size_t size = plotOnAllLayersSelection.size();
110
111 if( ( static_cast<size_t>( id ) <= size ) && plotOnAllLayersSelection.test( id ) )
112 plotAllLayersOrder.push_back( order );
113 else
114 plotAllLayersOrder.push_back( ~order );
115
116 order += 1;
117 }
118
119 int checkColSize = 22;
120 int layerColSize = textWidth + 15;
121
122#ifdef __WXMAC__
123 // TODO: something in wxWidgets 3.1.x pads checkbox columns with extra space. (It used to
124 // also be that the width of the column would get set too wide (to 30), but that's patched in
125 // our local wxWidgets fork.)
126 checkColSize += 30;
127#endif
128
129 m_layerCheckListBox->SetMinClientSize( wxSize( checkColSize + layerColSize,
130 m_layerCheckListBox->GetMinClientSize().y ) );
131
132 wxStaticBox* allLayersLabel = new wxStaticBox( this, wxID_ANY, _( "Plot on All Layers" ) );
133 wxStaticBoxSizer* sbSizer = new wxStaticBoxSizer( allLayersLabel, wxVERTICAL );
134
135 m_plotAllLayersList = new wxRearrangeList( sbSizer->GetStaticBox(), wxID_ANY,
136 wxDefaultPosition, wxDefaultSize,
137 plotAllLayersOrder, plotAllLayersChoicesStrings, 0 );
138
139 m_plotAllLayersList->SetMinClientSize( wxSize( checkColSize + layerColSize,
140 m_plotAllLayersList->GetMinClientSize().y ) );
141
142 // Attach the LAYER_ID to each item in m_plotAllLayersList
143 // plotAllLayersChoicesStrings and layersIdChoiceList are in the same order,
144 // but m_plotAllLayersList has these strings in a different order
145 for( size_t idx = 0; idx < layersIdChoiceList.size(); idx++ )
146 {
147 wxString& txt = plotAllLayersChoicesStrings[idx];
148 int list_idx = m_plotAllLayersList->FindString( txt, true );
149
150 PCB_LAYER_ID layer_id = layersIdChoiceList[idx];
151 m_plotAllLayersList->SetClientObject( list_idx, new PCB_LAYER_ID_CLIENT_DATA( layer_id ) );
152 }
153
154 sbSizer->Add( m_plotAllLayersList, 1, wxALL | wxEXPAND, 5 );
155
156 wxBoxSizer* bButtonSizer;
157 bButtonSizer = new wxBoxSizer( wxHORIZONTAL );
158
159 m_bpMoveUp = new wxBitmapButton( sbSizer->GetStaticBox(), wxID_ANY, wxNullBitmap,
160 wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW | 0 );
161 m_bpMoveUp->SetToolTip( _( "Move current selection up" ) );
162 m_bpMoveUp->SetBitmap( KiBitmap( BITMAPS::small_up ) );
163
164 bButtonSizer->Add( m_bpMoveUp, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
165
166 m_bpMoveDown = new wxBitmapButton( sbSizer->GetStaticBox(), wxID_ANY, wxNullBitmap,
167 wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW | 0 );
168 m_bpMoveDown->SetToolTip( _( "Move current selection down" ) );
170
171 bButtonSizer->Add( m_bpMoveDown, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
172
173 sbSizer->Add( bButtonSizer, 0, wxALL | wxEXPAND, 5 );
174 bmiddleSizer->Insert( 1, sbSizer, 1, wxALL | wxEXPAND, 3 );
175
176 init_Dialog();
177
178 SetupStandardButtons( { { wxID_OK, _( "Plot" ) },
179 { wxID_APPLY, _( "Generate Drill Files..." ) },
180 { wxID_CANCEL, _( "Close" ) } } );
181
182 GetSizer()->Fit( this );
183 GetSizer()->SetSizeHints( this );
184
185 m_bpMoveUp->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveUp, this );
186 m_bpMoveDown->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveDown, this );
187}
188
189
191{
192 m_bpMoveDown->Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveDown, this );
193 m_bpMoveUp->Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveUp, this );
194}
195
196
198{
199 BOARD* board = m_parent->GetBoard();
200 wxFileName fileName;
201
202 auto cfg = m_parent->GetPcbNewSettings();
203
204 m_XScaleAdjust = cfg->m_Plot.fine_scale_x;
205 m_YScaleAdjust = cfg->m_Plot.fine_scale_y;
206
207 m_zoneFillCheck->SetValue( cfg->m_Plot.check_zones_before_plotting );
208
210
211 // m_PSWidthAdjust is stored in mm in user config
212 m_PSWidthAdjust = KiROUND( cfg->m_Plot.ps_fine_width_adjust * pcbIUScale.IU_PER_MM );
213
214 // The reasonable width correction value must be in a range of
215 // [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils.
218
219 switch( m_plotOpts.GetFormat() )
220 {
221 default:
222 case PLOT_FORMAT::GERBER: m_plotFormatOpt->SetSelection( 0 ); break;
223 case PLOT_FORMAT::POST: m_plotFormatOpt->SetSelection( 1 ); break;
224 case PLOT_FORMAT::SVG: m_plotFormatOpt->SetSelection( 2 ); break;
225 case PLOT_FORMAT::DXF: m_plotFormatOpt->SetSelection( 3 ); break;
226 case PLOT_FORMAT::HPGL: m_plotFormatOpt->SetSelection( 4 ); break;
227 case PLOT_FORMAT::PDF: m_plotFormatOpt->SetSelection( 5 ); break;
228 }
229
230 // Set units and value for HPGL pen size (this param is in mils).
232
233 // Test for a reasonable scale value. Set to 1 if problem
236 {
238 }
239
242 m_XScaleAdjust ) );
243
246 m_YScaleAdjust ) );
247
248 // Test for a reasonable PS width correction value. Set to 0 if problem.
249 if( m_PSWidthAdjust < m_widthAdjustMinValue || m_PSWidthAdjust > m_widthAdjustMaxValue )
250 m_PSWidthAdjust = 0.;
251
253
256
257 // Could devote a PlotOrder() function in place of UIOrder().
259
260 // Populate the check list box by all enabled layers names.
261 for( LSEQ seq = m_layerList; seq; ++seq )
262 {
263 PCB_LAYER_ID layer = *seq;
264
265 int checkIndex = m_layerCheckListBox->Append( board->GetLayerName( layer ) );
266
267 if( m_plotOpts.GetLayerSelection()[layer] )
268 m_layerCheckListBox->Check( checkIndex );
269 }
270
271 // Option for disabling Gerber Aperture Macro (for broken Gerber readers)
273
274 // Option for using proper Gerber extensions. Note also Protel extensions are
275 // a broken feature. However, for now, we need to handle it.
277
278 // Option for including Gerber attributes, from Gerber X2 format, in the output
279 // In X1 format, they will be added as comments
281
282 // Option for including Gerber netlist info (from Gerber X2 format) in the output
284
285 // Option to generate a Gerber job file
287
288 // Gerber precision for coordinates
289 m_coordFormatCtrl->SetSelection( m_plotOpts.GetGerberPrecision() == 5 ? 0 : 1 );
290
291 // SVG precision and units for coordinates
293
294 // Option to exclude pads from silkscreen layers
296
297 // Option to tent vias
299
300 // Option to use aux origin
302
303 // Option to plot page references:
305
306 // Options to plot texts on footprints
310
311 // Options to plot pads and vias holes
312 m_drillShapeOpt->SetSelection( (int)m_plotOpts.GetDrillMarksType() );
313
314 // Scale option
315 m_scaleOpt->SetSelection( m_plotOpts.GetScaleSelection() );
316
317 // Plot mode
319
320 // DXF outline mode
322
323 // DXF text mode
325
326 // DXF units selection
327 m_DXF_plotUnits->SetSelection( m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::INCHES ? 0 : 1);
328
329 // Plot mirror option
330 m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() );
331
332 // Put vias on mask layer
334
335 // Black and white plotting
338
339 // Initialize a few other parameters, which can also be modified
340 // from the drill dialog
341 reInitDialog();
342
343 // Update options values:
344 wxCommandEvent cmd_event;
345 SetPlotFormat( cmd_event );
346 OnSetScaleOpt( cmd_event );
347}
348
349
351{
352 // after calling the Drill or DRC dialogs some parameters can be modified....
353
354 // Output directory
356
357 // Origin of coordinates:
359
360 int knownViolations = 0;
361 int exclusions = 0;
362
363 for( PCB_MARKER* marker : m_parent->GetBoard()->Markers() )
364 {
365 if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
366 exclusions++;
367 else
368 knownViolations++;
369 }
370
371 if( knownViolations || exclusions )
372 {
374 exclusions ) );
376 }
377 else
378 {
380 }
381
382 BOARD* board = m_parent->GetBoard();
383 const BOARD_DESIGN_SETTINGS& brd_settings = board->GetDesignSettings();
384
386 ( brd_settings.m_SolderMaskExpansion || brd_settings.m_SolderMaskMinWidth ) )
387 {
389 }
390 else
391 {
393 }
394}
395
396
397// A helper function to show a popup menu, when the dialog is right clicked.
398void DIALOG_PLOT::OnRightClick( wxMouseEvent& event )
399{
400 PopupMenu( m_popMenu );
401}
402
403
404// Select or deselect groups of layers in the layers list:
405void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
406{
407 // Build a list of layers for usual fabrication: copper layers + tech layers without courtyard
408 LSET fab_layer_set = ( LSET::AllCuMask() | LSET::AllTechMask() ) & ~LSET( 2, B_CrtYd, F_CrtYd );
409
410 switch( event.GetId() )
411 {
412 case ID_LAYER_FAB: // Select layers usually needed to build a board
413 for( unsigned i = 0; i < m_layerList.size(); i++ )
414 {
415 LSET layermask( m_layerList[ i ] );
416
417 if( ( layermask & fab_layer_set ).any() )
418 m_layerCheckListBox->Check( i, true );
419 else
420 m_layerCheckListBox->Check( i, false );
421 }
422
423 break;
424
426 for( unsigned i = 0; i < m_layerList.size(); i++ )
427 {
428 if( IsCopperLayer( m_layerList[i] ) )
429 m_layerCheckListBox->Check( i, true );
430 }
431
432 break;
433
435 for( unsigned i = 0; i < m_layerList.size(); i++ )
436 {
437 if( IsCopperLayer( m_layerList[i] ) )
438 m_layerCheckListBox->Check( i, false );
439 }
440
441 break;
442
444 for( unsigned i = 0; i < m_layerList.size(); i++ )
445 m_layerCheckListBox->Check( i, true );
446
447 break;
448
450 for( unsigned i = 0; i < m_layerList.size(); i++ )
451 m_layerCheckListBox->Check( i, false );
452
453 break;
454
455 default:
456 break;
457 }
458}
459
460
461void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
462{
463 // Be sure drill file use the same settings (axis option, plot directory) as plot files:
465
466 DIALOG_GENDRILL dlg( m_parent, this );
467 dlg.ShowModal();
468
469 // a few plot settings can be modified: take them in account
471 reInitDialog();
472}
473
474
475void DIALOG_PLOT::OnChangeDXFPlotMode( wxCommandEvent& event )
476{
477 // m_DXF_plotTextStrokeFontOpt is disabled if m_DXF_plotModeOpt is checked (plot in DXF
478 // polygon mode)
479 m_DXF_plotTextStrokeFontOpt->Enable( !m_DXF_plotModeOpt->GetValue() );
480
481 // if m_DXF_plotTextStrokeFontOpt option is disabled (plot DXF in polygon mode), force
482 // m_DXF_plotTextStrokeFontOpt to true to use Pcbnew stroke font
483 if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() )
484 m_DXF_plotTextStrokeFontOpt->SetValue( true );
485}
486
487
488void DIALOG_PLOT::OnSetScaleOpt( wxCommandEvent& event )
489{
490 /* Disable sheet reference for scale != 1:1 */
491 bool scale1 = ( m_scaleOpt->GetSelection() == 1 );
492
493 m_plotSheetRef->Enable( scale1 );
494
495 if( !scale1 )
496 m_plotSheetRef->SetValue( false );
497}
498
499
501{
502 // Build the absolute path of current output directory to preselect it in the file browser.
503 std::function<bool( wxString* )> textResolver =
504 [&]( wxString* token ) -> bool
505 {
506 return m_parent->GetBoard()->ResolveTextVar( token, 0 );
507 };
508
509 wxString path = m_outputDirectoryName->GetValue();
510 path = ExpandTextVars( path, &textResolver, nullptr, &Prj() );
512 path = Prj().AbsolutePath( path );
513
514 wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
515
516 if( dirDialog.ShowModal() == wxID_CANCEL )
517 return;
518
519 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
520
521 wxFileName fn( Prj().AbsolutePath( m_parent->GetBoard()->GetFileName() ) );
522 wxString defaultPath = fn.GetPathWithSep();
523 wxString msg;
524 wxFileName relPathTest; // Used to test if we can make the path relative
525
526 relPathTest.Assign( dirDialog.GetPath() );
527
528 // Test if making the path relative is possible before asking the user if they want to do it
529 if( relPathTest.MakeRelativeTo( defaultPath ) )
530 {
531 msg.Printf( _( "Do you want to use a path relative to\n'%s'?" ), defaultPath );
532
533 wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
534 wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
535
536 if( dialog.ShowModal() == wxID_YES )
537 dirName.MakeRelativeTo( defaultPath );
538 }
539
540 m_outputDirectoryName->SetValue( dirName.GetFullPath() );
541}
542
543
545{
546 // plot format id's are ordered like displayed in m_plotFormatOpt
547 static const PLOT_FORMAT plotFmt[] = {
554
555 return plotFmt[m_plotFormatOpt->GetSelection()];
556}
557
558
559void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
560{
561 // this option exist only in DXF format:
563
564 // The alert message about non 0 solder mask min width and margin is shown
565 // only in gerber format and if min mask width or mask margin is not 0
566 BOARD* board = m_parent->GetBoard();
567 const BOARD_DESIGN_SETTINGS& brd_settings = board->GetDesignSettings();
568
570 && ( brd_settings.m_SolderMaskExpansion || brd_settings.m_SolderMaskMinWidth ) )
571 {
573 }
574 else
575 {
577 }
578
579 switch( getPlotFormat() )
580 {
581 case PLOT_FORMAT::SVG:
582 case PLOT_FORMAT::PDF:
583 m_drillShapeOpt->Enable( true );
584 m_plotModeOpt->Enable( false );
586 m_plotMirrorOpt->Enable( true );
587 m_useAuxOriginCheckBox->Enable( false );
588 m_useAuxOriginCheckBox->SetValue( false );
589 m_defaultPenSize.Enable( false );
590 m_scaleOpt->Enable( false );
591 m_scaleOpt->SetSelection( 1 );
592 m_fineAdjustXCtrl->Enable( false );
593 m_fineAdjustYCtrl->Enable( false );
595 m_plotPSNegativeOpt->Enable( true );
596 m_forcePSA4OutputOpt->Enable( false );
597 m_forcePSA4OutputOpt->SetValue( false );
598
600 {
603 }
604 else
605 {
608 }
609
614 break;
615
617 m_drillShapeOpt->Enable( true );
618 m_plotModeOpt->Enable( true );
619 m_plotMirrorOpt->Enable( true );
620 m_useAuxOriginCheckBox->Enable( false );
621 m_useAuxOriginCheckBox->SetValue( false );
622 m_defaultPenSize.Enable( false );
623 m_scaleOpt->Enable( true );
624 m_fineAdjustXCtrl->Enable( true );
625 m_fineAdjustYCtrl->Enable( true );
627 m_plotPSNegativeOpt->Enable( true );
628 m_forcePSA4OutputOpt->Enable( true );
629
636 break;
637
639 m_drillShapeOpt->Enable( false );
640 m_drillShapeOpt->SetSelection( 0 );
641 m_plotModeOpt->Enable( false );
643 m_plotMirrorOpt->Enable( false );
644 m_plotMirrorOpt->SetValue( false );
645 m_useAuxOriginCheckBox->Enable( true );
646 m_defaultPenSize.Enable( false );
647 m_scaleOpt->Enable( false );
648 m_scaleOpt->SetSelection( 1 );
649 m_fineAdjustXCtrl->Enable( false );
650 m_fineAdjustYCtrl->Enable( false );
652 m_plotPSNegativeOpt->Enable( false );
653 m_plotPSNegativeOpt->SetValue( false );
654 m_forcePSA4OutputOpt->Enable( false );
655 m_forcePSA4OutputOpt->SetValue( false );
656
663 break;
664
666 m_drillShapeOpt->Enable( true );
667 m_plotModeOpt->Enable( true );
668 m_plotMirrorOpt->Enable( true );
669 m_useAuxOriginCheckBox->Enable( false );
670 m_useAuxOriginCheckBox->SetValue( false );
671 m_defaultPenSize.Enable( true );
672 m_scaleOpt->Enable( true );
673 m_fineAdjustXCtrl->Enable( false );
674 m_fineAdjustYCtrl->Enable( false );
676 m_plotPSNegativeOpt->SetValue( false );
677 m_plotPSNegativeOpt->Enable( false );
678 m_forcePSA4OutputOpt->Enable( true );
679
686 break;
687
688 case PLOT_FORMAT::DXF:
689 m_drillShapeOpt->Enable( true );
690 m_plotModeOpt->Enable( false );
692 m_plotMirrorOpt->Enable( false );
693 m_plotMirrorOpt->SetValue( false );
694 m_useAuxOriginCheckBox->Enable( true );
695 m_defaultPenSize.Enable( false );
696 m_scaleOpt->Enable( false );
697 m_scaleOpt->SetSelection( 1 );
698 m_fineAdjustXCtrl->Enable( false );
699 m_fineAdjustYCtrl->Enable( false );
701 m_plotPSNegativeOpt->Enable( false );
702 m_plotPSNegativeOpt->SetValue( false );
703 m_forcePSA4OutputOpt->Enable( false );
704 m_forcePSA4OutputOpt->SetValue( false );
705
712
713 OnChangeDXFPlotMode( event );
714 break;
715
717 break;
718 }
719
720 /* Update the interlock between scale and frame reference
721 * (scaling would mess up the frame border...) */
722 OnSetScaleOpt( event );
723
724 Layout();
725 m_MainSizer->SetSizeHints( this );
726}
727
728
729// A helper function to "clip" aValue between aMin and aMax and write result in * aResult
730// return false if clipped, true if aValue is just copied into * aResult
731static bool setDouble( double* aResult, double aValue, double aMin, double aMax )
732{
733 if( aValue < aMin )
734 {
735 *aResult = aMin;
736 return false;
737 }
738 else if( aValue > aMax )
739 {
740 *aResult = aMax;
741 return false;
742 }
743
744 *aResult = aValue;
745 return true;
746}
747
748
749static bool setInt( int* aResult, int aValue, int aMin, int aMax )
750{
751 if( aValue < aMin )
752 {
753 *aResult = aMin;
754 return false;
755 }
756 else if( aValue > aMax )
757 {
758 *aResult = aMax;
759 return false;
760 }
761
762 *aResult = aValue;
763 return true;
764}
765
766
768{
769 REPORTER& reporter = m_messagesPanel->Reporter();
770 PCB_PLOT_PARAMS tempOptions;
771
772 tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
773 tempOptions.SetPlotFrameRef( m_plotSheetRef->GetValue() );
774 tempOptions.SetSketchPadsOnFabLayers( m_sketchPadsOnFabLayers->GetValue() );
775 tempOptions.SetUseAuxOrigin( m_useAuxOriginCheckBox->GetValue() );
776 tempOptions.SetPlotValue( m_plotModuleValueOpt->GetValue() );
777 tempOptions.SetPlotReference( m_plotModuleRefOpt->GetValue() );
778 tempOptions.SetPlotInvisibleText( m_plotInvisibleText->GetValue() );
779 tempOptions.SetScaleSelection( m_scaleOpt->GetSelection() );
780
781 int sel = m_drillShapeOpt->GetSelection();
782 tempOptions.SetDrillMarksType( static_cast<DRILL_MARKS>( sel ) );
783
784 tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
785 tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED );
786 tempOptions.SetDXFPlotPolygonMode( m_DXF_plotModeOpt->GetValue() );
787
788 sel = m_DXF_plotUnits->GetSelection();
789 tempOptions.SetDXFPlotUnits( sel == 0 ? DXF_UNITS::INCHES : DXF_UNITS::MILLIMETERS );
790
791 tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() );
792
793 if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option
795 else
798
800 tempOptions.SetBlackAndWhite( m_SVGBlackAndWhite->GetValue() );
801 else if( getPlotFormat() == PLOT_FORMAT::PDF )
802 tempOptions.SetBlackAndWhite( m_PDFBlackAndWhite->GetValue() );
803 else
804 tempOptions.SetBlackAndWhite( true );
805
806 // Update settings from text fields. Rewrite values back to the fields,
807 // since the values may have been constrained by the setters.
808 wxString msg;
809
810 // read HPLG pen size (this param is stored in mils)
811 // However, due to issues when converting this value from or to mm
812 // that can slightly change the value, update this param only if it
813 // is in use
815 {
817 {
819 msg.Printf( _( "HPGL pen size constrained." ) );
820 reporter.Report( msg, RPT_SEVERITY_INFO );
821 }
822 }
823 else // keep the last value (initial value if no HPGL plot made)
824 {
826 }
827
828 // X scale
829 double tmpDouble;
830 msg = m_fineAdjustXCtrl->GetValue();
831 msg.ToDouble( &tmpDouble );
832
834 {
835 msg.Printf( wxT( "%f" ), m_XScaleAdjust );
836 m_fineAdjustXCtrl->SetValue( msg );
837 msg.Printf( _( "X scale constrained." ) );
838 reporter.Report( msg, RPT_SEVERITY_INFO );
839 }
840
841 // Y scale
842 msg = m_fineAdjustYCtrl->GetValue();
843 msg.ToDouble( &tmpDouble );
844
846 {
847 msg.Printf( wxT( "%f" ), m_YScaleAdjust );
848 m_fineAdjustYCtrl->SetValue( msg );
849 msg.Printf( _( "Y scale constrained." ) );
850 reporter.Report( msg, RPT_SEVERITY_INFO );
851 }
852
853 auto cfg = m_parent->GetPcbNewSettings();
854
856 cfg->m_Plot.fine_scale_y = m_YScaleAdjust;
857
858 cfg->m_Plot.check_zones_before_plotting = m_zoneFillCheck->GetValue();
859
860 // PS Width correction
863 {
865 msg.Printf( _( "Width correction constrained. The width correction value must be in the"
866 " range of [%s; %s] for the current design rules." ),
869 reporter.Report( msg, RPT_SEVERITY_WARNING );
870 }
871
872 // Store m_PSWidthAdjust in mm in user config
873 cfg->m_Plot.ps_fine_width_adjust = pcbIUScale.IUTomm( m_PSWidthAdjust );
874
875 tempOptions.SetFormat( getPlotFormat() );
876
877 tempOptions.SetDisableGerberMacros( m_disableApertMacros->GetValue() );
878 tempOptions.SetUseGerberProtelExtensions( m_useGerberExtensions->GetValue() );
879 tempOptions.SetUseGerberX2format( m_useGerberX2Format->GetValue() );
880 tempOptions.SetIncludeGerberNetlistInfo( m_useGerberNetAttributes->GetValue() );
881 tempOptions.SetCreateGerberJobFile( m_generateGerberJobFile->GetValue() );
882
883 tempOptions.SetGerberPrecision( m_coordFormatCtrl->GetSelection() == 0 ? 5 : 6 );
884 tempOptions.SetSvgPrecision( m_svgPrecsision->GetValue() );
885
886 LSET selectedLayers;
887
888 for( unsigned i = 0; i < m_layerList.size(); i++ )
889 {
890 if( m_layerCheckListBox->IsChecked( i ) )
891 selectedLayers.set( m_layerList[i] );
892 }
893
894 // Get a list of copper layers that aren't being used by inverting enabled layers.
895 LSET disabledCopperLayers = LSET::AllCuMask() & ~m_parent->GetBoard()->GetEnabledLayers();
896
897 LSET plotOnAllLayers;
898
899 // Add selected layers from plot on all layers list in order set by user.
900 wxArrayInt plotOnAllLayersSelections;
901
902 m_plotAllLayersList->GetCheckedItems( plotOnAllLayersSelections );
903
904 size_t count = plotOnAllLayersSelections.GetCount();
905
906 for( size_t i = 0; i < count; i++ )
907 {
908 int index = plotOnAllLayersSelections.Item( i );
909 wxClientData* tmp = m_plotAllLayersList->GetClientObject( index );
910 PCB_LAYER_ID_CLIENT_DATA* layerId = dynamic_cast<PCB_LAYER_ID_CLIENT_DATA*>( tmp );
911
912 wxCHECK2( layerId, continue );
913
914 plotOnAllLayers.set( layerId->GetData() );
915 }
916
917 tempOptions.SetPlotOnAllLayersSelection( plotOnAllLayers );
918
919 // Enable all of the disabled copper layers.
920 // If someone enables more copper layers they will be selected by default.
921 selectedLayers = selectedLayers | disabledCopperLayers;
922 tempOptions.SetLayerSelection( selectedLayers );
923
924 tempOptions.SetNegative( m_plotPSNegativeOpt->GetValue() );
925 tempOptions.SetA4Output( m_forcePSA4OutputOpt->GetValue() );
926
927 // Set output directory and replace backslashes with forward ones
928 wxString dirStr;
929 dirStr = m_outputDirectoryName->GetValue();
930 dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
931 tempOptions.SetOutputDirectory( dirStr );
932
933 if( !m_plotOpts.IsSameAs( tempOptions ) )
934 {
935 m_parent->SetPlotSettings( tempOptions );
937 m_plotOpts = tempOptions;
938 }
939}
940
941
942void DIALOG_PLOT::OnGerberX2Checked( wxCommandEvent& event )
943{
944 // Currently: do nothing
945}
946
947
948void DIALOG_PLOT::Plot( wxCommandEvent& event )
949{
950 BOARD* board = m_parent->GetBoard();
951
953
954 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
956
958
960
961 // If no layer selected, we have nothing plotted.
962 // Prompt user if it happens because he could think there is a bug in Pcbnew.
963 if( !m_plotOpts.GetLayerSelection().any() )
964 {
965 DisplayError( this, _( "No layer selected, Nothing to plot" ) );
966 return;
967 }
968
969 // Create output directory if it does not exist (also transform it in absolute form).
970 // Bail if it fails.
971
972 std::function<bool( wxString* )> textResolver =
973 [&]( wxString* token ) -> bool
974 {
975 // Handles board->GetTitleBlock() *and* board->GetProject()
976 return m_parent->GetBoard()->ResolveTextVar( token, 0 );
977 };
978
980 path = ExpandTextVars( path, &textResolver, nullptr, board->GetProject() );
982
983 wxFileName outputDir = wxFileName::DirName( path );
984 wxString boardFilename = m_parent->GetBoard()->GetFileName();
985 REPORTER& reporter = m_messagesPanel->Reporter();
986
987 if( !EnsureFileDirectoryExists( &outputDir, boardFilename, &reporter ) )
988 {
989 wxString msg;
990 msg.Printf( _( "Could not write plot files to folder '%s'." ), outputDir.GetPath() );
991 DisplayError( this, msg );
992 return;
993 }
994
995 if( m_zoneFillCheck->GetValue() )
996 m_parent->GetToolManager()->GetTool<ZONE_FILLER_TOOL>()->CheckAllZones( this );
997
998 m_plotOpts.SetAutoScale( false );
999
1000 switch( m_plotOpts.GetScaleSelection() )
1001 {
1002 default: m_plotOpts.SetScale( 1 ); break;
1003 case 0: m_plotOpts.SetAutoScale( true ); break;
1004 case 2: m_plotOpts.SetScale( 1.5 ); break;
1005 case 3: m_plotOpts.SetScale( 2 ); break;
1006 case 4: m_plotOpts.SetScale( 3 ); break;
1007 }
1008
1009 /* If the scale factor edit controls are disabled or the scale value
1010 * is 0, don't adjust the base scale factor. This fixes a bug when
1011 * the default scale adjust is initialized to 0 and saved in program
1012 * settings resulting in a divide by zero fault.
1013 */
1015 {
1016 if( m_XScaleAdjust != 0.0 )
1018
1019 if( m_YScaleAdjust != 0.0 )
1021
1023 }
1024
1025 wxString file_ext( GetDefaultPlotExtension( m_plotOpts.GetFormat() ) );
1026
1027 // Test for a reasonable scale value
1028 // XXX could this actually happen? isn't it constrained in the apply function?
1030 DisplayInfoMessage( this, _( "Warning: Scale option set to a very small value" ) );
1031
1033 DisplayInfoMessage( this, _( "Warning: Scale option set to a very large value" ) );
1034
1035 GERBER_JOBFILE_WRITER jobfile_writer( board, &reporter );
1036
1037 // Save the current plot options in the board
1039
1040 wxBusyCursor dummy;
1041
1042 for( LSEQ seq = m_plotOpts.GetLayerSelection().UIOrder(); seq; ++seq )
1043 {
1044 LSEQ plotSequence;
1045
1046 // Base layer always gets plotted first.
1047 plotSequence.push_back( *seq );
1048
1049 // Add selected layers from plot on all layers list in order set by user.
1050 wxArrayInt plotOnAllLayers;
1051
1052 if( m_plotAllLayersList->GetCheckedItems( plotOnAllLayers ) )
1053 {
1054 size_t count = plotOnAllLayers.GetCount();
1055
1056 for( size_t i = 0; i < count; i++ )
1057 {
1058 int index = plotOnAllLayers.Item( i );
1059 wxClientData* tmp = m_plotAllLayersList->GetClientObject( index );
1060 PCB_LAYER_ID_CLIENT_DATA* layerId = dynamic_cast<PCB_LAYER_ID_CLIENT_DATA*>( tmp );
1061
1062 wxCHECK2( layerId, continue );
1063
1064 // Don't plot the same layer more than once;
1065 if( find( plotSequence.begin(), plotSequence.end(), layerId->GetData() ) !=
1066 plotSequence.end() )
1067 continue;
1068
1069 plotSequence.push_back( layerId->GetData() );
1070 }
1071 }
1072
1073 PCB_LAYER_ID layer = *seq;
1074
1075 // All copper layers that are disabled are actually selected
1076 // This is due to wonkyness in automatically selecting copper layers
1077 // for plotting when adding more than two layers to a board.
1078 // If plot options become accessible to the layers setup dialog
1079 // please move this functionality there!
1080 // This skips a copper layer if it is actually disabled on the board.
1081 if( ( LSET::AllCuMask() & ~board->GetEnabledLayers() )[layer] )
1082 continue;
1083
1084 // Pick the basename from the board file
1085 wxFileName fn( boardFilename );
1086
1087 // Use Gerber Extensions based on layer number
1088 // (See http://en.wikipedia.org/wiki/Gerber_File)
1090 file_ext = GetGerberProtelExtension( layer );
1091
1092 BuildPlotFileName( &fn, outputDir.GetPath(), board->GetLayerName( layer ), file_ext );
1093 wxString fullname = fn.GetFullName();
1094 jobfile_writer.AddGbrFile( layer, fullname );
1095
1096 LOCALE_IO toggle;
1097
1098 //@todo allow controlling the sheet name and path that will be displayed in the title block
1099 // Leave blank for now
1100 PLOTTER* plotter = StartPlotBoard( board, &m_plotOpts, layer, fn.GetFullPath(),
1101 wxEmptyString, wxEmptyString );
1102
1103 // Print diags in messages box:
1104 wxString msg;
1105
1106 if( plotter )
1107 {
1108 PlotBoardLayers( board, plotter, plotSequence, m_plotOpts );
1109 PlotInteractiveLayer( board, plotter );
1110 plotter->EndPlot();
1111 delete plotter->RenderSettings();
1112 delete plotter;
1113
1114 msg.Printf( _( "Plotted to '%s'." ), fn.GetFullPath() );
1115 reporter.Report( msg, RPT_SEVERITY_ACTION );
1116 }
1117 else
1118 {
1119 msg.Printf( _( "Failed to create file '%s'." ), fn.GetFullPath() );
1120 reporter.Report( msg, RPT_SEVERITY_ERROR );
1121 }
1122
1123 wxSafeYield(); // displays report message.
1124 }
1125
1127 {
1128 // Pick the basename from the board file
1129 wxFileName fn( boardFilename );
1130
1131 // Build gerber job file from basename
1132 BuildPlotFileName( &fn, outputDir.GetPath(), wxT( "job" ), GerberJobFileExtension );
1133 jobfile_writer.CreateJobFile( fn.GetFullPath() );
1134 }
1135
1136 reporter.ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
1137}
1138
1139
1140void DIALOG_PLOT::onRunDRC( wxCommandEvent& event )
1141{
1142 PCB_EDIT_FRAME* parent = dynamic_cast<PCB_EDIT_FRAME*>( GetParent() );
1143
1144 if( parent )
1145 {
1146 DRC_TOOL* drcTool = parent->GetToolManager()->GetTool<DRC_TOOL>();
1147
1148 // First close an existing dialog if open
1149 // (low probability, but can happen)
1150 drcTool->DestroyDRCDialog();
1151
1152 // Open a new drc dialog, with the right parent frame, and in Modal Mode
1153 drcTool->ShowDRCDialog( this );
1154
1155 // Update DRC warnings on return to this dialog
1156 reInitDialog();
1157 }
1158}
1159
1160
1161void DIALOG_PLOT::onBoardSetup( wxHyperlinkEvent& aEvent )
1162{
1163 PCB_EDIT_FRAME* parent = dynamic_cast<PCB_EDIT_FRAME*>( GetParent() );
1164
1165 if( parent )
1166 {
1167 parent->ShowBoardSetupDialog( _( "Solder Mask/Paste" ) );
1168
1169 // Update warnings on return to this dialog
1170 reInitDialog();
1171 }
1172}
1173
1174
1175void DIALOG_PLOT::onPlotAllListMoveUp( wxCommandEvent& aEvent )
1176{
1177 if( m_plotAllLayersList->CanMoveCurrentUp() )
1178 m_plotAllLayersList->MoveCurrentUp();
1179}
1180
1181
1182void DIALOG_PLOT::onPlotAllListMoveDown( wxCommandEvent& aEvent )
1183{
1184 if( m_plotAllLayersList->CanMoveCurrentDown() )
1185 m_plotAllLayersList->MoveCurrentDown();
1186}
1187
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:112
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
@ small_folder
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:187
Container for design settings for a BOARD object.
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:511
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: board.cpp:307
MARKERS & Markers()
Definition: board.h:316
const wxString & GetFileName() const
Definition: board.h:302
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:410
PROJECT * GetProject() const
Definition: board.h:440
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:628
Class DIALOG_PLOT_BASE.
wxStaticText * m_DRCExclusionsWarning
wxTextCtrl * m_fineAdjustXCtrl
wxBoxSizer * bmiddleSizer
wxStaticBoxSizer * m_PDFOptionsSizer
wxCheckBox * m_disableApertMacros
wxChoice * m_scaleOpt
wxCheckBox * m_SVGBlackAndWhite
wxChoice * m_coordFormatCtrl
wxCheckBox * m_DXF_plotModeOpt
wxTextCtrl * m_outputDirectoryName
wxSpinCtrl * m_svgPrecsision
wxTextCtrl * m_fineAdjustYCtrl
wxStaticBoxSizer * m_HPGLOptionsSizer
wxCheckBox * m_useAuxOriginCheckBox
wxStaticBoxSizer * m_PSOptionsSizer
wxCheckBox * m_plotPSNegativeOpt
wxCheckBox * m_DXF_plotTextStrokeFontOpt
wxCheckBox * m_PDFBlackAndWhite
wxChoice * m_plotModeOpt
wxCheckBox * m_useGerberExtensions
wxCheckBox * m_plotSheetRef
wxBoxSizer * m_SizerSolderMaskAlert
wxCheckBox * m_generateGerberJobFile
wxCheckBox * m_useGerberX2Format
wxCheckListBox * m_layerCheckListBox
wxCheckBox * m_plotMirrorOpt
wxStaticBoxSizer * m_svgOptionsSizer
wxCheckBox * m_forcePSA4OutputOpt
wxCheckBox * m_useGerberNetAttributes
wxCheckBox * m_plotNoViaOnMaskOpt
wxCheckBox * m_sketchPadsOnFabLayers
wxCheckBox * m_subtractMaskFromSilk
wxBoxSizer * m_PlotOptionsSizer
wxChoice * m_DXF_plotUnits
wxCheckBox * m_plotModuleRefOpt
wxStaticBoxSizer * m_SizerDXF_options
wxCheckBox * m_plotInvisibleText
wxChoice * m_drillShapeOpt
wxCheckBox * m_plotModuleValueOpt
wxCheckBox * m_zoneFillCheck
wxStaticBoxSizer * m_GerberOptionsSizer
wxBitmapButton * m_browseButton
WX_HTML_REPORT_PANEL * m_messagesPanel
wxChoice * m_plotFormatOpt
wxBoxSizer * m_MainSizer
void OnRightClick(wxMouseEvent &event) override
void reInitDialog()
PCB_PLOT_PARAMS m_plotOpts
Definition: dialog_plot.h:92
void onPlotAllListMoveUp(wxCommandEvent &aEvent)
void OnChangeDXFPlotMode(wxCommandEvent &event) override
int m_widthAdjustMinValue
Definition: dialog_plot.h:84
UNIT_BINDER m_trackWidthCorrection
Definition: dialog_plot.h:88
void onBoardSetup(wxHyperlinkEvent &aEvent) override
wxBitmapButton * m_bpMoveUp
Definition: dialog_plot.h:95
PCB_EDIT_FRAME * m_parent
Definition: dialog_plot.h:74
void Plot(wxCommandEvent &event) override
void applyPlotSettings()
int m_PSWidthAdjust
Definition: dialog_plot.h:80
wxString m_DRCWarningTemplate
Definition: dialog_plot.h:90
void setPlotModeChoiceSelection(OUTLINE_MODE aPlotMode)
Definition: dialog_plot.h:69
void OnOutputDirectoryBrowseClicked(wxCommandEvent &event) override
wxRearrangeList * m_plotAllLayersList
Definition: dialog_plot.h:94
void onPlotAllListMoveDown(wxCommandEvent &aEvent)
void onRunDRC(wxCommandEvent &event) override
double m_YScaleAdjust
Definition: dialog_plot.h:78
void OnSetScaleOpt(wxCommandEvent &event) override
virtual ~DIALOG_PLOT()
static LSEQ m_lastPlotOnAllLayersOrder
The plot on all layers ordering the last time the dialog was opened.
Definition: dialog_plot.h:102
void OnPopUpLayers(wxCommandEvent &event) override
wxBitmapButton * m_bpMoveDown
Definition: dialog_plot.h:96
static LSET m_lastLayerSet
The plot layer set that last time the dialog was opened.
Definition: dialog_plot.h:99
DIALOG_PLOT(PCB_EDIT_FRAME *parent)
Definition: dialog_plot.cpp:77
void CreateDrillFile(wxCommandEvent &event) override
UNIT_BINDER m_defaultPenSize
Definition: dialog_plot.h:87
double m_XScaleAdjust
Definition: dialog_plot.h:76
PLOT_FORMAT getPlotFormat()
int m_widthAdjustMaxValue
Definition: dialog_plot.h:85
void OnGerberX2Checked(wxCommandEvent &event) override
void init_Dialog()
void SetPlotFormat(wxCommandEvent &event) override
LSEQ m_layerList
Definition: dialog_plot.h:75
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void ShowDRCDialog(wxWindow *aParent)
Opens the DRC dialog.
Definition: drc_tool.cpp:70
void DestroyDRCDialog()
Close and free the DRC dialog.
Definition: drc_tool.cpp:121
GERBER_JOBFILE_WRITER is a class used to create Gerber job file a Gerber job file stores info to make...
bool CreateJobFile(const wxString &aFullFilename)
Creates a Gerber job file.
void AddGbrFile(PCB_LAYER_ID aLayer, wxString &aFilename)
add a gerber file name and type in job file list
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:41
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:491
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
LSEQ UIOrder() const
Definition: lset.cpp:922
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:841
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:773
DIALOG_PLOT m_Plot
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
PCBNEW_SETTINGS * GetPcbNewSettings() const
BOARD * GetBoard() const
virtual void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings)
The main frame for Pcbnew.
void ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString)
void OnModify() override
Must be called after a board change to set the modified flag.
A helper wxWidgets control client data object to store layer IDs.
Definition: dialog_plot.cpp:63
PCB_LAYER_ID GetData() const
Definition: dialog_plot.cpp:70
void SetData(PCB_LAYER_ID aId)
Definition: dialog_plot.cpp:68
PCB_LAYER_ID_CLIENT_DATA(PCB_LAYER_ID aId)
Definition: dialog_plot.cpp:66
Parameters and options when plotting/printing a board.
bool GetNegative() const
PLOT_FORMAT GetFormat() const
void SetDrillMarksType(DRILL_MARKS aVal)
bool GetUseAuxOrigin() const
void SetLayerSelection(LSET aSelection)
void SetOutputDirectory(const wxString &aDir)
void SetPlotReference(bool aFlag)
void SetSketchPadsOnFabLayers(bool aFlag)
void SetUseGerberX2format(bool aUse)
bool GetMirror() const
DXF_UNITS GetDXFPlotUnits() const
bool GetPlotInvisibleText() const
void SetA4Output(int aForce)
PLOT_TEXT_MODE GetTextMode() const
void SetDXFPlotPolygonMode(bool aFlag)
void SetAutoScale(bool aFlag)
double GetHPGLPenDiameter() const
unsigned GetSvgPrecision() const
void SetPlotFrameRef(bool aFlag)
unsigned GetBlackAndWhite() const
double GetScale() const
bool GetCreateGerberJobFile() const
bool GetDXFPlotPolygonMode() const
void SetSketchPadLineWidth(int aWidth)
LSET GetLayerSelection() const
bool GetPlotReference() const
wxString GetOutputDirectory() const
int GetScaleSelection() const
void SetPlotOnAllLayersSelection(LSET aSelection)
LSET GetPlotOnAllLayersSelection() const
bool SetHPGLPenDiameter(double aValue)
void SetScale(double aVal)
void SetDisableGerberMacros(bool aDisable)
void SetScaleSelection(int aSelection)
void SetFineScaleAdjustX(double aVal)
void SetMirror(bool aFlag)
void SetBlackAndWhite(bool blackAndWhite)
void SetPlotViaOnMaskLayer(bool aFlag)
void SetGerberPrecision(int aPrecision)
void SetSubtractMaskFromSilk(bool aSubtract)
bool GetSketchPadsOnFabLayers() const
bool GetSubtractMaskFromSilk() const
void SetPlotValue(bool aFlag)
int GetGerberPrecision() const
void SetUseGerberProtelExtensions(bool aUse)
bool GetA4Output() const
DRILL_MARKS GetDrillMarksType() const
bool GetUseGerberX2format() const
void SetDXFPlotUnits(DXF_UNITS aUnit)
void SetColorSettings(COLOR_SETTINGS *aSettings)
bool IsSameAs(const PCB_PLOT_PARAMS &aPcbPlotParams) const
Compare current settings to aPcbPlotParams, including not saved parameters in brd file.
void SetIncludeGerberNetlistInfo(bool aUse)
bool GetPlotValue() const
void SetPlotInvisibleText(bool aFlag)
void SetCreateGerberJobFile(bool aCreate)
bool GetIncludeGerberNetlistInfo() const
void SetNegative(bool aFlag)
void SetPlotMode(OUTLINE_MODE aPlotMode)
void SetUseAuxOrigin(bool aAux)
void SetTextMode(PLOT_TEXT_MODE aVal)
bool GetUseGerberProtelExtensions() const
void SetSvgPrecision(unsigned aPrecision)
bool GetPlotFrameRef() const
void SetFormat(PLOT_FORMAT aFormat)
bool GetPlotViaOnMaskLayer() const
bool GetDisableGerberMacros() const
void SetFineScaleAdjustY(double aVal)
OUTLINE_MODE GetPlotMode() const
void SetWidthAdjust(int aVal)
Base plotter engine class.
Definition: plotter.h:110
virtual bool EndPlot()=0
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
Definition: project.cpp:305
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the end of the list, for objects that support report ordering.
Definition: reporter.h:99
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aValue in internal units into a united string.
virtual long long int GetValue()
Return the current value in Internal Units.
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void SetFileName(const wxString &aReportFileName)
Handle actions specific to filling copper zones.
bool EnsureFileDirectoryExists(wxFileName *aTargetFullFileName, const wxString &aBaseFilename, REPORTER *aReporter)
Make aTargetFullFileName absolute and create the path of this file if it doesn't yet exist.
Definition: common.cpp:295
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:57
const wxString ExpandEnvVarSubstitutions(const wxString &aString, PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition: common.cpp:267
wxString GetDefaultPlotExtension(PLOT_FORMAT aFormat)
Returns the default plot extension for a format.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:280
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:320
This file is part of the common library.
#define DLG_WINDOW_NAME
static bool setDouble(double *aResult, double aValue, double aMin, double aMax)
static bool setInt(int *aResult, int aValue, int aMin, int aMax)
#define _(s)
Classes used to generate a Gerber job file in JSON.
const std::string GerberJobFileExtension
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:825
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ F_CrtYd
Definition: layer_ids.h:117
@ F_Fab
Definition: layer_ids.h:120
@ B_CrtYd
Definition: layer_ids.h:116
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
This file contains miscellaneous commonly used macros and functions.
wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Returns the string from aValue according to aUnits (inch, mm ...) for display.
Definition: eda_units.cpp:229
wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currentl...
Definition: ui_common.cpp:70
@ SKETCH
Definition: outline_mode.h:26
@ FILLED
Definition: outline_mode.h:27
const wxString GetGerberProtelExtension(int aLayer)
Definition: pcbplot.cpp:42
void BuildPlotFileName(wxFileName *aFilename, const wxString &aOutputDir, const wxString &aSuffix, const wxString &aExtension)
Complete a plot filename.
Definition: pcbplot.cpp:361
void PlotInteractiveLayer(BOARD *aBoard, PLOTTER *aPlotter)
Plot interactive items (hypertext links, properties, etc.).
PLOTTER * StartPlotBoard(BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aLayer, const wxString &aFullFileName, const wxString &aSheetName, const wxString &aSheetPath)
Open a new plotfile using the options (and especially the format) specified in the options and prepar...
void PlotBoardLayers(BOARD *aBoard, PLOTTER *aPlotter, const LSEQ &aLayerSequence, const PCB_PLOT_PARAMS &aPlotOptions)
Plot a sequence of board layer IDs.
#define PLOT_MIN_SCALE
Definition: pcbplot.h:50
#define PLOT_MAX_SCALE
Definition: pcbplot.h:51
see class PGM_BASE
DRILL_MARKS
Plots and prints can show holes in pads and vias 3 options are available:
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:70
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_EXCLUSION
@ RPT_SEVERITY_INFO
@ RPT_SEVERITY_ACTION
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:74
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
constexpr double IUTomm(int iu) const
Definition: base_units.h:87
const double IU_PER_MM
Definition: base_units.h:77
const double IU_PER_MILS
Definition: base_units.h:78
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85
Definition of file extensions used in Kicad.