mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Shift gerber job to lseq instead
This commit is contained in:
parent
6692f39d6f
commit
2123c03fa1
@ -19,7 +19,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <jobs/job_export_pcb_gerbers.h>
|
#include <jobs/job_export_pcb_gerbers.h>
|
||||||
#include <jobs/lset_json.h>
|
|
||||||
#include <jobs/job_registry.h>
|
#include <jobs/job_registry.h>
|
||||||
#include <i18n_utility.h>
|
#include <i18n_utility.h>
|
||||||
|
|
||||||
@ -33,7 +32,7 @@ JOB_EXPORT_PCB_GERBERS::JOB_EXPORT_PCB_GERBERS() :
|
|||||||
m_params.emplace_back( new JOB_PARAM<bool>( "layers_include_on_all_set", &m_layersIncludeOnAllSet,
|
m_params.emplace_back( new JOB_PARAM<bool>( "layers_include_on_all_set", &m_layersIncludeOnAllSet,
|
||||||
m_layersIncludeOnAllSet ) );
|
m_layersIncludeOnAllSet ) );
|
||||||
|
|
||||||
m_params.emplace_back( new JOB_PARAM<LSET>( "layers_include_on_all", &m_layersIncludeOnAll,
|
m_params.emplace_back( new JOB_PARAM_LSEQ( "layers_include_on_all", &m_layersIncludeOnAll,
|
||||||
m_layersIncludeOnAll ) );
|
m_layersIncludeOnAll ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
wxString GetDefaultDescription() const override;
|
wxString GetDefaultDescription() const override;
|
||||||
wxString GetSettingsDialogTitle() const override;
|
wxString GetSettingsDialogTitle() const override;
|
||||||
|
|
||||||
LSET m_layersIncludeOnAll;
|
LSEQ m_layersIncludeOnAll;
|
||||||
|
|
||||||
bool m_layersIncludeOnAllSet;
|
bool m_layersIncludeOnAllSet;
|
||||||
bool m_useBoardPlotParams;
|
bool m_useBoardPlotParams;
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2024 Mark Roszko <mark.roszko@gmail.com>
|
|
||||||
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or (at your
|
|
||||||
* option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <lset.h>
|
|
||||||
#include <nlohmann/json_fwd.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
void to_json( nlohmann::json& aJson, const LSET& aLset )
|
|
||||||
{
|
|
||||||
nlohmann::json layers = nlohmann::json::array();
|
|
||||||
|
|
||||||
for( PCB_LAYER_ID layer : aLset.Seq() )
|
|
||||||
layers.push_back( LSET::Name( layer ) );
|
|
||||||
|
|
||||||
aJson = layers;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void from_json( const nlohmann::json& aJson, LSET& aLset )
|
|
||||||
{
|
|
||||||
if( aJson.is_array() )
|
|
||||||
{
|
|
||||||
aLset.clear();
|
|
||||||
|
|
||||||
for( const nlohmann::json& layer : aJson )
|
|
||||||
{
|
|
||||||
if( layer.is_string() )
|
|
||||||
{
|
|
||||||
wxString name = layer.get<wxString>();
|
|
||||||
int layerId = LSET::NameToLayer( name );
|
|
||||||
if( layerId != UNDEFINED_LAYER )
|
|
||||||
aLset.set( layerId );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( aJson.is_string() )
|
|
||||||
{
|
|
||||||
// Allow hex strings to be parsed into LSETs
|
|
||||||
aLset.ParseHex( aJson.get<std::string>() );
|
|
||||||
}
|
|
||||||
}
|
|
@ -921,7 +921,7 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
|
|||||||
LSET plotLayers = ( boardPlotOptions.GetLayerSelection() & LSET::AllNonCuMask() )
|
LSET plotLayers = ( boardPlotOptions.GetLayerSelection() & LSET::AllNonCuMask() )
|
||||||
| ( brd->GetEnabledLayers() & LSET::AllCuMask() );
|
| ( brd->GetEnabledLayers() & LSET::AllCuMask() );
|
||||||
aGerberJob->m_printMaskLayer = plotLayers.SeqStackupForPlotting();
|
aGerberJob->m_printMaskLayer = plotLayers.SeqStackupForPlotting();
|
||||||
aGerberJob->m_layersIncludeOnAll = boardPlotOptions.GetPlotOnAllLayersSelection();
|
aGerberJob->m_layersIncludeOnAll = boardPlotOptions.GetPlotOnAllLayersSelection().UIOrder();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -930,7 +930,7 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
|
|||||||
aGerberJob->m_printMaskLayer = brd->GetEnabledLayers().SeqStackupForPlotting();
|
aGerberJob->m_printMaskLayer = brd->GetEnabledLayers().SeqStackupForPlotting();
|
||||||
|
|
||||||
if( aGerberJob->m_layersIncludeOnAllSet )
|
if( aGerberJob->m_layersIncludeOnAllSet )
|
||||||
aGerberJob->m_layersIncludeOnAll = plotOnAllLayersSelection;
|
aGerberJob->m_layersIncludeOnAll = plotOnAllLayersSelection.UIOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure layers to plot are restricted to enabled layers of the board to plot
|
// Ensure layers to plot are restricted to enabled layers of the board to plot
|
||||||
@ -944,7 +944,7 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
|
|||||||
plotSequence.push_back( layer );
|
plotSequence.push_back( layer );
|
||||||
|
|
||||||
// Now all the "include on all" layers
|
// Now all the "include on all" layers
|
||||||
for( PCB_LAYER_ID layer_all : aGerberJob->m_layersIncludeOnAll.UIOrder() )
|
for( PCB_LAYER_ID layer_all : aGerberJob->m_layersIncludeOnAll )
|
||||||
{
|
{
|
||||||
// Don't plot the same layer more than once;
|
// Don't plot the same layer more than once;
|
||||||
if( find( plotSequence.begin(), plotSequence.end(), layer_all ) != plotSequence.end() )
|
if( find( plotSequence.begin(), plotSequence.end(), layer_all ) != plotSequence.end() )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user