Enable layer arg for fp export svg

This commit is contained in:
Marek Roszko 2023-01-27 23:45:35 -05:00
parent b4994a7fa1
commit 4d811ba975
3 changed files with 13 additions and 1 deletions

View File

@ -44,6 +44,7 @@ public:
wxString m_colorTheme; wxString m_colorTheme;
bool m_blackAndWhite; bool m_blackAndWhite;
LSET m_printMaskLayer;
}; };
#endif #endif

View File

@ -33,6 +33,8 @@
CLI::FP_EXPORT_SVG_COMMAND::FP_EXPORT_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND( "svg" ) CLI::FP_EXPORT_SVG_COMMAND::FP_EXPORT_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND( "svg" )
{ {
addLayerArg( false );
m_argParser.add_argument( "-t", ARG_THEME ) m_argParser.add_argument( "-t", ARG_THEME )
.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)" ) ) );
@ -50,6 +52,10 @@ CLI::FP_EXPORT_SVG_COMMAND::FP_EXPORT_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND( "
int CLI::FP_EXPORT_SVG_COMMAND::doPerform( KIWAY& aKiway ) int CLI::FP_EXPORT_SVG_COMMAND::doPerform( KIWAY& aKiway )
{ {
int baseExit = EXPORT_PCB_BASE_COMMAND::doPerform( aKiway );
if( baseExit != EXIT_CODES::OK )
return baseExit;
std::unique_ptr<JOB_FP_EXPORT_SVG> svgJob = std::make_unique<JOB_FP_EXPORT_SVG>( true ); std::unique_ptr<JOB_FP_EXPORT_SVG> svgJob = std::make_unique<JOB_FP_EXPORT_SVG>( true );
svgJob->m_libraryPath = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() ); svgJob->m_libraryPath = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
@ -65,6 +71,11 @@ int CLI::FP_EXPORT_SVG_COMMAND::doPerform( KIWAY& aKiway )
svgJob->m_colorTheme = FROM_UTF8( m_argParser.get<std::string>( ARG_THEME ).c_str() ); svgJob->m_colorTheme = FROM_UTF8( m_argParser.get<std::string>( ARG_THEME ).c_str() );
if( m_selectedLayers.count() > 0 )
svgJob->m_printMaskLayer = m_selectedLayers;
else
svgJob->m_printMaskLayer = LSET::AllLayersMask();
int exitCode = aKiway.ProcessJob( KIWAY::FACE_PCB, svgJob.get() ); int exitCode = aKiway.ProcessJob( KIWAY::FACE_PCB, svgJob.get() );
return exitCode; return exitCode;

View File

@ -749,7 +749,7 @@ int PCBNEW_JOBS_HANDLER::doFpExportSvg( JOB_FP_EXPORT_SVG* aSvgJob, const FOOTPR
svgPlotOptions.m_outputFile = outputFile.GetFullPath(); svgPlotOptions.m_outputFile = outputFile.GetFullPath();
svgPlotOptions.m_mirror = false; svgPlotOptions.m_mirror = false;
svgPlotOptions.m_pageSizeMode = 2; // board bounding box svgPlotOptions.m_pageSizeMode = 2; // board bounding box
svgPlotOptions.m_printMaskLayer = LSET::AllLayersMask(); svgPlotOptions.m_printMaskLayer = aSvgJob->m_printMaskLayer;
svgPlotOptions.m_plotFrame = false; svgPlotOptions.m_plotFrame = false;
if( !PCB_PLOT_SVG::Plot( brd.get(), svgPlotOptions ) ) if( !PCB_PLOT_SVG::Plot( brd.get(), svgPlotOptions ) )