cli: add an option to the pcb exports for plotting negative svg and pdf
ADDED: The -n or --negative option for exporting negative svg or pdf plots from kicad-cli. Example usage: kicad-cli pcb export svg -n -l B.Cu board.kicad_pcb
This commit is contained in:
parent
47c0c7b3b7
commit
518741c52a
|
@ -34,6 +34,7 @@ public:
|
||||||
m_outputFile(),
|
m_outputFile(),
|
||||||
m_colorTheme(),
|
m_colorTheme(),
|
||||||
m_blackAndWhite( false ),
|
m_blackAndWhite( false ),
|
||||||
|
m_negative( false ),
|
||||||
m_plotFootprintValues( true ),
|
m_plotFootprintValues( true ),
|
||||||
m_plotRefDes( true ),
|
m_plotRefDes( true ),
|
||||||
m_plotBorderTitleBlocks( false ),
|
m_plotBorderTitleBlocks( false ),
|
||||||
|
@ -46,6 +47,7 @@ public:
|
||||||
wxString m_colorTheme;
|
wxString m_colorTheme;
|
||||||
|
|
||||||
bool m_blackAndWhite;
|
bool m_blackAndWhite;
|
||||||
|
bool m_negative;
|
||||||
bool m_plotFootprintValues;
|
bool m_plotFootprintValues;
|
||||||
bool m_plotRefDes;
|
bool m_plotRefDes;
|
||||||
bool m_plotBorderTitleBlocks;
|
bool m_plotBorderTitleBlocks;
|
||||||
|
@ -53,4 +55,4 @@ public:
|
||||||
LSET m_printMaskLayer;
|
LSET m_printMaskLayer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,8 @@ class JOB_EXPORT_PCB_SVG : public JOB
|
||||||
public:
|
public:
|
||||||
JOB_EXPORT_PCB_SVG( bool aIsCli ) :
|
JOB_EXPORT_PCB_SVG( bool aIsCli ) :
|
||||||
JOB( "svg", aIsCli ), m_filename(), m_outputFile(), m_colorTheme(), m_mirror( false ),
|
JOB( "svg", aIsCli ), m_filename(), m_outputFile(), m_colorTheme(), m_mirror( false ),
|
||||||
m_blackAndWhite( false ), m_plotDrawingSheet( true ), m_pageSizeMode( 0 ), m_printMaskLayer()
|
m_blackAndWhite( false ), m_negative( false ), m_plotDrawingSheet( true ),
|
||||||
|
m_pageSizeMode( 0 ), m_printMaskLayer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +41,7 @@ public:
|
||||||
|
|
||||||
bool m_mirror;
|
bool m_mirror;
|
||||||
bool m_blackAndWhite;
|
bool m_blackAndWhite;
|
||||||
|
bool m_negative;
|
||||||
|
|
||||||
bool m_plotDrawingSheet;
|
bool m_plotDrawingSheet;
|
||||||
int m_pageSizeMode;
|
int m_pageSizeMode;
|
||||||
|
|
|
@ -32,6 +32,10 @@ namespace CLI
|
||||||
#define ARG_BLACKANDWHITE "--black-and-white"
|
#define ARG_BLACKANDWHITE "--black-and-white"
|
||||||
#define ARG_BLACKANDWHITE_DESC "Black and white only"
|
#define ARG_BLACKANDWHITE_DESC "Black and white only"
|
||||||
|
|
||||||
|
#define ARG_NEGATIVE "--negative"
|
||||||
|
#define ARG_NEGATIVE_SHORT "-n"
|
||||||
|
#define ARG_NEGATIVE_DESC "Plot as negative (useful for directly etching from the export)"
|
||||||
|
|
||||||
#define ARG_LAYERS "--layers"
|
#define ARG_LAYERS "--layers"
|
||||||
#define ARG_EXCLUDE_REFDES "--exclude-refdes"
|
#define ARG_EXCLUDE_REFDES "--exclude-refdes"
|
||||||
#define ARG_EXCLUDE_VALUE "--exclude-value"
|
#define ARG_EXCLUDE_VALUE "--exclude-value"
|
||||||
|
@ -61,4 +65,4 @@ protected:
|
||||||
};
|
};
|
||||||
} // namespace CLI
|
} // namespace CLI
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -50,6 +50,11 @@ CLI::EXPORT_PCB_PDF_COMMAND::EXPORT_PCB_PDF_COMMAND() : EXPORT_PCB_BASE_COMMAND(
|
||||||
.implicit_value( true )
|
.implicit_value( true )
|
||||||
.default_value( false );
|
.default_value( false );
|
||||||
|
|
||||||
|
m_argParser.add_argument( ARG_NEGATIVE_SHORT, ARG_NEGATIVE )
|
||||||
|
.help( UTF8STDSTR( _( ARG_NEGATIVE_DESC ) ) )
|
||||||
|
.implicit_value( true )
|
||||||
|
.default_value( false );
|
||||||
|
|
||||||
m_argParser.add_argument( ARG_BLACKANDWHITE )
|
m_argParser.add_argument( ARG_BLACKANDWHITE )
|
||||||
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )
|
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )
|
||||||
.implicit_value( true )
|
.implicit_value( true )
|
||||||
|
@ -86,6 +91,7 @@ int CLI::EXPORT_PCB_PDF_COMMAND::doPerform( KIWAY& aKiway )
|
||||||
|
|
||||||
pdfJob->m_blackAndWhite = m_argParser.get<bool>( ARG_BLACKANDWHITE );
|
pdfJob->m_blackAndWhite = m_argParser.get<bool>( ARG_BLACKANDWHITE );
|
||||||
pdfJob->m_colorTheme = FROM_UTF8( m_argParser.get<std::string>( ARG_THEME ).c_str() );
|
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_printMaskLayer = m_selectedLayers;
|
pdfJob->m_printMaskLayer = m_selectedLayers;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "command_export_pcb_svg.h"
|
#include "command_export_pcb_svg.h"
|
||||||
#include <cli/exit_codes.h>
|
#include <cli/exit_codes.h>
|
||||||
|
#include "command_export_pcb_base.h"
|
||||||
#include "jobs/job_export_pcb_svg.h"
|
#include "jobs/job_export_pcb_svg.h"
|
||||||
#include <kiface_base.h>
|
#include <kiface_base.h>
|
||||||
#include <layer_ids.h>
|
#include <layer_ids.h>
|
||||||
|
@ -48,6 +49,11 @@ CLI::EXPORT_PCB_SVG_COMMAND::EXPORT_PCB_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND(
|
||||||
.default_value( std::string() )
|
.default_value( std::string() )
|
||||||
.help( UTF8STDSTR( _( "Color theme to use (will default to pcbnew settings)" ) ) );
|
.help( UTF8STDSTR( _( "Color theme to use (will default to pcbnew settings)" ) ) );
|
||||||
|
|
||||||
|
m_argParser.add_argument( ARG_NEGATIVE_SHORT, ARG_NEGATIVE )
|
||||||
|
.help( UTF8STDSTR( _( ARG_NEGATIVE_DESC ) ) )
|
||||||
|
.implicit_value( true )
|
||||||
|
.default_value( false );
|
||||||
|
|
||||||
m_argParser.add_argument( ARG_BLACKANDWHITE )
|
m_argParser.add_argument( ARG_BLACKANDWHITE )
|
||||||
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )
|
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )
|
||||||
.implicit_value( true )
|
.implicit_value( true )
|
||||||
|
@ -77,6 +83,7 @@ int CLI::EXPORT_PCB_SVG_COMMAND::doPerform( KIWAY& aKiway )
|
||||||
svgJob->m_mirror = m_argParser.get<bool>( ARG_MIRROR );
|
svgJob->m_mirror = m_argParser.get<bool>( ARG_MIRROR );
|
||||||
svgJob->m_blackAndWhite = m_argParser.get<bool>( ARG_BLACKANDWHITE );
|
svgJob->m_blackAndWhite = m_argParser.get<bool>( ARG_BLACKANDWHITE );
|
||||||
svgJob->m_pageSizeMode = m_argParser.get<int>( ARG_PAGE_SIZE );
|
svgJob->m_pageSizeMode = m_argParser.get<int>( ARG_PAGE_SIZE );
|
||||||
|
svgJob->m_negative = m_argParser.get<bool>( ARG_NEGATIVE );
|
||||||
|
|
||||||
svgJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
|
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() );
|
svgJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
|
||||||
|
|
|
@ -45,6 +45,7 @@ bool PCB_PLOT_SVG::Plot( BOARD* aBoard, const PCB_PLOT_SVG_OPTIONS& aSvgPlotOpti
|
||||||
plot_opts.SetSkipPlotNPTH_Pads( false );
|
plot_opts.SetSkipPlotNPTH_Pads( false );
|
||||||
|
|
||||||
plot_opts.SetMirror( aSvgPlotOptions.m_mirror );
|
plot_opts.SetMirror( aSvgPlotOptions.m_mirror );
|
||||||
|
plot_opts.SetNegative( aSvgPlotOptions.m_negative );
|
||||||
plot_opts.SetFormat( PLOT_FORMAT::SVG );
|
plot_opts.SetFormat( PLOT_FORMAT::SVG );
|
||||||
// coord format: 4 digits in mantissa (units always in mm). This is a good choice.
|
// coord format: 4 digits in mantissa (units always in mm). This is a good choice.
|
||||||
plot_opts.SetSvgPrecision( 4 );
|
plot_opts.SetSvgPrecision( 4 );
|
||||||
|
|
|
@ -29,6 +29,7 @@ struct PCB_PLOT_SVG_OPTIONS
|
||||||
bool m_mirror;
|
bool m_mirror;
|
||||||
bool m_blackAndWhite;
|
bool m_blackAndWhite;
|
||||||
bool m_plotFrame;
|
bool m_plotFrame;
|
||||||
|
bool m_negative;
|
||||||
|
|
||||||
int m_pageSizeMode;
|
int m_pageSizeMode;
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,7 @@ int PCBNEW_JOBS_HANDLER::JobExportSvg( JOB* aJob )
|
||||||
svgPlotOptions.m_colorTheme = aSvgJob->m_colorTheme;
|
svgPlotOptions.m_colorTheme = aSvgJob->m_colorTheme;
|
||||||
svgPlotOptions.m_outputFile = aSvgJob->m_outputFile;
|
svgPlotOptions.m_outputFile = aSvgJob->m_outputFile;
|
||||||
svgPlotOptions.m_mirror = aSvgJob->m_mirror;
|
svgPlotOptions.m_mirror = aSvgJob->m_mirror;
|
||||||
|
svgPlotOptions.m_negative = aSvgJob->m_negative;
|
||||||
svgPlotOptions.m_pageSizeMode = aSvgJob->m_pageSizeMode;
|
svgPlotOptions.m_pageSizeMode = aSvgJob->m_pageSizeMode;
|
||||||
svgPlotOptions.m_printMaskLayer = aSvgJob->m_printMaskLayer;
|
svgPlotOptions.m_printMaskLayer = aSvgJob->m_printMaskLayer;
|
||||||
svgPlotOptions.m_plotFrame = aSvgJob->m_plotDrawingSheet;
|
svgPlotOptions.m_plotFrame = aSvgJob->m_plotDrawingSheet;
|
||||||
|
@ -240,6 +241,7 @@ int PCBNEW_JOBS_HANDLER::JobExportPdf( JOB* aJob )
|
||||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||||
plotOpts.SetColorSettings( mgr.GetColorSettings( aPdfJob->m_colorTheme ) );
|
plotOpts.SetColorSettings( mgr.GetColorSettings( aPdfJob->m_colorTheme ) );
|
||||||
plotOpts.SetBlackAndWhite( aPdfJob->m_blackAndWhite );
|
plotOpts.SetBlackAndWhite( aPdfJob->m_blackAndWhite );
|
||||||
|
plotOpts.SetNegative( aPdfJob->m_negative );
|
||||||
|
|
||||||
PDF_PLOTTER* plotter = (PDF_PLOTTER*) StartPlotBoard(
|
PDF_PLOTTER* plotter = (PDF_PLOTTER*) StartPlotBoard(
|
||||||
brd, &plotOpts, UNDEFINED_LAYER, aPdfJob->m_outputFile, wxEmptyString, wxEmptyString );
|
brd, &plotOpts, UNDEFINED_LAYER, aPdfJob->m_outputFile, wxEmptyString, wxEmptyString );
|
||||||
|
@ -811,4 +813,4 @@ REPORTER& PCBNEW_JOBS_HANDLER::Report( const wxString& aText, SEVERITY aSeverity
|
||||||
wxPrintf( wxS( "%s\n" ), aText );
|
wxPrintf( wxS( "%s\n" ), aText );
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue