kicad-cli, export plot PDF and SVG: add missing option --drill-shape-opt.

It allows pad/via holes to ber plotted at actual size, small size, or not.
This option exists in GUI, but was missing in kicad-cli.
This commit is contained in:
jean-pierre charras 2023-08-05 18:18:18 +02:00
parent 084ec1d669
commit f18feb2a46
7 changed files with 71 additions and 5 deletions

View File

@ -55,6 +55,11 @@ public:
bool m_plotBorderTitleBlocks;
LSET m_printMaskLayer;
// How holes in pads/vias are plotted:
// 0 = no hole, 1 = small shape, 2 = actual shape
// Not used in some plotters (Gerber)
int m_drillShapeOption;
};
#endif

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 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
@ -47,6 +47,11 @@ public:
int m_pageSizeMode;
LSET m_printMaskLayer;
// How holes in pads/vias are plotted:
// 0 = no hole, 1 = small shape, 2 = actual shape
// Not used in some plotters (Gerber)
int m_drillShapeOption;
};
#endif

View File

@ -30,6 +30,8 @@
#include <locale_io.h>
#define ARG_DRILL_SHAPE_OPTION "--drill-shape-opt"
CLI::EXPORT_PCB_PDF_COMMAND::EXPORT_PCB_PDF_COMMAND() : EXPORT_PCB_BASE_COMMAND( "pdf" )
{
@ -68,6 +70,12 @@ CLI::EXPORT_PCB_PDF_COMMAND::EXPORT_PCB_PDF_COMMAND() : EXPORT_PCB_BASE_COMMAND(
m_argParser.add_argument( "-t", ARG_THEME )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Color theme to use (will default to PCB Editor settings)" ) ) );
m_argParser.add_argument( ARG_DRILL_SHAPE_OPTION )
.help( UTF8STDSTR( _( "Set pad/via drill shape option (0 = no shape, 1 = "
"small shape, 2 = actual shape)" ) ) )
.scan<'i', int>()
.default_value( 2 );
}
@ -99,6 +107,8 @@ int CLI::EXPORT_PCB_PDF_COMMAND::doPerform( KIWAY& aKiway )
pdfJob->m_colorTheme = FROM_UTF8( m_argParser.get<std::string>( ARG_THEME ).c_str() );
pdfJob->m_negative = m_argParser.get<bool>( ARG_NEGATIVE );
pdfJob->m_drillShapeOption = m_argParser.get<int>( ARG_DRILL_SHAPE_OPTION );
pdfJob->m_printMaskLayer = m_selectedLayers;
LOCALE_IO dummy; // Switch to "C" locale

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2022 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 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
@ -33,6 +33,7 @@
#define ARG_EXCLUDE_DRAWING_SHEET "--exclude-drawing-sheet"
#define ARG_PAGE_SIZE "--page-size-mode"
#define ARG_DRILL_SHAPE_OPTION "--drill-shape-opt"
CLI::EXPORT_PCB_SVG_COMMAND::EXPORT_PCB_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND( "svg" )
@ -68,6 +69,12 @@ CLI::EXPORT_PCB_SVG_COMMAND::EXPORT_PCB_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND(
.help( UTF8STDSTR( _( "No drawing sheet" ) ) )
.implicit_value( true )
.default_value( false );
m_argParser.add_argument( ARG_DRILL_SHAPE_OPTION )
.help( UTF8STDSTR( _( "Set pad/via drill shape option (0 = no shape, 1 = "
"small shape, 2 = actual shape)" ) ) )
.scan<'i', int>()
.default_value( 2 );
}
@ -83,6 +90,7 @@ int CLI::EXPORT_PCB_SVG_COMMAND::doPerform( KIWAY& aKiway )
svgJob->m_blackAndWhite = m_argParser.get<bool>( ARG_BLACKANDWHITE );
svgJob->m_pageSizeMode = m_argParser.get<int>( ARG_PAGE_SIZE );
svgJob->m_negative = m_argParser.get<bool>( ARG_NEGATIVE );
svgJob->m_drillShapeOption = m_argParser.get<int>( ARG_DRILL_SHAPE_OPTION );
svgJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
svgJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 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
@ -38,7 +38,23 @@ bool PCB_PLOT_SVG::Plot( BOARD* aBoard, const PCB_PLOT_SVG_OPTIONS& aSvgPlotOpti
// Adding drill marks, for copper layers
if( ( aSvgPlotOptions.m_printMaskLayer & LSET::AllCuMask() ).any() )
plot_opts.SetDrillMarksType( DRILL_MARKS::FULL_DRILL_SHAPE );
{
switch( aSvgPlotOptions.m_drillShapeOption )
{
default:
case 0:
plot_opts.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE );
break;
case 1:
plot_opts.SetDrillMarksType( DRILL_MARKS::SMALL_DRILL_SHAPE );
break;
case 2:
plot_opts.SetDrillMarksType( DRILL_MARKS::FULL_DRILL_SHAPE );
break;
}
}
else
plot_opts.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 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
@ -34,6 +34,11 @@ struct PCB_PLOT_SVG_OPTIONS
int m_pageSizeMode;
LSET m_printMaskLayer;
// How holes in pads/vias are plotted:
// 0 = no hole, 1 = small shape, 2 = actual shape
// Not used in some plotters (Gerber)
int m_drillShapeOption;
};
class PCB_PLOT_SVG

View File

@ -135,6 +135,7 @@ int PCBNEW_JOBS_HANDLER::JobExportSvg( JOB* aJob )
svgPlotOptions.m_pageSizeMode = aSvgJob->m_pageSizeMode;
svgPlotOptions.m_printMaskLayer = aSvgJob->m_printMaskLayer;
svgPlotOptions.m_plotFrame = aSvgJob->m_plotDrawingSheet;
svgPlotOptions.m_drillShapeOption = aSvgJob->m_drillShapeOption;
if( aJob->IsCli() )
m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO );
@ -244,6 +245,22 @@ int PCBNEW_JOBS_HANDLER::JobExportPdf( JOB* aJob )
plotOpts.SetBlackAndWhite( aPdfJob->m_blackAndWhite );
plotOpts.SetNegative( aPdfJob->m_negative );
switch( aPdfJob->m_drillShapeOption )
{
default:
case 0:
plotOpts.SetDrillMarksType( DRILL_MARKS::NO_DRILL_SHAPE );
break;
case 1:
plotOpts.SetDrillMarksType( DRILL_MARKS::SMALL_DRILL_SHAPE );
break;
case 2:
plotOpts.SetDrillMarksType( DRILL_MARKS::FULL_DRILL_SHAPE );
break;
}
PDF_PLOTTER* plotter = (PDF_PLOTTER*) StartPlotBoard(
brd, &plotOpts, UNDEFINED_LAYER, aPdfJob->m_outputFile, wxEmptyString, wxEmptyString );