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-2023 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>
47#include <tool/tool_manager.h>
49#include <tools/drc_tool.h>
50#include <math/util.h> // for KiROUND
51#include <macros.h>
52
53#include <wx/dirdlg.h>
54
55
58
59
63class PCB_LAYER_ID_CLIENT_DATA : public wxClientData
64{
65public:
68
69 void SetData( PCB_LAYER_ID aId ) { m_id = aId; }
70
71 PCB_LAYER_ID GetData() const { return m_id; }
72
73private:
75};
76
77
79 DIALOG_PLOT_BASE( aParent ),
80 m_parent( aParent ),
81 m_defaultPenSize( aParent, m_hpglPenLabel, m_hpglPenCtrl, m_hpglPenUnits ),
82 m_trackWidthCorrection( aParent, m_widthAdjustLabel, m_widthAdjustCtrl, m_widthAdjustUnits )
83{
84 BOARD* board = m_parent->GetBoard();
85
86 SetName( DLG_WINDOW_NAME );
87 m_plotOpts = aParent->GetPlotSettings();
89
90 m_messagesPanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
91
92 int order = 0;
93 LSET plotOnAllLayersSelection = m_plotOpts.GetPlotOnAllLayersSelection();
94 wxArrayInt plotAllLayersOrder;
95 wxArrayString plotAllLayersChoicesStrings;
96 std::vector<PCB_LAYER_ID> layersIdChoiceList;
97 int textWidth = 0;
98
99 for( LSEQ seq = board->GetEnabledLayers().UIOrder(); seq; ++seq )
100 {
101 PCB_LAYER_ID id = *seq;
102 wxString layerName = board->GetLayerName( id );
103
104 // wxCOL_WIDTH_AUTOSIZE doesn't work on all platforms, so we calculate width here
105 textWidth = std::max( textWidth, KIUI::GetTextSize( layerName, m_layerCheckListBox ).x );
106
107 plotAllLayersChoicesStrings.Add( layerName );
108 layersIdChoiceList.push_back( id );
109
110 size_t size = plotOnAllLayersSelection.size();
111
112 if( ( static_cast<size_t>( id ) <= size ) && plotOnAllLayersSelection.test( id ) )
113 plotAllLayersOrder.push_back( order );
114 else
115 plotAllLayersOrder.push_back( ~order );
116
117 order += 1;
118 }
119
120 int checkColSize = 22;
121 int layerColSize = textWidth + 15;
122
123#ifdef __WXMAC__
124 // TODO: something in wxWidgets 3.1.x pads checkbox columns with extra space. (It used to
125 // also be that the width of the column would get set too wide (to 30), but that's patched in
126 // our local wxWidgets fork.)
127 checkColSize += 30;
128#endif
129
130 m_layerCheckListBox->SetMinClientSize( wxSize( checkColSize + layerColSize,
131 m_layerCheckListBox->GetMinClientSize().y ) );
132
133 wxStaticBox* allLayersLabel = new wxStaticBox( this, wxID_ANY, _( "Plot on All Layers" ) );
134 wxStaticBoxSizer* sbSizer = new wxStaticBoxSizer( allLayersLabel, wxVERTICAL );
135
136 m_plotAllLayersList = new wxRearrangeList( sbSizer->GetStaticBox(), wxID_ANY,
137 wxDefaultPosition, wxDefaultSize,
138 plotAllLayersOrder, plotAllLayersChoicesStrings, 0 );
139
140 m_plotAllLayersList->SetMinClientSize( wxSize( checkColSize + layerColSize,
141 m_plotAllLayersList->GetMinClientSize().y ) );
142
143 // Attach the LAYER_ID to each item in m_plotAllLayersList
144 // plotAllLayersChoicesStrings and layersIdChoiceList are in the same order,
145 // but m_plotAllLayersList has these strings in a different order
146 for( size_t idx = 0; idx < layersIdChoiceList.size(); idx++ )
147 {
148 wxString& txt = plotAllLayersChoicesStrings[idx];
149 int list_idx = m_plotAllLayersList->FindString( txt, true );
150
151 PCB_LAYER_ID layer_id = layersIdChoiceList[idx];
152 m_plotAllLayersList->SetClientObject( list_idx, new PCB_LAYER_ID_CLIENT_DATA( layer_id ) );
153 }
154
155 sbSizer->Add( m_plotAllLayersList, 1, wxALL | wxEXPAND, 5 );
156
157 wxBoxSizer* bButtonSizer;
158 bButtonSizer = new wxBoxSizer( wxHORIZONTAL );
159
160 m_bpMoveUp = new wxBitmapButton( sbSizer->GetStaticBox(), wxID_ANY, wxNullBitmap,
161 wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW | 0 );
162 m_bpMoveUp->SetToolTip( _( "Move current selection up" ) );
163 m_bpMoveUp->SetBitmap( KiBitmap( BITMAPS::small_up ) );
164
165 bButtonSizer->Add( m_bpMoveUp, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
166
167 m_bpMoveDown = new wxBitmapButton( sbSizer->GetStaticBox(), wxID_ANY, wxNullBitmap,
168 wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW | 0 );
169 m_bpMoveDown->SetToolTip( _( "Move current selection down" ) );
171
172 bButtonSizer->Add( m_bpMoveDown, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
173
174 sbSizer->Add( bButtonSizer, 0, wxALL | wxEXPAND, 5 );
175 bmiddleSizer->Insert( 1, sbSizer, 1, wxALL | wxEXPAND, 3 );
176
177 init_Dialog();
178
179 SetupStandardButtons( { { wxID_OK, _( "Plot" ) },
180 { wxID_APPLY, _( "Generate Drill Files..." ) },
181 { wxID_CANCEL, _( "Close" ) } } );
182
183 GetSizer()->Fit( this );
184 GetSizer()->SetSizeHints( this );
185
186 m_bpMoveUp->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveUp, this );
187 m_bpMoveDown->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveDown, this );
188}
189
190
192{
193 m_bpMoveDown->Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveDown, this );
194 m_bpMoveUp->Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveUp, this );
195}
196
197
199{
200 BOARD* board = m_parent->GetBoard();
201 wxFileName fileName;
202
203 auto cfg = m_parent->GetPcbNewSettings();
204
205 m_XScaleAdjust = cfg->m_Plot.fine_scale_x;
206 m_YScaleAdjust = cfg->m_Plot.fine_scale_y;
207
208 m_zoneFillCheck->SetValue( cfg->m_Plot.check_zones_before_plotting );
209
211
212 // m_PSWidthAdjust is stored in mm in user config
213 m_PSWidthAdjust = KiROUND( cfg->m_Plot.ps_fine_width_adjust * pcbIUScale.IU_PER_MM );
214
215 // The reasonable width correction value must be in a range of
216 // [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils.
219
220 switch( m_plotOpts.GetFormat() )
221 {
222 default:
223 case PLOT_FORMAT::GERBER: m_plotFormatOpt->SetSelection( 0 ); break;
224 case PLOT_FORMAT::POST: m_plotFormatOpt->SetSelection( 1 ); break;
225 case PLOT_FORMAT::SVG: m_plotFormatOpt->SetSelection( 2 ); break;
226 case PLOT_FORMAT::DXF: m_plotFormatOpt->SetSelection( 3 ); break;
227 case PLOT_FORMAT::HPGL: m_plotFormatOpt->SetSelection( 4 ); break;
228 case PLOT_FORMAT::PDF: m_plotFormatOpt->SetSelection( 5 ); break;
229 }
230
231 // Set units and value for HPGL pen size (this param is in mils).
233
234 // Test for a reasonable scale value. Set to 1 if problem
237 {
239 }
240
243 m_XScaleAdjust ) );
244
247 m_YScaleAdjust ) );
248
249 // Test for a reasonable PS width correction value. Set to 0 if problem.
250 if( m_PSWidthAdjust < m_widthAdjustMinValue || m_PSWidthAdjust > m_widthAdjustMaxValue )
251 m_PSWidthAdjust = 0.;
252
254
257
258 // Could devote a PlotOrder() function in place of UIOrder().
260
261 // Populate the check list box by all enabled layers names.
262 for( LSEQ seq = m_layerList; seq; ++seq )
263 {
264 PCB_LAYER_ID layer = *seq;
265
266 int checkIndex = m_layerCheckListBox->Append( board->GetLayerName( layer ) );
267
268 if( m_plotOpts.GetLayerSelection()[layer] )
269 m_layerCheckListBox->Check( checkIndex );
270 }
271
272 // Option for disabling Gerber Aperture Macro (for broken Gerber readers)
274
275 // Option for using proper Gerber extensions. Note also Protel extensions are
276 // a broken feature. However, for now, we need to handle it.
278
279 // Option for including Gerber attributes, from Gerber X2 format, in the output
280 // In X1 format, they will be added as comments
282
283 // Option for including Gerber netlist info (from Gerber X2 format) in the output
285
286 // Option to generate a Gerber job file
288
289 // Gerber precision for coordinates
290 m_coordFormatCtrl->SetSelection( m_plotOpts.GetGerberPrecision() == 5 ? 0 : 1 );
291
292 // SVG precision and units for coordinates
294
295 // Option to exclude pads from silkscreen layers
297
298 // Option to tent vias
300
301 // Option to use aux origin
303
304 // Option to plot page references:
306
307 // Options to plot texts on footprints
311
312 // Options to plot pads and vias holes
313 m_drillShapeOpt->SetSelection( (int)m_plotOpts.GetDrillMarksType() );
314
315 // Scale option
316 m_scaleOpt->SetSelection( m_plotOpts.GetScaleSelection() );
317
318 // Plot mode
320
321 // DXF outline mode
323
324 // DXF text mode
326
327 // DXF units selection
328 m_DXF_plotUnits->SetSelection( m_plotOpts.GetDXFPlotUnits() == DXF_UNITS::INCHES ? 0 : 1);
329
330 // Plot mirror option
331 m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() );
332
333 // Put vias on mask layer
335
336 // Black and white plotting
337 m_SVGColorChoice->SetSelection( m_plotOpts.GetBlackAndWhite() ? 1 : 0 );
338 m_PDFColorChoice->SetSelection( m_plotOpts.GetBlackAndWhite() ? 1 : 0 );
339
340 // Initialize a few other parameters, which can also be modified
341 // from the drill dialog
342 reInitDialog();
343
344 // Update options values:
345 wxCommandEvent cmd_event;
346 SetPlotFormat( cmd_event );
347 OnSetScaleOpt( cmd_event );
348}
349
350
352{
353 // after calling the Drill or DRC dialogs some parameters can be modified....
354
355 // Output directory
357
358 // Origin of coordinates:
360
361 int knownViolations = 0;
362 int exclusions = 0;
363
364 for( PCB_MARKER* marker : m_parent->GetBoard()->Markers() )
365 {
366 if( marker->GetSeverity() == RPT_SEVERITY_EXCLUSION )
367 exclusions++;
368 else
369 knownViolations++;
370 }
371
372 if( knownViolations || exclusions )
373 {
375 exclusions ) );
377 }
378 else
379 {
381 }
382
383 BOARD* board = m_parent->GetBoard();
384 const BOARD_DESIGN_SETTINGS& brd_settings = board->GetDesignSettings();
385
387 ( brd_settings.m_SolderMaskExpansion || brd_settings.m_SolderMaskMinWidth ) )
388 {
390 }
391 else
392 {
394 }
395}
396
397
398// A helper function to show a popup menu, when the dialog is right clicked.
399void DIALOG_PLOT::OnRightClick( wxMouseEvent& event )
400{
401 PopupMenu( m_popMenu );
402}
403
404
405// Select or deselect groups of layers in the layers list:
406void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
407{
408 // Build a list of layers for usual fabrication: copper layers + tech layers without courtyard
409 LSET fab_layer_set = ( LSET::AllCuMask() | LSET::AllTechMask() ) & ~LSET( 2, B_CrtYd, F_CrtYd );
410
411 switch( event.GetId() )
412 {
413 case ID_LAYER_FAB: // Select layers usually needed to build a board
414 for( unsigned i = 0; i < m_layerList.size(); i++ )
415 {
416 LSET layermask( m_layerList[ i ] );
417
418 if( ( layermask & fab_layer_set ).any() )
419 m_layerCheckListBox->Check( i, true );
420 else
421 m_layerCheckListBox->Check( i, false );
422 }
423
424 break;
425
427 for( unsigned i = 0; i < m_layerList.size(); i++ )
428 {
429 if( IsCopperLayer( m_layerList[i] ) )
430 m_layerCheckListBox->Check( i, true );
431 }
432
433 break;
434
436 for( unsigned i = 0; i < m_layerList.size(); i++ )
437 {
438 if( IsCopperLayer( m_layerList[i] ) )
439 m_layerCheckListBox->Check( i, false );
440 }
441
442 break;
443
445 for( unsigned i = 0; i < m_layerList.size(); i++ )
446 m_layerCheckListBox->Check( i, true );
447
448 break;
449
451 for( unsigned i = 0; i < m_layerList.size(); i++ )
452 m_layerCheckListBox->Check( i, false );
453
454 break;
455
456 default:
457 break;
458 }
459}
460
461
462void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
463{
464 // Be sure drill file use the same settings (axis option, plot directory) as plot files:
466
467 DIALOG_GENDRILL dlg( m_parent, this );
468 dlg.ShowModal();
469
470 // a few plot settings can be modified: take them in account
472 reInitDialog();
473}
474
475
476void DIALOG_PLOT::OnChangeDXFPlotMode( wxCommandEvent& event )
477{
478 // m_DXF_plotTextStrokeFontOpt is disabled if m_DXF_plotModeOpt is checked (plot in DXF
479 // polygon mode)
480 m_DXF_plotTextStrokeFontOpt->Enable( !m_DXF_plotModeOpt->GetValue() );
481
482 // if m_DXF_plotTextStrokeFontOpt option is disabled (plot DXF in polygon mode), force
483 // m_DXF_plotTextStrokeFontOpt to true to use Pcbnew stroke font
484 if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() )
485 m_DXF_plotTextStrokeFontOpt->SetValue( true );
486}
487
488
489void DIALOG_PLOT::OnSetScaleOpt( wxCommandEvent& event )
490{
491 /* Disable sheet reference for scale != 1:1 */
492 bool scale1 = ( m_scaleOpt->GetSelection() == 1 );
493
494 m_plotSheetRef->Enable( scale1 );
495
496 if( !scale1 )
497 m_plotSheetRef->SetValue( false );
498}
499
500
502{
503 // Build the absolute path of current output directory to preselect it in the file browser.
504 std::function<bool( wxString* )> textResolver =
505 [&]( wxString* token ) -> bool
506 {
507 return m_parent->GetBoard()->ResolveTextVar( token, 0 );
508 };
509
510 wxString path = m_outputDirectoryName->GetValue();
511 path = ExpandTextVars( path, &textResolver );
513 path = Prj().AbsolutePath( path );
514
515 wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
516
517 if( dirDialog.ShowModal() == wxID_CANCEL )
518 return;
519
520 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
521
522 wxFileName fn( Prj().AbsolutePath( m_parent->GetBoard()->GetFileName() ) );
523 wxString defaultPath = fn.GetPathWithSep();
524 wxString msg;
525 wxFileName relPathTest; // Used to test if we can make the path relative
526
527 relPathTest.Assign( dirDialog.GetPath() );
528
529 // Test if making the path relative is possible before asking the user if they want to do it
530 if( relPathTest.MakeRelativeTo( defaultPath ) )
531 {
532 msg.Printf( _( "Do you want to use a path relative to\n'%s'?" ), defaultPath );
533
534 wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
535 wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
536
537 if( dialog.ShowModal() == wxID_YES )
538 dirName.MakeRelativeTo( defaultPath );
539 }
540
541 m_outputDirectoryName->SetValue( dirName.GetFullPath() );
542}
543
544
546{
547 // plot format id's are ordered like displayed in m_plotFormatOpt
548 static const PLOT_FORMAT plotFmt[] = {
555
556 return plotFmt[m_plotFormatOpt->GetSelection()];
557}
558
559
560void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
561{
562 // this option exist only in DXF format:
564
565 // The alert message about non 0 solder mask min width and margin is shown
566 // only in gerber format and if min mask width or mask margin is not 0
567 BOARD* board = m_parent->GetBoard();
568 const BOARD_DESIGN_SETTINGS& brd_settings = board->GetDesignSettings();
569
571 && ( brd_settings.m_SolderMaskExpansion || brd_settings.m_SolderMaskMinWidth ) )
572 {
574 }
575 else
576 {
578 }
579
580 switch( getPlotFormat() )
581 {
582 case PLOT_FORMAT::SVG:
583 case PLOT_FORMAT::PDF:
584 m_drillShapeOpt->Enable( true );
585 m_plotModeOpt->Enable( false );
587 m_plotMirrorOpt->Enable( true );
588 m_useAuxOriginCheckBox->Enable( false );
589 m_useAuxOriginCheckBox->SetValue( false );
590 m_defaultPenSize.Enable( false );
591 m_scaleOpt->Enable( false );
592 m_scaleOpt->SetSelection( 1 );
593 m_fineAdjustXCtrl->Enable( false );
594 m_fineAdjustYCtrl->Enable( false );
596 m_plotPSNegativeOpt->Enable( true );
597 m_forcePSA4OutputOpt->Enable( false );
598 m_forcePSA4OutputOpt->SetValue( false );
599
601 {
604 }
605 else
606 {
609 }
610
615 break;
616
618 m_drillShapeOpt->Enable( true );
619 m_plotModeOpt->Enable( true );
620 m_plotMirrorOpt->Enable( true );
621 m_useAuxOriginCheckBox->Enable( false );
622 m_useAuxOriginCheckBox->SetValue( false );
623 m_defaultPenSize.Enable( false );
624 m_scaleOpt->Enable( true );
625 m_fineAdjustXCtrl->Enable( true );
626 m_fineAdjustYCtrl->Enable( true );
628 m_plotPSNegativeOpt->Enable( true );
629 m_forcePSA4OutputOpt->Enable( true );
630
637 break;
638
640 m_drillShapeOpt->Enable( false );
641 m_drillShapeOpt->SetSelection( 0 );
642 m_plotModeOpt->Enable( false );
644 m_plotMirrorOpt->Enable( false );
645 m_plotMirrorOpt->SetValue( false );
646 m_useAuxOriginCheckBox->Enable( true );
647 m_defaultPenSize.Enable( false );
648 m_scaleOpt->Enable( false );
649 m_scaleOpt->SetSelection( 1 );
650 m_fineAdjustXCtrl->Enable( false );
651 m_fineAdjustYCtrl->Enable( false );
653 m_plotPSNegativeOpt->Enable( false );
654 m_plotPSNegativeOpt->SetValue( false );
655 m_forcePSA4OutputOpt->Enable( false );
656 m_forcePSA4OutputOpt->SetValue( false );
657
664 break;
665
667 m_drillShapeOpt->Enable( true );
668 m_plotModeOpt->Enable( true );
669 m_plotMirrorOpt->Enable( true );
670 m_useAuxOriginCheckBox->Enable( false );
671 m_useAuxOriginCheckBox->SetValue( false );
672 m_defaultPenSize.Enable( true );
673 m_scaleOpt->Enable( true );
674 m_fineAdjustXCtrl->Enable( false );
675 m_fineAdjustYCtrl->Enable( false );
677 m_plotPSNegativeOpt->SetValue( false );
678 m_plotPSNegativeOpt->Enable( false );
679 m_forcePSA4OutputOpt->Enable( true );
680
687 break;
688
689 case PLOT_FORMAT::DXF:
690 m_drillShapeOpt->Enable( true );
691 m_plotModeOpt->Enable( false );
693 m_plotMirrorOpt->Enable( false );
694 m_plotMirrorOpt->SetValue( false );
695 m_useAuxOriginCheckBox->Enable( true );
696 m_defaultPenSize.Enable( false );
697 m_scaleOpt->Enable( false );
698 m_scaleOpt->SetSelection( 1 );
699 m_fineAdjustXCtrl->Enable( false );
700 m_fineAdjustYCtrl->Enable( false );
702 m_plotPSNegativeOpt->Enable( false );
703 m_plotPSNegativeOpt->SetValue( false );
704 m_forcePSA4OutputOpt->Enable( false );
705 m_forcePSA4OutputOpt->SetValue( false );
706
713
714 OnChangeDXFPlotMode( event );
715 break;
716
718 break;
719 }
720
721 /* Update the interlock between scale and frame reference
722 * (scaling would mess up the frame border...) */
723 OnSetScaleOpt( event );
724
725 Layout();
726 m_MainSizer->SetSizeHints( this );
727}
728
729
730// A helper function to "clip" aValue between aMin and aMax and write result in * aResult
731// return false if clipped, true if aValue is just copied into * aResult
732static bool setDouble( double* aResult, double aValue, double aMin, double aMax )
733{
734 if( aValue < aMin )
735 {
736 *aResult = aMin;
737 return false;
738 }
739 else if( aValue > aMax )
740 {
741 *aResult = aMax;
742 return false;
743 }
744
745 *aResult = aValue;
746 return true;
747}
748
749
750static bool setInt( int* aResult, int aValue, int aMin, int aMax )
751{
752 if( aValue < aMin )
753 {
754 *aResult = aMin;
755 return false;
756 }
757 else if( aValue > aMax )
758 {
759 *aResult = aMax;
760 return false;
761 }
762
763 *aResult = aValue;
764 return true;
765}
766
767
769{
770 REPORTER& reporter = m_messagesPanel->Reporter();
771 PCB_PLOT_PARAMS tempOptions;
772
773 tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
774 tempOptions.SetPlotFrameRef( m_plotSheetRef->GetValue() );
775 tempOptions.SetSketchPadsOnFabLayers( m_sketchPadsOnFabLayers->GetValue() );
776 tempOptions.SetUseAuxOrigin( m_useAuxOriginCheckBox->GetValue() );
777 tempOptions.SetPlotValue( m_plotModuleValueOpt->GetValue() );
778 tempOptions.SetPlotReference( m_plotModuleRefOpt->GetValue() );
779 tempOptions.SetPlotInvisibleText( m_plotInvisibleText->GetValue() );
780 tempOptions.SetScaleSelection( m_scaleOpt->GetSelection() );
781
782 int sel = m_drillShapeOpt->GetSelection();
783 tempOptions.SetDrillMarksType( static_cast<DRILL_MARKS>( sel ) );
784
785 tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
786 tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED );
787 tempOptions.SetDXFPlotPolygonMode( m_DXF_plotModeOpt->GetValue() );
788
789 sel = m_DXF_plotUnits->GetSelection();
790 tempOptions.SetDXFPlotUnits( sel == 0 ? DXF_UNITS::INCHES : DXF_UNITS::MILLIMETERS );
791
792 tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() );
793
794 if( !m_DXF_plotTextStrokeFontOpt->IsEnabled() ) // Currently, only DXF supports this option
796 else
799
801 tempOptions.SetBlackAndWhite( !!m_SVGColorChoice->GetSelection() );
802 else if( getPlotFormat() == PLOT_FORMAT::PDF )
803 tempOptions.SetBlackAndWhite( !!m_PDFColorChoice->GetSelection() );
804 else
805 tempOptions.SetBlackAndWhite( true );
806
807 // Update settings from text fields. Rewrite values back to the fields,
808 // since the values may have been constrained by the setters.
809 wxString msg;
810
811 // read HPLG pen size (this param is stored in mils)
812 // However, due to issues when converting this value from or to mm
813 // that can slightly change the value, update this param only if it
814 // is in use
816 {
818 {
820 msg.Printf( _( "HPGL pen size constrained." ) );
821 reporter.Report( msg, RPT_SEVERITY_INFO );
822 }
823 }
824 else // keep the last value (initial value if no HPGL plot made)
825 {
827 }
828
829 // X scale
830 double tmpDouble;
831 msg = m_fineAdjustXCtrl->GetValue();
832 msg.ToDouble( &tmpDouble );
833
835 {
836 msg.Printf( wxT( "%f" ), m_XScaleAdjust );
837 m_fineAdjustXCtrl->SetValue( msg );
838 msg.Printf( _( "X scale constrained." ) );
839 reporter.Report( msg, RPT_SEVERITY_INFO );
840 }
841
842 // Y scale
843 msg = m_fineAdjustYCtrl->GetValue();
844 msg.ToDouble( &tmpDouble );
845
847 {
848 msg.Printf( wxT( "%f" ), m_YScaleAdjust );
849 m_fineAdjustYCtrl->SetValue( msg );
850 msg.Printf( _( "Y scale constrained." ) );
851 reporter.Report( msg, RPT_SEVERITY_INFO );
852 }
853
854 auto cfg = m_parent->GetPcbNewSettings();
855
857 cfg->m_Plot.fine_scale_y = m_YScaleAdjust;
858
859 cfg->m_Plot.check_zones_before_plotting = m_zoneFillCheck->GetValue();
860
861 // PS Width correction
864 {
866 msg.Printf( _( "Width correction constrained. The width correction value must be in the"
867 " range of [%s; %s] for the current design rules." ),
870 reporter.Report( msg, RPT_SEVERITY_WARNING );
871 }
872
873 // Store m_PSWidthAdjust in mm in user config
874 cfg->m_Plot.ps_fine_width_adjust = pcbIUScale.IUTomm( m_PSWidthAdjust );
875
876 tempOptions.SetFormat( getPlotFormat() );
877
878 tempOptions.SetDisableGerberMacros( m_disableApertMacros->GetValue() );
879 tempOptions.SetUseGerberProtelExtensions( m_useGerberExtensions->GetValue() );
880 tempOptions.SetUseGerberX2format( m_useGerberX2Format->GetValue() );
881 tempOptions.SetIncludeGerberNetlistInfo( m_useGerberNetAttributes->GetValue() );
882 tempOptions.SetCreateGerberJobFile( m_generateGerberJobFile->GetValue() );
883
884 tempOptions.SetGerberPrecision( m_coordFormatCtrl->GetSelection() == 0 ? 5 : 6 );
885 tempOptions.SetSvgPrecision( m_svgPrecsision->GetValue() );
886
887 LSET selectedLayers;
888
889 for( unsigned i = 0; i < m_layerList.size(); i++ )
890 {
891 if( m_layerCheckListBox->IsChecked( i ) )
892 selectedLayers.set( m_layerList[i] );
893 }
894
895 // Get a list of copper layers that aren't being used by inverting enabled layers.
896 LSET disabledCopperLayers = LSET::AllCuMask() & ~m_parent->GetBoard()->GetEnabledLayers();
897
898 LSET plotOnAllLayers;
899
900 // Add selected layers from plot on all layers list in order set by user.
901 wxArrayInt plotOnAllLayersSelections;
902
903 m_plotAllLayersList->GetCheckedItems( plotOnAllLayersSelections );
904
905 size_t count = plotOnAllLayersSelections.GetCount();
906
907 for( size_t i = 0; i < count; i++ )
908 {
909 int index = plotOnAllLayersSelections.Item( i );
910 wxClientData* tmp = m_plotAllLayersList->GetClientObject( index );
911 PCB_LAYER_ID_CLIENT_DATA* layerId = dynamic_cast<PCB_LAYER_ID_CLIENT_DATA*>( tmp );
912
913 wxCHECK2( layerId, continue );
914
915 plotOnAllLayers.set( layerId->GetData() );
916 }
917
918 tempOptions.SetPlotOnAllLayersSelection( plotOnAllLayers );
919
920 // Enable all of the disabled copper layers.
921 // If someone enables more copper layers they will be selected by default.
922 selectedLayers = selectedLayers | disabledCopperLayers;
923 tempOptions.SetLayerSelection( selectedLayers );
924
925 tempOptions.SetNegative( m_plotPSNegativeOpt->GetValue() );
926 tempOptions.SetA4Output( m_forcePSA4OutputOpt->GetValue() );
927
928 // Set output directory and replace backslashes with forward ones
929 wxString dirStr;
930 dirStr = m_outputDirectoryName->GetValue();
931 dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
932 tempOptions.SetOutputDirectory( dirStr );
933
934 if( !m_plotOpts.IsSameAs( tempOptions ) )
935 {
936 m_parent->SetPlotSettings( tempOptions );
938 m_plotOpts = tempOptions;
939 }
940}
941
942
943void DIALOG_PLOT::OnGerberX2Checked( wxCommandEvent& event )
944{
945 // Currently: do nothing
946}
947
948
949void DIALOG_PLOT::Plot( wxCommandEvent& event )
950{
951 BOARD* board = m_parent->GetBoard();
952
954
955 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
957
959
961
962 // If no layer selected, we have nothing plotted.
963 // Prompt user if it happens because he could think there is a bug in Pcbnew.
964 if( !m_plotOpts.GetLayerSelection().any() )
965 {
966 DisplayError( this, _( "No layer selected, Nothing to plot" ) );
967 return;
968 }
969
970 // Create output directory if it does not exist (also transform it in absolute form).
971 // Bail if it fails.
972
973 std::function<bool( wxString* )> textResolver =
974 [&]( wxString* token ) -> bool
975 {
976 // Handles board->GetTitleBlock() *and* board->GetProject()
977 return m_parent->GetBoard()->ResolveTextVar( token, 0 );
978 };
979
981 path = ExpandTextVars( path, &textResolver );
983
984 wxFileName outputDir = wxFileName::DirName( path );
985 wxString boardFilename = m_parent->GetBoard()->GetFileName();
986 REPORTER& reporter = m_messagesPanel->Reporter();
987
988 if( !EnsureFileDirectoryExists( &outputDir, boardFilename, &reporter ) )
989 {
990 wxString msg;
991 msg.Printf( _( "Could not write plot files to folder '%s'." ), outputDir.GetPath() );
992 DisplayError( this, msg );
993 return;
994 }
995
996 if( m_zoneFillCheck->GetValue() )
997 m_parent->GetToolManager()->GetTool<ZONE_FILLER_TOOL>()->CheckAllZones( this );
998
999 m_plotOpts.SetAutoScale( false );
1000
1001 switch( m_plotOpts.GetScaleSelection() )
1002 {
1003 default: m_plotOpts.SetScale( 1 ); break;
1004 case 0: m_plotOpts.SetAutoScale( true ); break;
1005 case 2: m_plotOpts.SetScale( 1.5 ); break;
1006 case 3: m_plotOpts.SetScale( 2 ); break;
1007 case 4: m_plotOpts.SetScale( 3 ); break;
1008 }
1009
1010 /* If the scale factor edit controls are disabled or the scale value
1011 * is 0, don't adjust the base scale factor. This fixes a bug when
1012 * the default scale adjust is initialized to 0 and saved in program
1013 * settings resulting in a divide by zero fault.
1014 */
1016 {
1017 if( m_XScaleAdjust != 0.0 )
1019
1020 if( m_YScaleAdjust != 0.0 )
1022
1024 }
1025
1026 wxString file_ext( GetDefaultPlotExtension( m_plotOpts.GetFormat() ) );
1027
1028 // Test for a reasonable scale value
1029 // XXX could this actually happen? isn't it constrained in the apply function?
1031 DisplayInfoMessage( this, _( "Warning: Scale option set to a very small value" ) );
1032
1034 DisplayInfoMessage( this, _( "Warning: Scale option set to a very large value" ) );
1035
1036 GERBER_JOBFILE_WRITER jobfile_writer( board, &reporter );
1037
1038 // Save the current plot options in the board
1040
1041 wxBusyCursor dummy;
1042
1043 for( LSEQ seq = m_plotOpts.GetLayerSelection().UIOrder(); seq; ++seq )
1044 {
1045 LSEQ plotSequence;
1046
1047 // Base layer always gets plotted first.
1048 plotSequence.push_back( *seq );
1049
1050 // Add selected layers from plot on all layers list in order set by user.
1051 wxArrayInt plotOnAllLayers;
1052
1053 if( m_plotAllLayersList->GetCheckedItems( plotOnAllLayers ) )
1054 {
1055 size_t count = plotOnAllLayers.GetCount();
1056
1057 for( size_t i = 0; i < count; i++ )
1058 {
1059 int index = plotOnAllLayers.Item( i );
1060 wxClientData* tmp = m_plotAllLayersList->GetClientObject( index );
1061 PCB_LAYER_ID_CLIENT_DATA* layerId = dynamic_cast<PCB_LAYER_ID_CLIENT_DATA*>( tmp );
1062
1063 wxCHECK2( layerId, continue );
1064
1065 // Don't plot the same layer more than once;
1066 if( find( plotSequence.begin(), plotSequence.end(), layerId->GetData() ) !=
1067 plotSequence.end() )
1068 continue;
1069
1070 plotSequence.push_back( layerId->GetData() );
1071 }
1072 }
1073
1074 PCB_LAYER_ID layer = *seq;
1075
1076 // All copper layers that are disabled are actually selected
1077 // This is due to wonkyness in automatically selecting copper layers
1078 // for plotting when adding more than two layers to a board.
1079 // If plot options become accessible to the layers setup dialog
1080 // please move this functionality there!
1081 // This skips a copper layer if it is actually disabled on the board.
1082 if( ( LSET::AllCuMask() & ~board->GetEnabledLayers() )[layer] )
1083 continue;
1084
1085 // Pick the basename from the board file
1086 wxFileName fn( boardFilename );
1087
1088 // Use Gerber Extensions based on layer number
1089 // (See http://en.wikipedia.org/wiki/Gerber_File)
1091 file_ext = GetGerberProtelExtension( layer );
1092
1093 BuildPlotFileName( &fn, outputDir.GetPath(), board->GetLayerName( layer ), file_ext );
1094 wxString fullname = fn.GetFullName();
1095 jobfile_writer.AddGbrFile( layer, fullname );
1096
1097 LOCALE_IO toggle;
1098
1099 //@todo allow controlling the sheet name and path that will be displayed in the title block
1100 // Leave blank for now
1101 PLOTTER* plotter = StartPlotBoard( board, &m_plotOpts, layer, fn.GetFullPath(),
1102 wxEmptyString, wxEmptyString );
1103
1104 // Print diags in messages box:
1105 wxString msg;
1106
1107 if( plotter )
1108 {
1109 PlotBoardLayers( board, plotter, plotSequence, m_plotOpts );
1110 PlotInteractiveLayer( board, plotter );
1111 plotter->EndPlot();
1112 delete plotter->RenderSettings();
1113 delete plotter;
1114
1115 msg.Printf( _( "Plotted to '%s'." ), fn.GetFullPath() );
1116 reporter.Report( msg, RPT_SEVERITY_ACTION );
1117 }
1118 else
1119 {
1120 msg.Printf( _( "Failed to create file '%s'." ), fn.GetFullPath() );
1121 reporter.Report( msg, RPT_SEVERITY_ERROR );
1122 }
1123
1124 wxSafeYield(); // displays report message.
1125 }
1126
1128 {
1129 // Pick the basename from the board file
1130 wxFileName fn( boardFilename );
1131
1132 // Build gerber job file from basename
1133 BuildPlotFileName( &fn, outputDir.GetPath(), wxT( "job" ), GerberJobFileExtension );
1134 jobfile_writer.CreateJobFile( fn.GetFullPath() );
1135 }
1136
1137 reporter.ReportTail( _( "Done." ), RPT_SEVERITY_INFO );
1138}
1139
1140
1141void DIALOG_PLOT::onRunDRC( wxCommandEvent& event )
1142{
1143 PCB_EDIT_FRAME* parent = dynamic_cast<PCB_EDIT_FRAME*>( GetParent() );
1144
1145 if( parent )
1146 {
1147 DRC_TOOL* drcTool = parent->GetToolManager()->GetTool<DRC_TOOL>();
1148
1149 // First close an existing dialog if open
1150 // (low probability, but can happen)
1151 drcTool->DestroyDRCDialog();
1152
1153 // Open a new drc dialog, with the right parent frame, and in Modal Mode
1154 drcTool->ShowDRCDialog( this );
1155
1156 // Update DRC warnings on return to this dialog
1157 reInitDialog();
1158 }
1159}
1160
1161
1162void DIALOG_PLOT::onBoardSetup( wxHyperlinkEvent& aEvent )
1163{
1164 PCB_EDIT_FRAME* parent = dynamic_cast<PCB_EDIT_FRAME*>( GetParent() );
1165
1166 if( parent )
1167 {
1168 parent->ShowBoardSetupDialog( _( "Solder Mask/Paste" ) );
1169
1170 // Update warnings on return to this dialog
1171 reInitDialog();
1172 }
1173}
1174
1175
1176void DIALOG_PLOT::onPlotAllListMoveUp( wxCommandEvent& aEvent )
1177{
1178 if( m_plotAllLayersList->CanMoveCurrentUp() )
1179 m_plotAllLayersList->MoveCurrentUp();
1180}
1181
1182
1183void DIALOG_PLOT::onPlotAllListMoveDown( wxCommandEvent& aEvent )
1184{
1185 if( m_plotAllLayersList->CanMoveCurrentDown() )
1186 m_plotAllLayersList->MoveCurrentDown();
1187}
1188
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:106
@ small_folder
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:190
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:269
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:587
bool ResolveTextVar(wxString *token, int aDepth) const
Definition: board.cpp:350
MARKERS & Markers()
Definition: board.h:320
const wxString & GetFileName() const
Definition: board.h:306
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:474
PROJECT * GetProject() const
Definition: board.h:446
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:704
Class DIALOG_PLOT_BASE.
wxStaticText * m_DRCExclusionsWarning
wxTextCtrl * m_fineAdjustXCtrl
wxBoxSizer * bmiddleSizer
wxStaticBoxSizer * m_PDFOptionsSizer
wxCheckBox * m_disableApertMacros
wxChoice * m_scaleOpt
wxChoice * m_coordFormatCtrl
wxCheckBox * m_DXF_plotModeOpt
wxChoice * m_SVGColorChoice
STD_BITMAP_BUTTON * m_browseButton
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
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
WX_HTML_REPORT_PANEL * m_messagesPanel
wxChoice * m_PDFColorChoice
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:78
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:493
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:532
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:64
PCB_LAYER_ID GetData() const
Definition: dialog_plot.cpp:71
void SetData(PCB_LAYER_ID aId)
Definition: dialog_plot.cpp:69
PCB_LAYER_ID_CLIENT_DATA(PCB_LAYER_ID aId)
Definition: dialog_plot.cpp:67
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.
void SetBitmap(const wxBitmap &aBmp)
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.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition: common.cpp:299
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:327
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Definition: common.cpp:58
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:300
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:352
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:827
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:225
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
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
std::vector< FAB_LAYER_COLOR > dummy
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.