From c2c987f9c08ca0e17720c7212e077546b1f8669c Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Thu, 8 May 2025 08:48:01 -0300 Subject: [PATCH] Always use PCB_PLOTTER::PlotJobToPlotOpts for plotter exports Removes PCBNEW_JOBS_HANDLER::populateGerberPlotOptionsFromJob --- pcbnew/pcb_plotter.cpp | 18 +++++++++-------- pcbnew/pcbnew_jobs_handler.cpp | 36 ++-------------------------------- 2 files changed, 12 insertions(+), 42 deletions(-) diff --git a/pcbnew/pcb_plotter.cpp b/pcbnew/pcb_plotter.cpp index 3aecef7145..95fe6f8331 100644 --- a/pcbnew/pcb_plotter.cpp +++ b/pcbnew/pcb_plotter.cpp @@ -381,6 +381,8 @@ void PCB_PLOTTER::PlotJobToPlotOpts( PCB_PLOT_PARAMS& aOpts, JOB_EXPORT_PCB_PLOT aOpts.SetIncludeGerberNetlistInfo( gJob->m_includeNetlistAttributes ); aOpts.SetCreateGerberJobFile( gJob->m_createJobsFile ); aOpts.SetGerberPrecision( gJob->m_precision ); + // Always disable plot pad holes + aOpts.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE ); } else { @@ -388,6 +390,14 @@ void PCB_PLOTTER::PlotJobToPlotOpts( PCB_PLOT_PARAMS& aOpts, JOB_EXPORT_PCB_PLOT aOpts.SetScale( aJob->m_scale ); aOpts.SetAutoScale( !aJob->m_scale ); aOpts.SetScaleSelection( scaleToSelection( aJob->m_scale ) ); + // Drill marks doesn't apply to GERBER + switch( aJob->m_drillShapeOption ) + { + case DRILL_MARKS::NO_DRILL_SHAPE: aOpts.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE ); break; + case DRILL_MARKS::SMALL_DRILL_SHAPE: aOpts.SetDrillMarksType( DRILL_MARKS::SMALL_DRILL_SHAPE ); break; + default: + case DRILL_MARKS::FULL_DRILL_SHAPE: aOpts.SetDrillMarksType( DRILL_MARKS::FULL_DRILL_SHAPE ); break; + } } if( aJob->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::SVG ) @@ -454,14 +464,6 @@ void PCB_PLOTTER::PlotJobToPlotOpts( PCB_PLOT_PARAMS& aOpts, JOB_EXPORT_PCB_PLOT case JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::PDF: aOpts.SetFormat( PLOT_FORMAT::PDF ); break; } - switch( aJob->m_drillShapeOption ) - { - case DRILL_MARKS::NO_DRILL_SHAPE: aOpts.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE ); break; - case DRILL_MARKS::SMALL_DRILL_SHAPE: aOpts.SetDrillMarksType( DRILL_MARKS::SMALL_DRILL_SHAPE ); break; - default: - case DRILL_MARKS::FULL_DRILL_SHAPE: aOpts.SetDrillMarksType( DRILL_MARKS::FULL_DRILL_SHAPE ); break; - } - SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); wxString theme = aJob->m_colorTheme; diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp index 13f9d476b0..ae31face32 100644 --- a/pcbnew/pcbnew_jobs_handler.cpp +++ b/pcbnew/pcbnew_jobs_handler.cpp @@ -1245,7 +1245,7 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob ) if( aGerberJob->m_useBoardPlotParams ) plotOpts = boardPlotOptions; else - populateGerberPlotOptionsFromJob( plotOpts, aGerberJob ); + PCB_PLOTTER::PlotJobToPlotOpts( plotOpts, aGerberJob, *m_reporter ); if( plotOpts.GetUseGerberProtelExtensions() ) fileExt = GetGerberProtelExtension( layer ); @@ -1362,38 +1362,6 @@ int PCBNEW_JOBS_HANDLER::JobExportGencad( JOB* aJob ) } -void PCBNEW_JOBS_HANDLER::populateGerberPlotOptionsFromJob( PCB_PLOT_PARAMS& aPlotOpts, - JOB_EXPORT_PCB_GERBER* aJob ) -{ - aPlotOpts.SetFormat( PLOT_FORMAT::GERBER ); - - aPlotOpts.SetPlotFrameRef( aJob->m_plotDrawingSheet ); - aPlotOpts.SetPlotValue( aJob->m_plotFootprintValues ); - aPlotOpts.SetPlotReference( aJob->m_plotRefDes ); - - aPlotOpts.SetSubtractMaskFromSilk( aJob->m_subtractSolderMaskFromSilk ); - - // Always disable plot pad holes - aPlotOpts.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE ); - - aPlotOpts.SetDisableGerberMacros( aJob->m_disableApertureMacros ); - aPlotOpts.SetUseGerberX2format( aJob->m_useX2Format ); - aPlotOpts.SetIncludeGerberNetlistInfo( aJob->m_includeNetlistAttributes ); - aPlotOpts.SetUseAuxOrigin( aJob->m_useDrillOrigin ); - aPlotOpts.SetUseGerberProtelExtensions( aJob->m_useProtelFileExtension ); - aPlotOpts.SetGerberPrecision( aJob->m_precision ); -} - - -void PCBNEW_JOBS_HANDLER::populateGerberPlotOptionsFromJob( PCB_PLOT_PARAMS& aPlotOpts, - JOB_EXPORT_PCB_GERBERS* aJob ) -{ - populateGerberPlotOptionsFromJob( aPlotOpts, static_cast( aJob ) ); - - aPlotOpts.SetCreateGerberJobFile( aJob->m_createJobsFile ); -} - - int PCBNEW_JOBS_HANDLER::JobExportGerber( JOB* aJob ) { int exitCode = CLI::EXIT_CODES::OK; @@ -1433,7 +1401,7 @@ int PCBNEW_JOBS_HANDLER::JobExportGerber( JOB* aJob ) } PCB_PLOT_PARAMS plotOpts; - populateGerberPlotOptionsFromJob( plotOpts, aGerberJob ); + PCB_PLOTTER::PlotJobToPlotOpts( plotOpts, aGerberJob, *m_reporter ); plotOpts.SetLayerSelection( aGerberJob->m_plotLayerSequence ); plotOpts.SetPlotOnAllLayersSequence( aGerberJob->m_plotOnAllLayersSequence );