diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp index 860d316a3e..737e0e8742 100644 --- a/pcbnew/pcbnew_jobs_handler.cpp +++ b/pcbnew/pcbnew_jobs_handler.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include "pcbnew_scripting_helpers.h" @@ -262,7 +263,8 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob ) BOARD* brd = LoadBoard( aGerberJob->m_filename ); PCB_PLOT_PARAMS boardPlotOptions = brd->GetPlotOptions(); - LSET plotOnAllLayersSelection = boardPlotOptions.GetPlotOnAllLayersSelection(); + LSET plotOnAllLayersSelection = boardPlotOptions.GetPlotOnAllLayersSelection(); + GERBER_JOBFILE_WRITER jobfile_writer( brd ); wxString fileExt; @@ -313,9 +315,11 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob ) BuildPlotFileName( &fn, aGerberJob->m_outputFile, brd->GetLayerName( layer ), fileExt ); wxString fullname = fn.GetFullName(); + jobfile_writer.AddGbrFile( layer, fullname ); + // We are feeding it one layer at the start here to silence a logic check GERBER_PLOTTER* plotter = (GERBER_PLOTTER*) StartPlotBoard( - brd, &plotOpts, layer, fullname, wxEmptyString, wxEmptyString ); + brd, &plotOpts, layer, fn.GetFullPath(), wxEmptyString, wxEmptyString ); if( plotter ) { @@ -327,6 +331,11 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob ) delete plotter; } + wxFileName fn( aGerberJob->m_filename ); + // Build gerber job file from basename + BuildPlotFileName( &fn, aGerberJob->m_outputFile, wxT( "job" ), GerberJobFileExtension ); + jobfile_writer.CreateJobFile( fn.GetFullPath() ); + return CLI::EXIT_CODES::OK; }