diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 5806438fe1..f3d13a43e5 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -677,14 +677,18 @@ void DIALOG_PLOT::applyPlotSettings() tempOptions.SetGerberPrecision( m_rbGerberFormat->GetSelection() == 0 ? 5 : 6 ); LSET selectedLayers; - for( unsigned i = 0; i < m_layerList.size(); i++ ) { if( m_layerCheckListBox->IsChecked( i ) ) selectedLayers.set( m_layerList[i] ); } - + // Get a list of copper layers that aren't being used by inverting enabled layers. + LSET disabledCopperLayers = LSET::AllCuMask() & ~m_board->GetEnabledLayers(); + // Enable all of the disabled copper layers. + // If someone enables more copper layers they will be selected by default. + selectedLayers = selectedLayers | disabledCopperLayers; tempOptions.SetLayerSelection( selectedLayers ); + tempOptions.SetNegative( m_plotPSNegativeOpt->GetValue() ); tempOptions.SetA4Output( m_forcePSA4OutputOpt->GetValue() ); @@ -782,7 +786,16 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) for( LSEQ seq = m_plotOpts.GetLayerSelection().UIOrder(); seq; ++seq ) { LAYER_ID layer = *seq; - + + // All copper layers that are disabled are actually selected + // This is due to wonkyness in automatically selecting copper layers + // for plotting when adding more than two layers to a board. + // If plot options become accessible to the layers setup dialog + // please move this functionality there! + // This skips a copper layer if it is actually disabled on the board. + if( ( LSET::AllCuMask() & ~m_board->GetEnabledLayers() )[layer] ) + continue; + // Pick the basename from the board file wxFileName fn( boardFilename ); diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index 9f40fbcdc0..85aeb0420b 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -79,8 +79,7 @@ static bool setInt( int* aInt, int aValue, int aMin, int aMax ) // PCB_PLOT_PARAMS -PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() : - m_layerSelection( 4, B_Cu, F_Cu, F_SilkS, B_SilkS ) +PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() { m_useGerberProtelExtensions = false; m_useGerberAttributes = false; @@ -116,6 +115,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() : m_referenceColor = BLACK; m_valueColor = BLACK; m_textMode = PLOTTEXTMODE_DEFAULT; + m_layerSelection = LSET( 2, F_SilkS, B_SilkS) | LSET::AllCuMask(); // This parameter controls if the NPTH pads will be plotted or not // it is a "local" parameter @@ -377,7 +377,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) */ // sorry, use the UI once to fix: - aPcbPlotParams->m_layerSelection = LSET( 4, B_Cu, F_Cu, F_SilkS, B_SilkS ); + aPcbPlotParams->m_layerSelection = LSET( 2, F_SilkS, B_SilkS) | LSET::AllCuMask(); } else if( cur.find_first_of( "0x" ) == 0 ) // pretty ver. 4. {