Browse Source

Add HPGL job support

- kicad-cli pcb export hpgl
- "Export HPGL" job
pull/18/head
Salvador E. Tropea 6 months ago
committed by Mark Roszko
parent
commit
c528f3c605
  1. 1
      common/CMakeLists.txt
  2. 61
      common/jobs/job_export_pcb_hpgl.cpp
  3. 51
      common/jobs/job_export_pcb_hpgl.h
  4. 1
      kicad/CMakeLists.txt
  5. 168
      kicad/cli/command_pcb_export_hpgl.cpp
  6. 38
      kicad/cli/command_pcb_export_hpgl.h
  7. 3
      kicad/kicad_cli.cpp
  8. 12
      pcbnew/dialogs/dialog_plot.cpp
  9. 9
      pcbnew/pcb_plotter.cpp
  10. 99
      pcbnew/pcbnew_jobs_handler.cpp
  11. 1
      pcbnew/pcbnew_jobs_handler.h

1
common/CMakeLists.txt

@ -71,6 +71,7 @@ set( KICOMMON_SRCS
jobs/job_export_pcb_dxf.cpp
jobs/job_export_pcb_gerber.cpp
jobs/job_export_pcb_gerbers.cpp
jobs/job_export_pcb_hpgl.cpp
jobs/job_export_pcb_ipc2581.cpp
jobs/job_export_pcb_ipcd356.cpp
jobs/job_export_pcb_odb.cpp

61
common/jobs/job_export_pcb_hpgl.cpp

@ -0,0 +1,61 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 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 <jobs/job_export_pcb_hpgl.h>
#include <jobs/job_registry.h>
#include <i18n_utility.h>
NLOHMANN_JSON_SERIALIZE_ENUM( JOB_EXPORT_PCB_HPGL::GEN_MODE,
{
{ JOB_EXPORT_PCB_HPGL::GEN_MODE::MULTI, "multi" },
{ JOB_EXPORT_PCB_HPGL::GEN_MODE::SINGLE, "single" },
} )
JOB_EXPORT_PCB_HPGL::JOB_EXPORT_PCB_HPGL() :
JOB_EXPORT_PCB_PLOT( JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::HPGL, "hpgl", false ),
m_genMode( GEN_MODE::MULTI ), m_defaultPenSize( 0.381 ), m_penSpeed( 20 ), m_penNumber( 1 )
{
m_plotDrawingSheet = false;
m_params.emplace_back( new JOB_PARAM<wxString>( "color_theme",
&m_colorTheme, m_colorTheme ) );
m_params.emplace_back( new JOB_PARAM<GEN_MODE>( "gen_mode", &m_genMode, m_genMode ) );
m_params.emplace_back( new JOB_PARAM<double>( "default_pen_size",
&m_defaultPenSize, m_defaultPenSize ) );
m_params.emplace_back( new JOB_PARAM<int>( "pen_speed", &m_penSpeed, m_penSpeed ) );
m_params.emplace_back( new JOB_PARAM<int>( "pen_number", &m_penNumber, m_penNumber ) );
}
wxString JOB_EXPORT_PCB_HPGL::GetDefaultDescription() const
{
return wxString::Format( _( "Export HPGL" ) );
}
wxString JOB_EXPORT_PCB_HPGL::GetSettingsDialogTitle() const
{
return wxString::Format( _( "Export HPGL Job Settings" ) );
}
REGISTER_JOB( pcb_export_hpgl, _HKI( "PCB: Export HPGL" ), KIWAY::FACE_PCB, JOB_EXPORT_PCB_HPGL );

51
common/jobs/job_export_pcb_hpgl.h

@ -0,0 +1,51 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 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/>.
*/
#ifndef JOB_EXPORT_PCB_HPGL_H
#define JOB_EXPORT_PCB_HPGL_H
#include <kicommon.h>
#include <kicommon.h>
#include <layer_ids.h>
#include <lseq.h>
#include <wx/string.h>
#include <jobs/job_export_pcb_plot.h>
class KICOMMON_API JOB_EXPORT_PCB_HPGL : public JOB_EXPORT_PCB_PLOT
{
public:
JOB_EXPORT_PCB_HPGL();
wxString GetDefaultDescription() const override;
wxString GetSettingsDialogTitle() const override;
enum class GEN_MODE
{
SINGLE,
MULTI
};
GEN_MODE m_genMode;
double m_defaultPenSize;
int m_penSpeed;
int m_penNumber;
};
#endif

1
kicad/CMakeLists.txt

@ -61,6 +61,7 @@ set( KICAD_CLI_SRCS
cli/command_pcb_export_gerber.cpp
cli/command_pcb_export_gerbers.cpp
cli/command_pcb_export_gencad.cpp
cli/command_pcb_export_hpgl.cpp
cli/command_pcb_export_ipc2581.cpp
cli/command_pcb_export_ipcd356.cpp
cli/command_pcb_export_odb.cpp

168
kicad/cli/command_pcb_export_hpgl.cpp

@ -0,0 +1,168 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 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 <base_units.h>
#include "command_pcb_export_hpgl.h"
#include <cli/exit_codes.h>
#include "jobs/job_export_pcb_hpgl.h"
#include <kiface_base.h>
#include <string_utils.h>
#include <wx/crt.h>
#include <locale_io.h>
#define ARG_MODE_SINGLE "--mode-single"
#define ARG_MODE_MULTI "--mode-multi"
#define ARG_DEFAULT_PEN_SIZE "--default-pen-size"
#define ARG_PEN_NUMBER "--pen-number"
#define ARG_PEN_SPEED "--pen-speed"
CLI::PCB_EXPORT_HPGL_COMMAND::PCB_EXPORT_HPGL_COMMAND() :
PCB_EXPORT_BASE_COMMAND( "hpgl", false, true )
{
m_argParser.add_description( UTF8STDSTR( _( "Generate HPGL from a list of layers" ) ) );
addLayerArg();
addCommonLayersArg();
addDrawingSheetArg();
addDefineArg();
m_argParser.add_argument( "-m", ARG_MIRROR )
.help( UTF8STDSTR( _( "Mirror the board (useful for trying to show bottom layers)" ) ) )
.flag();
m_argParser.add_argument( "--erd", ARG_EXCLUDE_REFDES )
.help( UTF8STDSTR( _( "Exclude the reference designator text" ) ) )
.flag();
m_argParser.add_argument( "--ev", ARG_EXCLUDE_VALUE )
.help( UTF8STDSTR( _( "Exclude the value text" ) ) )
.flag();
m_argParser.add_argument( "--ibt", ARG_INCLUDE_BORDER_TITLE )
.help( UTF8STDSTR( _( "Include the border and title block" ) ) )
.flag();
m_argParser.add_argument( ARG_SUBTRACT_SOLDERMASK )
.help( UTF8STDSTR( _( "Subtract soldermask from silkscreen" ) ) )
.flag();
m_argParser.add_argument( "--sp", ARG_SKETCH_PADS_ON_FAB_LAYERS )
.help( UTF8STDSTR( _( ARG_SKETCH_PADS_ON_FAB_LAYERS_DESC ) ) )
.flag();
m_argParser.add_argument( "--hdnp", ARG_HIDE_DNP_FPS_ON_FAB_LAYERS )
.help( UTF8STDSTR( _( ARG_HIDE_DNP_FPS_ON_FAB_LAYERS_DESC ) ) )
.flag();
m_argParser.add_argument( "--sdnp", ARG_SKETCH_DNP_FPS_ON_FAB_LAYERS )
.help( UTF8STDSTR( _( ARG_SKETCH_DNP_FPS_ON_FAB_LAYERS_DESC ) ) )
.flag();
m_argParser.add_argument( "--cdnp", ARG_CROSSOUT_DNP_FPS_ON_FAB_LAYERS )
.help( UTF8STDSTR( _( ARG_CROSSOUT_DNP_FPS_ON_FAB_LAYERS_DESC ) ) )
.flag();
m_argParser.add_argument( ARG_DRILL_SHAPE_OPTION )
.help( UTF8STDSTR( _( ARG_DRILL_SHAPE_OPTION_DESC ) ) )
.scan<'i', int>()
.default_value( 2 );
m_argParser.add_argument( ARG_MODE_SINGLE )
.help( UTF8STDSTR(
_( "Generates a single file with the output arg path acting as the complete "
"directory and filename path. COMMON_LAYER_LIST does not function in this "
"mode. Instead LAYER_LIST controls all layers plotted." ) ) )
.flag();
m_argParser.add_argument( ARG_MODE_MULTI )
.help( UTF8STDSTR( _( "Generates one or more files with behavior similar to the KiCad "
"GUI plotting. The given output path specifies a directory in "
"which files may be output." ) ) )
.flag();
m_argParser.add_argument( "-P", ARG_DEFAULT_PEN_SIZE )
.help( UTF8STDSTR( _( "Size for the default pen [mm]" ) ) )
.scan<'g', double>()
.default_value( 0.381 )
.metavar( "DEF_SIZE" );
m_argParser.add_argument( "-N", ARG_PEN_NUMBER )
.help( UTF8STDSTR( _( "Pen number selection (1 to 9)" ) ) )
.scan<'d', int>()
.default_value( 1 )
.metavar( "PEN_NUM" );
m_argParser.add_argument( "-S", ARG_PEN_SPEED )
.help( UTF8STDSTR( _( "Pen speed [cm/s] (1 to 99 cm/s)" ) ) )
.scan<'d', int>()
.default_value( 40 )
.metavar( "PEN_SPD" );
}
int CLI::PCB_EXPORT_HPGL_COMMAND::doPerform( KIWAY& aKiway )
{
std::unique_ptr<JOB_EXPORT_PCB_HPGL> hpglJob( new JOB_EXPORT_PCB_HPGL() );
hpglJob->m_filename = m_argInput;
hpglJob->SetConfiguredOutputPath( m_argOutput );
hpglJob->m_drawingSheet = m_argDrawingSheet;
hpglJob->SetVarOverrides( m_argDefineVars );
if( !wxFile::Exists( hpglJob->m_filename ) )
{
wxFprintf( stderr, _( "Board file does not exist or is not accessible\n" ) );
return EXIT_CODES::ERR_INVALID_INPUT_FILE;
}
hpglJob->m_plotFootprintValues = !m_argParser.get<bool>( ARG_EXCLUDE_VALUE );
hpglJob->m_plotRefDes = !m_argParser.get<bool>( ARG_EXCLUDE_REFDES );
hpglJob->m_plotDrawingSheet = m_argParser.get<bool>( ARG_INCLUDE_BORDER_TITLE );
hpglJob->m_subtractSolderMaskFromSilk = m_argParser.get<bool>( ARG_SUBTRACT_SOLDERMASK );
hpglJob->m_mirror = m_argParser.get<bool>( ARG_MIRROR );
// We don't have colors here, we just use a pen, and we don't even know its color
hpglJob->m_blackAndWhite = true;
hpglJob->m_negative = false;
hpglJob->m_sketchPadsOnFabLayers = m_argParser.get<bool>( ARG_SKETCH_PADS_ON_FAB_LAYERS );
hpglJob->m_hideDNPFPsOnFabLayers = m_argParser.get<bool>( ARG_HIDE_DNP_FPS_ON_FAB_LAYERS );
hpglJob->m_sketchDNPFPsOnFabLayers = m_argParser.get<bool>( ARG_SKETCH_DNP_FPS_ON_FAB_LAYERS );
hpglJob->m_crossoutDNPFPsOnFabLayers = m_argParser.get<bool>( ARG_CROSSOUT_DNP_FPS_ON_FAB_LAYERS );
int drillShape = m_argParser.get<int>( ARG_DRILL_SHAPE_OPTION );
hpglJob->m_drillShapeOption = static_cast<DRILL_MARKS>( drillShape );
hpglJob->m_argLayers = From_UTF8( m_argParser.get<std::string>( ARG_LAYERS ).c_str() );
hpglJob->m_argCommonLayers = From_UTF8( m_argParser.get<std::string>( ARG_COMMON_LAYERS ).c_str() );
if( m_argParser.get<bool>( ARG_MODE_MULTI ) )
hpglJob->m_genMode = JOB_EXPORT_PCB_HPGL::GEN_MODE::MULTI;
else if( m_argParser.get<bool>( ARG_MODE_SINGLE ) )
hpglJob->m_genMode = JOB_EXPORT_PCB_HPGL::GEN_MODE::SINGLE;
hpglJob->m_defaultPenSize = m_argParser.get<double>( ARG_DEFAULT_PEN_SIZE );
hpglJob->m_penNumber = m_argParser.get<int>( ARG_PEN_NUMBER );
hpglJob->m_penSpeed = m_argParser.get<int>( ARG_PEN_SPEED );
LOCALE_IO dummy; // Switch to "C" locale
return aKiway.ProcessJob( KIWAY::FACE_PCB, hpglJob.get() );
}

38
kicad/cli/command_pcb_export_hpgl.h

@ -0,0 +1,38 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 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/>.
*/
#ifndef COMMAND_EXPORT_PCB_HPGL_H
#define COMMAND_EXPORT_PCB_HPGL_H
#include "command_pcb_export_base.h"
namespace CLI
{
class PCB_EXPORT_HPGL_COMMAND : public PCB_EXPORT_BASE_COMMAND
{
public:
PCB_EXPORT_HPGL_COMMAND();
protected:
int doPerform( KIWAY& aKiway ) override;
};
} // namespace CLI
#endif

3
kicad/kicad_cli.cpp

@ -57,6 +57,7 @@
#include "cli/command_pcb_export_dxf.h"
#include "cli/command_pcb_export_gerber.h"
#include "cli/command_pcb_export_gerbers.h"
#include "cli/command_pcb_export_hpgl.h"
#include "cli/command_pcb_export_gencad.h"
#include "cli/command_pcb_export_ipc2581.h"
#include "cli/command_pcb_export_ipcd356.h"
@ -131,6 +132,7 @@ static CLI::PCB_EXPORT_POS_COMMAND exportPcbPosCmd{};
static CLI::PCB_EXPORT_PS_COMMAND exportPcbPsCmd{};
static CLI::PCB_EXPORT_GERBER_COMMAND exportPcbGerberCmd{};
static CLI::PCB_EXPORT_GERBERS_COMMAND exportPcbGerbersCmd{};
static CLI::PCB_EXPORT_HPGL_COMMAND exportPcbHpglCmd{};
static CLI::PCB_EXPORT_GENCAD_COMMAND exportPcbGencadCmd{};
static CLI::PCB_EXPORT_IPC2581_COMMAND exportPcbIpc2581Cmd{};
static CLI::PCB_EXPORT_IPCD356_COMMAND exportPcbIpcD356Cmd{};
@ -199,6 +201,7 @@ static std::vector<COMMAND_ENTRY> commandStack = {
&exportPcbDxfCmd,
&exportPcbGerberCmd,
&exportPcbGerbersCmd,
&exportPcbHpglCmd,
&exportPcbGencadCmd,
&exportPcbGlbCmd,
&exportPcbIpc2581Cmd,

12
pcbnew/dialogs/dialog_plot.cpp

@ -47,6 +47,7 @@
#include <math/util.h> // for KiROUND
#include <macros.h>
#include <jobs/job_export_pcb_gerbers.h>
#include <jobs/job_export_pcb_hpgl.h>
#include <jobs/job_export_pcb_dxf.h>
#include <jobs/job_export_pcb_pdf.h>
#include <jobs/job_export_pcb_ps.h>
@ -454,6 +455,15 @@ void DIALOG_PLOT::transferPlotParamsToJob()
gJob->m_useBoardPlotParams = false;
}
if( m_job->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::HPGL )
{
JOB_EXPORT_PCB_HPGL* hpglJob = static_cast<JOB_EXPORT_PCB_HPGL*>( m_job );
hpglJob->m_genMode = JOB_EXPORT_PCB_HPGL::GEN_MODE::MULTI;
hpglJob->m_defaultPenSize = m_plotOpts.GetHPGLPenDiameter() / 1000.0 * 25.4; // mils to mm
hpglJob->m_penNumber = m_plotOpts.GetHPGLPenNum();
hpglJob->m_penSpeed = m_plotOpts.GetHPGLPenSpeed();
}
if( m_job->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::SVG )
{
JOB_EXPORT_PCB_SVG* svgJob = static_cast<JOB_EXPORT_PCB_SVG*>( m_job );
@ -1120,6 +1130,8 @@ void DIALOG_PLOT::applyPlotSettings()
{
tempOptions.SetHPGLPenDiameter( m_plotOpts.GetHPGLPenDiameter() );
}
tempOptions.SetHPGLPenSpeed( m_plotOpts.GetHPGLPenSpeed() );
tempOptions.SetHPGLPenNum( m_plotOpts.GetHPGLPenNum() );
// X scale
double tmpDouble;

9
pcbnew/pcb_plotter.cpp

@ -30,6 +30,7 @@
#include <wx/filename.h>
#include <gerber_jobfile_writer.h>
#include <jobs/job_export_pcb_gerbers.h>
#include <jobs/job_export_pcb_hpgl.h>
#include <jobs/job_export_pcb_dxf.h>
#include <jobs/job_export_pcb_pdf.h>
#include <jobs/job_export_pcb_plot.h>
@ -376,6 +377,14 @@ void PCB_PLOTTER::PlotJobToPlotOpts( PCB_PLOT_PARAMS& aOpts, JOB_EXPORT_PCB_PLOT
aOpts.SetGerberPrecision( gJob->m_precision );
}
if( aJob->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::HPGL )
{
JOB_EXPORT_PCB_HPGL* hpglJob = static_cast<JOB_EXPORT_PCB_HPGL*>( aJob );
aOpts.SetHPGLPenDiameter( hpglJob->m_defaultPenSize / 25.4 * 1000.0 ); // mm to mils
aOpts.SetHPGLPenSpeed( hpglJob->m_penSpeed );
aOpts.SetHPGLPenNum( hpglJob->m_penNumber );
}
if( aJob->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::SVG )
{
JOB_EXPORT_PCB_SVG* svgJob = static_cast<JOB_EXPORT_PCB_SVG*>( aJob );

99
pcbnew/pcbnew_jobs_handler.cpp

@ -33,6 +33,7 @@
#include <jobs/job_export_pcb_odb.h>
#include <jobs/job_export_pcb_gerber.h>
#include <jobs/job_export_pcb_gerbers.h>
#include <jobs/job_export_pcb_hpgl.h>
#include <jobs/job_export_pcb_drill.h>
#include <jobs/job_export_pcb_dxf.h>
#include <jobs/job_export_pcb_gencad.h>
@ -221,6 +222,19 @@ PCBNEW_JOBS_HANDLER::PCBNEW_JOBS_HANDLER( KIWAY* aKiway ) :
DIALOG_PLOT dlg( editFrame, aParent, gJob );
return dlg.ShowModal() == wxID_OK;
} );
Register( "hpgl", std::bind( &PCBNEW_JOBS_HANDLER::JobExportHpgl, this, std::placeholders::_1 ),
[aKiway]( JOB* job, wxWindow* aParent ) -> bool
{
JOB_EXPORT_PCB_HPGL* hpglJob = dynamic_cast<JOB_EXPORT_PCB_HPGL*>( job );
PCB_EDIT_FRAME* editFrame =
dynamic_cast<PCB_EDIT_FRAME*>( aKiway->Player( FRAME_PCB_EDITOR, false ) );
wxCHECK( hpglJob && editFrame, false );
DIALOG_PLOT dlg( editFrame, aParent, hpglJob );
return dlg.ShowModal() == wxID_OK;
} );
Register( "drill",
std::bind( &PCBNEW_JOBS_HANDLER::JobExportDrill, this, std::placeholders::_1 ),
[aKiway]( JOB* job, wxWindow* aParent ) -> bool
@ -1283,6 +1297,91 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
return exitCode;
}
int PCBNEW_JOBS_HANDLER::JobExportHpgl( JOB* aJob )
{
JOB_EXPORT_PCB_HPGL* hpglJob = dynamic_cast<JOB_EXPORT_PCB_HPGL*>( aJob );
if( hpglJob == nullptr )
return CLI::EXIT_CODES::ERR_UNKNOWN;
BOARD* brd = getBoard( hpglJob->m_filename );
if( !brd )
return CLI::EXIT_CODES::ERR_INVALID_INPUT_FILE;
hpglJob->SetTitleBlock( brd->GetTitleBlock() );
loadOverrideDrawingSheet( brd, hpglJob->m_drawingSheet );
brd->GetProject()->ApplyTextVars( hpglJob->GetVarOverrides() );
brd->SynchronizeProperties();
if( hpglJob->m_argLayers )
hpglJob->m_plotLayerSequence = convertLayerArg( hpglJob->m_argLayers.value(), brd );
if( hpglJob->m_argCommonLayers )
hpglJob->m_plotOnAllLayersSequence = convertLayerArg( hpglJob->m_argCommonLayers.value(), brd );
if( hpglJob->m_plotLayerSequence.size() < 1 )
{
m_reporter->Report( _( "At least one layer must be specified\n" ), RPT_SEVERITY_ERROR );
return CLI::EXIT_CODES::ERR_ARGS;
}
bool isSingle = hpglJob->m_genMode == JOB_EXPORT_PCB_HPGL::GEN_MODE::SINGLE;
if( isSingle )
{
if( hpglJob->GetConfiguredOutputPath().IsEmpty() )
{
wxFileName fn = brd->GetFileName();
fn.SetName( fn.GetName() );
fn.SetExt( GetDefaultPlotExtension( PLOT_FORMAT::POST ) );
hpglJob->SetWorkingOutputPath( fn.GetFullName() );
}
}
wxString outPath = hpglJob->GetFullOutputPath( brd->GetProject() );
if( !PATHS::EnsurePathExists( outPath, isSingle ) )
{
m_reporter->Report( _( "Failed to create output directory\n" ), RPT_SEVERITY_ERROR );
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
}
PCB_PLOT_PARAMS plotOpts;
PCB_PLOTTER::PlotJobToPlotOpts( plotOpts, hpglJob, *m_reporter );
PCB_PLOTTER pcbPlotter( brd, m_reporter, plotOpts );
std::optional<wxString> layerName;
std::optional<wxString> sheetName;
std::optional<wxString> sheetPath;
if( isSingle )
{
if( aJob->GetVarOverrides().contains( wxT( "LAYER" ) ) )
layerName = hpglJob->GetVarOverrides().at( wxT( "LAYER" ) );
if( aJob->GetVarOverrides().contains( wxT( "SHEETNAME" ) ) )
sheetName = hpglJob->GetVarOverrides().at( wxT( "SHEETNAME" ) );
if( aJob->GetVarOverrides().contains( wxT( "SHEETPATH" ) ) )
sheetPath = hpglJob->GetVarOverrides().at( wxT( "SHEETPATH" ) );
}
LOCALE_IO dummy;
if( !pcbPlotter.Plot( outPath, hpglJob->m_plotLayerSequence, hpglJob->m_plotOnAllLayersSequence, false, isSingle,
layerName, sheetName, sheetPath ) )
{
return CLI::EXIT_CODES::ERR_UNKNOWN;
}
return CLI::EXIT_CODES::OK;
}
int PCBNEW_JOBS_HANDLER::JobExportGencad( JOB* aJob )
{
JOB_EXPORT_PCB_GENCAD* aGencadJob = dynamic_cast<JOB_EXPORT_PCB_GENCAD*>( aJob );

1
pcbnew/pcbnew_jobs_handler.h

@ -44,6 +44,7 @@ public:
int JobExportPs( JOB* aJob );
int JobExportGerber( JOB* aJob );
int JobExportGerbers( JOB* aJob );
int JobExportHpgl( JOB* aJob );
int JobExportGencad( JOB* aJob );
int JobExportDrill( JOB* aJob );
int JobExportPos( JOB* aJob );

Loading…
Cancel
Save