mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-03-30 05:56:55 +00:00
Keep user-defined common layers order.
(And use it when plotting.) (And don't shadow it with a second variable.) Fixes https://gitlab.com/kicad/code/kicad/-/issues/20214
This commit is contained in:
parent
4248fba976
commit
9be7464681
@ -852,7 +852,10 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
|
||||
return ret;
|
||||
|
||||
const PCB_PLOT_PARAMS& plotParams = m_board->GetPlotOptions();
|
||||
LSET layers = plotParams.GetLayerSelection() | plotParams.GetPlotOnAllLayersSelection();
|
||||
LSET layers = plotParams.GetLayerSelection();
|
||||
|
||||
for( PCB_LAYER_ID commonLayer : plotParams.GetPlotOnAllLayersSequence() )
|
||||
layers.set( commonLayer );
|
||||
|
||||
ret.set( LAYER_3D_BOARD, true );
|
||||
ret.set( LAYER_3D_COPPER_TOP, layers.test( F_Cu ) );
|
||||
|
@ -24,17 +24,9 @@
|
||||
|
||||
JOB_EXPORT_PCB_GERBERS::JOB_EXPORT_PCB_GERBERS() :
|
||||
JOB_EXPORT_PCB_GERBER( "gerbers" ),
|
||||
m_layersIncludeOnAll(),
|
||||
m_layersIncludeOnAllSet( false ),
|
||||
m_useBoardPlotParams( false ),
|
||||
m_createJobsFile( true )
|
||||
{
|
||||
m_params.emplace_back( new JOB_PARAM<bool>( "layers_include_on_all_set", &m_layersIncludeOnAllSet,
|
||||
m_layersIncludeOnAllSet ) );
|
||||
|
||||
m_params.emplace_back( new JOB_PARAM_LSEQ( "layers_include_on_all", &m_layersIncludeOnAll,
|
||||
m_layersIncludeOnAll ) );
|
||||
|
||||
m_params.emplace_back( new JOB_PARAM<bool>( "create_gerber_job_file", &m_createJobsFile,
|
||||
m_createJobsFile ) );
|
||||
}
|
||||
|
@ -35,9 +35,6 @@ public:
|
||||
wxString GetDefaultDescription() const override;
|
||||
wxString GetSettingsDialogTitle() const override;
|
||||
|
||||
LSEQ m_layersIncludeOnAll;
|
||||
|
||||
bool m_layersIncludeOnAllSet;
|
||||
bool m_useBoardPlotParams;
|
||||
|
||||
bool m_createJobsFile;
|
||||
|
@ -38,16 +38,17 @@ JOB_EXPORT_PCB_PLOT::JOB_EXPORT_PCB_PLOT( PLOT_FORMAT aFormat, const std::string
|
||||
m_plotDrawingSheet( true ),
|
||||
m_subtractSolderMaskFromSilk( false ),
|
||||
m_plotPadNumbers( false ),
|
||||
m_printMaskLayer(),
|
||||
m_printMaskLayersToIncludeOnAllLayers(),
|
||||
m_plotLayerSequence(),
|
||||
m_plotOnAllLayersSequence(),
|
||||
m_drillShapeOption( DRILL_MARKS::FULL_DRILL_SHAPE ),
|
||||
m_useDrillOrigin( false )
|
||||
{
|
||||
m_params.emplace_back( new JOB_PARAM_LSEQ( "layers", &m_printMaskLayer, m_printMaskLayer ) );
|
||||
m_params.emplace_back( new JOB_PARAM_LSEQ( "layers",
|
||||
&m_plotLayerSequence, m_plotLayerSequence ) );
|
||||
|
||||
m_params.emplace_back( new JOB_PARAM_LSEQ( "layers_to_include_on_all_layers",
|
||||
&m_printMaskLayersToIncludeOnAllLayers,
|
||||
m_printMaskLayersToIncludeOnAllLayers ) );
|
||||
&m_plotOnAllLayersSequence,
|
||||
m_plotOnAllLayersSequence ) );
|
||||
|
||||
m_params.emplace_back( new JOB_PARAM<bool>( "mirror",
|
||||
&m_mirror, m_mirror ) );
|
||||
|
@ -66,9 +66,9 @@ public:
|
||||
bool m_subtractSolderMaskFromSilk;
|
||||
bool m_plotPadNumbers;
|
||||
|
||||
LSEQ m_printMaskLayer;
|
||||
LSEQ m_plotLayerSequence;
|
||||
///< Layers to include on all individual layer prints
|
||||
LSEQ m_printMaskLayersToIncludeOnAllLayers;
|
||||
LSEQ m_plotOnAllLayersSequence;
|
||||
|
||||
enum class DRILL_MARKS
|
||||
{
|
||||
|
@ -74,8 +74,7 @@ CLI::PCB_EXPORT_BASE_COMMAND::PCB_EXPORT_BASE_COMMAND( const std::string& aName,
|
||||
}
|
||||
|
||||
|
||||
LSEQ CLI::PCB_EXPORT_BASE_COMMAND::convertLayerStringList( wxString& aLayerString,
|
||||
bool& aLayerArgSet ) const
|
||||
LSEQ CLI::PCB_EXPORT_BASE_COMMAND::convertLayerStringList( wxString& aLayerString ) const
|
||||
{
|
||||
LSEQ layerMask;
|
||||
|
||||
@ -92,16 +91,12 @@ LSEQ CLI::PCB_EXPORT_BASE_COMMAND::convertLayerStringList( wxString& aLayerStrin
|
||||
{
|
||||
for( PCB_LAYER_ID layer : m_layerMasks.at( token ).Seq() )
|
||||
layerMask.push_back( layer );
|
||||
|
||||
aLayerArgSet = true;
|
||||
}
|
||||
// Search for a layer name in canonical layer name used in GUI (not translated):
|
||||
else if( m_layerGuiMasks.count( token ) )
|
||||
{
|
||||
for( PCB_LAYER_ID layer : m_layerGuiMasks.at( token ).Seq() )
|
||||
layerMask.push_back( layer );
|
||||
|
||||
aLayerArgSet = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -134,7 +129,7 @@ int CLI::PCB_EXPORT_BASE_COMMAND::doPerform( KIWAY& aKiway )
|
||||
{
|
||||
wxString layers = From_UTF8( m_argParser.get<std::string>( ARG_LAYERS ).c_str() );
|
||||
|
||||
LSEQ layerMask = convertLayerStringList( layers, m_selectedLayersSet );
|
||||
LSEQ layerMask = convertLayerStringList( layers );
|
||||
|
||||
if( m_requireLayers && layerMask.size() < 1 )
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ struct PCB_EXPORT_BASE_COMMAND : public COMMAND
|
||||
|
||||
protected:
|
||||
int doPerform( KIWAY& aKiway ) override;
|
||||
LSEQ convertLayerStringList( wxString& aLayerString, bool& aLayerArgSet ) const;
|
||||
LSEQ convertLayerStringList( wxString& aLayerString ) const;
|
||||
void addLayerArg( bool aRequire );
|
||||
|
||||
// The list of canonical layer names used in .kicad_pcb files:
|
||||
|
@ -99,8 +99,7 @@ CLI::PCB_EXPORT_DXF_COMMAND::PCB_EXPORT_DXF_COMMAND() : PCB_EXPORT_BASE_COMMAND(
|
||||
.default_value( std::string() )
|
||||
.help( UTF8STDSTR(
|
||||
_( "Layers to include on each plot, comma separated list of untranslated "
|
||||
"layer names to include such as "
|
||||
"F.Cu,B.Cu" ) ) )
|
||||
"layer names to include such as F.Cu,B.Cu" ) ) )
|
||||
.metavar( "COMMON_LAYER_LIST" );
|
||||
|
||||
m_argParser.add_argument( ARG_MODE_SINGLE )
|
||||
@ -175,11 +174,10 @@ int CLI::PCB_EXPORT_DXF_COMMAND::doPerform( KIWAY& aKiway )
|
||||
return EXIT_CODES::ERR_ARGS;
|
||||
}
|
||||
|
||||
dxfJob->m_printMaskLayer = m_selectedLayers;
|
||||
dxfJob->m_plotLayerSequence = m_selectedLayers;
|
||||
|
||||
wxString layers = From_UTF8( m_argParser.get<std::string>( ARG_COMMON_LAYERS ).c_str() );
|
||||
bool blah = false;
|
||||
dxfJob->m_printMaskLayersToIncludeOnAllLayers = convertLayerStringList( layers, blah );
|
||||
dxfJob->m_plotOnAllLayersSequence = convertLayerStringList( layers );
|
||||
|
||||
if( m_argParser.get<bool>( ARG_MODE_MULTI ) )
|
||||
dxfJob->m_genMode = JOB_EXPORT_PCB_DXF::GEN_MODE::MULTI;
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <wx/tokenzr.h>
|
||||
|
||||
#include <locale_io.h>
|
||||
|
||||
#include <string_utils.h>
|
||||
|
||||
|
||||
CLI::PCB_EXPORT_GERBER_COMMAND::PCB_EXPORT_GERBER_COMMAND( const std::string& aName ) :
|
||||
@ -90,6 +90,13 @@ CLI::PCB_EXPORT_GERBER_COMMAND::PCB_EXPORT_GERBER_COMMAND( const std::string& aN
|
||||
.help( UTF8STDSTR( _( "Use drill/place file origin" ) ) )
|
||||
.flag();
|
||||
|
||||
m_argParser.add_argument( "--cl", ARG_COMMON_LAYERS )
|
||||
.default_value( std::string() )
|
||||
.help( UTF8STDSTR(
|
||||
_( "Layers to include on each plot, comma separated list of untranslated "
|
||||
"layer names to include such as F.Cu,B.Cu" ) ) )
|
||||
.metavar( "COMMON_LAYER_LIST" );
|
||||
|
||||
m_argParser.add_argument( ARG_PRECISION )
|
||||
.help( UTF8STDSTR( _( "Precision of Gerber coordinates, valid options: 5 or 6" ) ) )
|
||||
.scan<'i', int>()
|
||||
@ -106,7 +113,8 @@ CLI::PCB_EXPORT_GERBER_COMMAND::PCB_EXPORT_GERBER_COMMAND( const std::string& aN
|
||||
}
|
||||
|
||||
|
||||
CLI::PCB_EXPORT_GERBER_COMMAND::PCB_EXPORT_GERBER_COMMAND() : PCB_EXPORT_GERBER_COMMAND( "gerber" )
|
||||
CLI::PCB_EXPORT_GERBER_COMMAND::PCB_EXPORT_GERBER_COMMAND() :
|
||||
PCB_EXPORT_GERBER_COMMAND( "gerber" )
|
||||
{
|
||||
}
|
||||
|
||||
@ -132,7 +140,10 @@ int CLI::PCB_EXPORT_GERBER_COMMAND::populateJob( JOB_EXPORT_PCB_GERBER* aJob )
|
||||
aJob->m_useDrillOrigin = m_argParser.get<bool>( ARG_USE_DRILL_FILE_ORIGIN );
|
||||
aJob->m_useProtelFileExtension = !m_argParser.get<bool>( ARG_NO_PROTEL_EXTENSION );
|
||||
aJob->m_precision = m_argParser.get<int>( ARG_PRECISION );
|
||||
aJob->m_printMaskLayer = m_selectedLayers;
|
||||
aJob->m_plotLayerSequence = m_selectedLayers;
|
||||
|
||||
wxString layers = From_UTF8( m_argParser.get<std::string>( ARG_COMMON_LAYERS ).c_str() );
|
||||
aJob->m_plotOnAllLayersSequence = convertLayerStringList( layers );
|
||||
|
||||
if( m_argParser.get<bool>( DEPRECATED_ARG_PLOT_INVISIBLE_TEXT ) )
|
||||
wxFprintf( stdout, DEPRECATED_ARD_PLOT_INVISIBLE_TEXT_WARNING );
|
||||
|
@ -72,8 +72,7 @@ int CLI::PCB_EXPORT_GERBERS_COMMAND::doPerform( KIWAY& aKiway )
|
||||
return exitCode;
|
||||
|
||||
wxString layers = From_UTF8( m_argParser.get<std::string>( ARG_COMMON_LAYERS ).c_str() );
|
||||
gerberJob->m_layersIncludeOnAll =
|
||||
convertLayerStringList( layers, gerberJob->m_layersIncludeOnAllSet );
|
||||
gerberJob->m_plotOnAllLayersSequence = convertLayerStringList( layers );
|
||||
gerberJob->m_useBoardPlotParams = m_argParser.get<bool>( ARG_USE_BOARD_PLOT_PARAMS );
|
||||
|
||||
LOCALE_IO dummy;
|
||||
|
@ -165,7 +165,7 @@ int CLI::PCB_EXPORT_PDF_COMMAND::doPerform( KIWAY& aKiway )
|
||||
int drillShape = m_argParser.get<int>( ARG_DRILL_SHAPE_OPTION );
|
||||
pdfJob->m_drillShapeOption = static_cast<JOB_EXPORT_PCB_PDF::DRILL_MARKS>( drillShape );
|
||||
|
||||
pdfJob->m_printMaskLayer = m_selectedLayers;
|
||||
pdfJob->m_plotLayerSequence = m_selectedLayers;
|
||||
|
||||
bool argModeMulti = m_argParser.get<bool>( ARG_MODE_MULTIPAGE );
|
||||
bool argModeSeparate = m_argParser.get<bool>( ARG_MODE_SEPARATE );
|
||||
@ -178,8 +178,7 @@ int CLI::PCB_EXPORT_PDF_COMMAND::doPerform( KIWAY& aKiway )
|
||||
}
|
||||
|
||||
wxString layers = From_UTF8( m_argParser.get<std::string>( ARG_COMMON_LAYERS ).c_str() );
|
||||
bool blah = false;
|
||||
pdfJob->m_printMaskLayersToIncludeOnAllLayers = convertLayerStringList( layers, blah );
|
||||
pdfJob->m_plotOnAllLayersSequence = convertLayerStringList( layers );
|
||||
|
||||
if( argModeMulti )
|
||||
pdfJob->m_pdfGenMode = JOB_EXPORT_PCB_PDF::GEN_MODE::ONE_PAGE_PER_LAYER_ONE_FILE;
|
||||
|
@ -179,8 +179,7 @@ int CLI::PCB_EXPORT_SVG_COMMAND::doPerform( KIWAY& aKiway )
|
||||
svgJob->SetVarOverrides( m_argDefineVars );
|
||||
|
||||
wxString layers = From_UTF8( m_argParser.get<std::string>( ARG_COMMON_LAYERS ).c_str() );
|
||||
bool blah = false;
|
||||
svgJob->m_printMaskLayersToIncludeOnAllLayers = convertLayerStringList( layers, blah );
|
||||
svgJob->m_plotOnAllLayersSequence = convertLayerStringList( layers );
|
||||
|
||||
if( !wxFile::Exists( svgJob->m_filename ) )
|
||||
{
|
||||
@ -188,7 +187,7 @@ int CLI::PCB_EXPORT_SVG_COMMAND::doPerform( KIWAY& aKiway )
|
||||
return EXIT_CODES::ERR_INVALID_INPUT_FILE;
|
||||
}
|
||||
|
||||
svgJob->m_printMaskLayer = m_selectedLayers;
|
||||
svgJob->m_plotLayerSequence = m_selectedLayers;
|
||||
|
||||
if( m_argParser.get<bool>( ARG_MODE_MULTI ) )
|
||||
svgJob->m_genMode = JOB_EXPORT_PCB_SVG::GEN_MODE::MULTI;
|
||||
|
@ -135,7 +135,6 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent,
|
||||
m_hash_key = TO_UTF8( GetTitle() );
|
||||
|
||||
int order = 0;
|
||||
LSET plotOnAllLayersSelection = m_plotOpts.GetPlotOnAllLayersSelection();
|
||||
wxArrayInt plotAllLayersOrder;
|
||||
wxArrayString plotAllLayersChoicesStrings;
|
||||
std::vector<PCB_LAYER_ID> layersIdChoiceList;
|
||||
@ -151,9 +150,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent,
|
||||
plotAllLayersChoicesStrings.Add( layerName );
|
||||
layersIdChoiceList.push_back( layer );
|
||||
|
||||
size_t size = plotOnAllLayersSelection.size();
|
||||
|
||||
if( ( static_cast<size_t>( layer ) <= size ) && plotOnAllLayersSelection.test( layer ) )
|
||||
if( alg::contains( m_plotOpts.GetPlotOnAllLayersSequence(), layer ) )
|
||||
plotAllLayersOrder.push_back( order );
|
||||
else
|
||||
plotAllLayersOrder.push_back( ~order );
|
||||
@ -493,8 +490,8 @@ void DIALOG_PLOT::transferPlotParamsToJob()
|
||||
m_job->m_blackAndWhite = m_plotOpts.GetBlackAndWhite();
|
||||
m_job->m_mirror = m_plotOpts.GetMirror();
|
||||
m_job->m_negative = m_plotOpts.GetNegative();
|
||||
m_job->m_printMaskLayer = m_plotOpts.GetLayerSelection().UIOrder();
|
||||
m_job->m_printMaskLayersToIncludeOnAllLayers = m_plotOpts.GetPlotOnAllLayersSelection().UIOrder();
|
||||
m_job->m_plotLayerSequence = m_plotOpts.GetLayerSelection().SeqStackupForPlotting();
|
||||
m_job->m_plotOnAllLayersSequence = m_plotOpts.GetPlotOnAllLayersSequence();
|
||||
|
||||
if( m_job->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::SVG ||
|
||||
m_job->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::PDF )
|
||||
@ -1172,27 +1169,24 @@ void DIALOG_PLOT::applyPlotSettings()
|
||||
// Get a list of copper layers that aren't being used by inverting enabled layers.
|
||||
LSET disabledCopperLayers = LSET::AllCuMask() & ~m_editFrame->GetBoard()->GetEnabledLayers();
|
||||
|
||||
LSET plotOnAllLayers;
|
||||
|
||||
// Add selected layers from plot on all layers list in order set by user.
|
||||
wxArrayInt plotOnAllLayersSelections;
|
||||
wxArrayInt plotOnAllLayers;
|
||||
LSEQ commonLayers;
|
||||
|
||||
m_plotAllLayersList->GetCheckedItems( plotOnAllLayersSelections );
|
||||
|
||||
size_t count = plotOnAllLayersSelections.GetCount();
|
||||
|
||||
for( size_t i = 0; i < count; i++ )
|
||||
if( m_plotAllLayersList->GetCheckedItems( plotOnAllLayers ) )
|
||||
{
|
||||
int index = plotOnAllLayersSelections.Item( i );
|
||||
wxClientData* tmp = m_plotAllLayersList->GetClientObject( index );
|
||||
PCB_LAYER_ID_CLIENT_DATA* layerId = dynamic_cast<PCB_LAYER_ID_CLIENT_DATA*>( tmp );
|
||||
size_t count = plotOnAllLayers.GetCount();
|
||||
|
||||
wxCHECK2( layerId, continue );
|
||||
for( size_t i = 0; i < count; i++ )
|
||||
{
|
||||
int index = plotOnAllLayers.Item( i );
|
||||
PCB_LAYER_ID client_layer = getLayerClientData( m_plotAllLayersList, index )->Layer();
|
||||
|
||||
plotOnAllLayers.set( layerId->Layer() );
|
||||
commonLayers.push_back( client_layer );
|
||||
}
|
||||
}
|
||||
|
||||
tempOptions.SetPlotOnAllLayersSelection( plotOnAllLayers );
|
||||
tempOptions.SetPlotOnAllLayersSequence( commonLayers );
|
||||
|
||||
// Enable all of the disabled copper layers.
|
||||
// If someone enables more copper layers they will be selected by default.
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <plotters/plotter.h>
|
||||
#include <io/kicad/kicad_io_utils.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <lseq.h>
|
||||
|
||||
|
||||
#define PLOT_LINEWIDTH_DEFAULT ( DEFAULT_TEXT_WIDTH * IU_PER_MM )
|
||||
@ -180,8 +181,12 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter ) const
|
||||
|
||||
aFormatter->Print( "(layerselection 0x%s)", m_layerSelection.FmtHex().c_str() );
|
||||
|
||||
aFormatter->Print( "(plot_on_all_layers_selection 0x%s)",
|
||||
m_plotOnAllLayersSelection.FmtHex().c_str() );
|
||||
LSET commonLayers;
|
||||
|
||||
for( PCB_LAYER_ID commonLayer : m_plotOnAllLayersSequence )
|
||||
commonLayers.set( commonLayer );
|
||||
|
||||
aFormatter->Print( "(plot_on_all_layers_selection 0x%s)", commonLayers.FmtHex().c_str() );
|
||||
|
||||
KICAD_FORMAT::FormatBool( aFormatter, "disableapertmacros", m_gerberDisableApertMacros );
|
||||
KICAD_FORMAT::FormatBool( aFormatter, "usegerberextensions", m_useGerberProtelExtensions );
|
||||
@ -255,7 +260,7 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
|
||||
if( m_layerSelection != aPcbPlotParams.m_layerSelection )
|
||||
return false;
|
||||
|
||||
if( m_plotOnAllLayersSelection != aPcbPlotParams.m_plotOnAllLayersSelection )
|
||||
if( m_plotOnAllLayersSequence != aPcbPlotParams.m_plotOnAllLayersSequence )
|
||||
return false;
|
||||
|
||||
if( m_useGerberProtelExtensions != aPcbPlotParams.m_useGerberProtelExtensions )
|
||||
@ -647,22 +652,27 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
|
||||
|
||||
if( cur.find_first_of( "0x" ) == 0 )
|
||||
{
|
||||
// The layers were renumbered in 5e0abadb23425765e164f49ee2f893e94ddb97fc, but there wasn't
|
||||
// a board file version change with it, so this value is the one immediately after that happened.
|
||||
LSET layers;
|
||||
|
||||
// The layers were renumbered in 5e0abadb23425765e164f49ee2f893e94ddb97fc, but
|
||||
// there wasn't a board file version change with it, so this value is the one
|
||||
// immediately after that happened.
|
||||
if( m_boardFileVersion < 20240819 )
|
||||
{
|
||||
BASE_SET legacyLSET( LEGACY_PCB_LAYER_ID_COUNT );
|
||||
|
||||
// skip the leading 2 0x bytes.
|
||||
legacyLSET.ParseHex( cur.c_str() + 2, cur.size() - 2 );
|
||||
aPcbPlotParams->SetPlotOnAllLayersSelection( remapLegacyLayerLSET( legacyLSET ) );
|
||||
|
||||
layers = remapLegacyLayerLSET( legacyLSET );
|
||||
}
|
||||
else
|
||||
{
|
||||
// skip the leading 2 0x bytes.
|
||||
aPcbPlotParams->m_plotOnAllLayersSelection.ParseHex( cur.c_str() + 2,
|
||||
cur.size() - 2 );
|
||||
layers.ParseHex( cur.c_str() + 2, cur.size() - 2 );
|
||||
}
|
||||
|
||||
aPcbPlotParams->SetPlotOnAllLayersSequence( layers.SeqStackupForPlotting() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -719,7 +729,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
|
||||
|
||||
case T_excludeedgelayer:
|
||||
if( !parseBool() )
|
||||
aPcbPlotParams->m_plotOnAllLayersSelection.set( Edge_Cuts );
|
||||
aPcbPlotParams->m_plotOnAllLayersSequence.push_back( Edge_Cuts );
|
||||
|
||||
break;
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <plotters/plotter.h>
|
||||
#include <layer_ids.h>
|
||||
#include <plotprint_opts.h>
|
||||
#include <lseq.h>
|
||||
|
||||
class COLOR_SETTINGS;
|
||||
class PCB_PLOT_PARAMS_PARSER;
|
||||
@ -165,12 +166,8 @@ public:
|
||||
void SetLayerSelection( LSET aSelection ) { m_layerSelection = aSelection; }
|
||||
LSET GetLayerSelection() const { return m_layerSelection; }
|
||||
|
||||
void SetPlotOnAllLayersSelection( LSET aSelection )
|
||||
{
|
||||
m_plotOnAllLayersSelection = aSelection;
|
||||
}
|
||||
|
||||
LSET GetPlotOnAllLayersSelection() const { return m_plotOnAllLayersSelection; }
|
||||
void SetPlotOnAllLayersSequence( LSEQ aSeq ) { m_plotOnAllLayersSequence = aSeq; }
|
||||
LSEQ GetPlotOnAllLayersSequence() const { return m_plotOnAllLayersSequence; }
|
||||
|
||||
void SetUseAuxOrigin( bool aAux ) { m_useAuxOrigin = aAux; }
|
||||
bool GetUseAuxOrigin() const { return m_useAuxOrigin; }
|
||||
@ -210,7 +207,7 @@ private:
|
||||
|
||||
PLOT_FORMAT m_format; /// Plot format type (chooses the driver to be used)
|
||||
LSET m_layerSelection;
|
||||
LSET m_plotOnAllLayersSelection;
|
||||
LSEQ m_plotOnAllLayersSequence;
|
||||
|
||||
bool m_skipNPTH_Pads; /// Used to disable NPTH pads plotting on copper layers
|
||||
OUTLINE_MODE m_plotMode; /// FILLED or SKETCH for filled objects.
|
||||
|
@ -408,8 +408,8 @@ void PCB_PLOTTER::PlotJobToPlotOpts( PCB_PLOT_PARAMS& aOpts, JOB_EXPORT_PCB_PLOT
|
||||
aOpts.SetMirror( aJob->m_mirror );
|
||||
aOpts.SetNegative( aJob->m_negative );
|
||||
|
||||
aOpts.SetLayerSelection( aJob->m_printMaskLayer );
|
||||
aOpts.SetPlotOnAllLayersSelection( aJob->m_printMaskLayersToIncludeOnAllLayers );
|
||||
aOpts.SetLayerSelection( aJob->m_plotLayerSequence );
|
||||
aOpts.SetPlotOnAllLayersSequence( aJob->m_plotOnAllLayersSequence );
|
||||
|
||||
switch( aJob->m_plotFormat )
|
||||
{
|
||||
|
@ -778,12 +778,10 @@ int PCBNEW_JOBS_HANDLER::JobExportSvg( JOB* aJob )
|
||||
}
|
||||
|
||||
LOCALE_IO dummy;
|
||||
if( !plotter.Plot( outPath, aSvgJob->m_printMaskLayer,
|
||||
aSvgJob->m_printMaskLayersToIncludeOnAllLayers, false,
|
||||
aSvgJob->m_genMode == JOB_EXPORT_PCB_SVG::GEN_MODE::SINGLE,
|
||||
layerName,
|
||||
sheetName,
|
||||
sheetPath ) )
|
||||
|
||||
if( !plotter.Plot( outPath, aSvgJob->m_plotLayerSequence, aSvgJob->m_plotOnAllLayersSequence,
|
||||
false, aSvgJob->m_genMode == JOB_EXPORT_PCB_SVG::GEN_MODE::SINGLE,
|
||||
layerName, sheetName, sheetPath ) )
|
||||
{
|
||||
return CLI::EXIT_CODES::ERR_UNKNOWN;
|
||||
}
|
||||
@ -851,10 +849,9 @@ int PCBNEW_JOBS_HANDLER::JobExportDxf( JOB* aJob )
|
||||
sheetPath = aDxfJob->GetVarOverrides().at( wxT( "SHEETPATH" ) );
|
||||
}
|
||||
|
||||
if( !plotter.Plot( outPath, aDxfJob->m_printMaskLayer,
|
||||
aDxfJob->m_printMaskLayersToIncludeOnAllLayers, false,
|
||||
aDxfJob->m_genMode == JOB_EXPORT_PCB_DXF::GEN_MODE::SINGLE, layerName,
|
||||
sheetName, sheetPath ) )
|
||||
if( !plotter.Plot( outPath, aDxfJob->m_plotLayerSequence, aDxfJob->m_plotOnAllLayersSequence,
|
||||
false, aDxfJob->m_genMode == JOB_EXPORT_PCB_DXF::GEN_MODE::SINGLE,
|
||||
layerName, sheetName, sheetPath ) )
|
||||
{
|
||||
return CLI::EXIT_CODES::ERR_UNKNOWN;
|
||||
}
|
||||
@ -928,13 +925,11 @@ int PCBNEW_JOBS_HANDLER::JobExportPdf( JOB* aJob )
|
||||
|
||||
|
||||
LOCALE_IO dummy;
|
||||
if( !pcbPlotter.Plot( outPath, aPdfJob->m_printMaskLayer,
|
||||
aPdfJob->m_printMaskLayersToIncludeOnAllLayers,
|
||||
false,
|
||||
aPdfJob->m_pdfGenMode == JOB_EXPORT_PCB_PDF::GEN_MODE::ALL_LAYERS_ONE_FILE,
|
||||
layerName,
|
||||
sheetName,
|
||||
sheetPath ) )
|
||||
|
||||
if( !pcbPlotter.Plot( outPath, aPdfJob->m_plotLayerSequence,
|
||||
aPdfJob->m_plotOnAllLayersSequence, false,
|
||||
aPdfJob->m_pdfGenMode == JOB_EXPORT_PCB_PDF::GEN_MODE::ALL_LAYERS_ONE_FILE,
|
||||
layerName, sheetName, sheetPath ) )
|
||||
{
|
||||
returnCode = CLI::EXIT_CODES::ERR_UNKNOWN;
|
||||
}
|
||||
@ -970,7 +965,6 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
|
||||
brd->SynchronizeProperties();
|
||||
|
||||
PCB_PLOT_PARAMS boardPlotOptions = brd->GetPlotOptions();
|
||||
LSET plotOnAllLayersSelection = boardPlotOptions.GetPlotOnAllLayersSelection();
|
||||
GERBER_JOBFILE_WRITER jobfile_writer( brd );
|
||||
|
||||
wxString fileExt;
|
||||
@ -983,21 +977,18 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
|
||||
// we don't plot 32 layers when we only have 4, etc.
|
||||
LSET plotLayers = ( boardPlotOptions.GetLayerSelection() & LSET::AllNonCuMask() )
|
||||
| ( brd->GetEnabledLayers() & LSET::AllCuMask() );
|
||||
aGerberJob->m_printMaskLayer = plotLayers.SeqStackupForPlotting();
|
||||
aGerberJob->m_layersIncludeOnAll = boardPlotOptions.GetPlotOnAllLayersSelection().UIOrder();
|
||||
aGerberJob->m_plotLayerSequence = plotLayers.SeqStackupForPlotting();
|
||||
aGerberJob->m_plotOnAllLayersSequence = boardPlotOptions.GetPlotOnAllLayersSequence();
|
||||
}
|
||||
else
|
||||
{
|
||||
// default to the board enabled layers
|
||||
if( aGerberJob->m_printMaskLayer.empty() )
|
||||
aGerberJob->m_printMaskLayer = brd->GetEnabledLayers().SeqStackupForPlotting();
|
||||
|
||||
if( aGerberJob->m_layersIncludeOnAllSet )
|
||||
aGerberJob->m_layersIncludeOnAll = plotOnAllLayersSelection.UIOrder();
|
||||
if( aGerberJob->m_plotLayerSequence.empty() )
|
||||
aGerberJob->m_plotLayerSequence = brd->GetEnabledLayers().SeqStackupForPlotting();
|
||||
}
|
||||
|
||||
// Ensure layers to plot are restricted to enabled layers of the board to plot
|
||||
LSET layersToPlot = LSET( { aGerberJob->m_printMaskLayer } ) & brd->GetEnabledLayers();
|
||||
LSET layersToPlot = LSET( { aGerberJob->m_plotLayerSequence } ) & brd->GetEnabledLayers();
|
||||
|
||||
for( PCB_LAYER_ID layer : layersToPlot.UIOrder() )
|
||||
{
|
||||
@ -1007,7 +998,7 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
|
||||
plotSequence.push_back( layer );
|
||||
|
||||
// Now all the "include on all" layers
|
||||
for( PCB_LAYER_ID layer_all : aGerberJob->m_layersIncludeOnAll )
|
||||
for( PCB_LAYER_ID layer_all : aGerberJob->m_plotOnAllLayersSequence )
|
||||
{
|
||||
// Don't plot the same layer more than once;
|
||||
if( find( plotSequence.begin(), plotSequence.end(), layer_all ) != plotSequence.end() )
|
||||
@ -1202,8 +1193,8 @@ int PCBNEW_JOBS_HANDLER::JobExportGerber( JOB* aJob )
|
||||
|
||||
PCB_PLOT_PARAMS plotOpts;
|
||||
populateGerberPlotOptionsFromJob( plotOpts, aGerberJob );
|
||||
plotOpts.SetLayerSelection( aGerberJob->m_printMaskLayer );
|
||||
plotOpts.SetPlotOnAllLayersSelection( aGerberJob->m_printMaskLayersToIncludeOnAllLayers );
|
||||
plotOpts.SetLayerSelection( aGerberJob->m_plotLayerSequence );
|
||||
plotOpts.SetPlotOnAllLayersSequence( aGerberJob->m_plotOnAllLayersSequence );
|
||||
|
||||
PCB_LAYER_ID layer = UNDEFINED_LAYER;
|
||||
wxString layerName;
|
||||
@ -1214,9 +1205,9 @@ int PCBNEW_JOBS_HANDLER::JobExportGerber( JOB* aJob )
|
||||
// The first layer will be treated as the layer name for the gerber header,
|
||||
// the other layers will be treated equivalent to the "Plot on All Layers" option
|
||||
// in the GUI
|
||||
if( aGerberJob->m_printMaskLayer.size() >= 1 )
|
||||
if( aGerberJob->m_plotLayerSequence.size() >= 1 )
|
||||
{
|
||||
layer = aGerberJob->m_printMaskLayer.front();
|
||||
layer = aGerberJob->m_plotLayerSequence.front();
|
||||
layerName = brd->GetLayerName( layer );
|
||||
}
|
||||
|
||||
@ -1235,7 +1226,7 @@ int PCBNEW_JOBS_HANDLER::JobExportGerber( JOB* aJob )
|
||||
|
||||
if( plotter )
|
||||
{
|
||||
PlotBoardLayers( brd, plotter, aGerberJob->m_printMaskLayer, plotOpts );
|
||||
PlotBoardLayers( brd, plotter, aGerberJob->m_plotLayerSequence, plotOpts );
|
||||
plotter->EndPlot();
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user