Try and make the svg command handling warn a little, also default the output
This commit is contained in:
parent
1240a3dd9f
commit
2b8a29b662
|
@ -25,6 +25,7 @@
|
||||||
#include <kiface_base.h>
|
#include <kiface_base.h>
|
||||||
#include <layer_ids.h>
|
#include <layer_ids.h>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
#include <wx/crt.h>
|
||||||
|
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <wx/tokenzr.h>
|
#include <wx/tokenzr.h>
|
||||||
|
@ -80,6 +81,8 @@ int CLI::EXPORT_PCB_SVG_COMMAND::Perform( KIWAY& aKiway ) const
|
||||||
//m_layerIndices[untranslated] = PCB_LAYER_ID( layer );
|
//m_layerIndices[untranslated] = PCB_LAYER_ID( layer );
|
||||||
layerMasks[untranslated] = LSET( PCB_LAYER_ID( layer ) );
|
layerMasks[untranslated] = LSET( PCB_LAYER_ID( layer ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
layerMasks["*"] = LSET::AllLayersMask();
|
||||||
layerMasks["*.Cu"] = LSET::AllCuMask();
|
layerMasks["*.Cu"] = LSET::AllCuMask();
|
||||||
layerMasks["*In.Cu"] = LSET::InternalCuMask();
|
layerMasks["*In.Cu"] = LSET::InternalCuMask();
|
||||||
layerMasks["F&B.Cu"] = LSET( 2, F_Cu, B_Cu );
|
layerMasks["F&B.Cu"] = LSET( 2, F_Cu, B_Cu );
|
||||||
|
@ -100,6 +103,12 @@ int CLI::EXPORT_PCB_SVG_COMMAND::Perform( KIWAY& aKiway ) const
|
||||||
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() );
|
||||||
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( !wxFile::Exists( svgJob->m_filename ) )
|
||||||
|
{
|
||||||
|
wxFprintf( stderr, _( "Board file does not exist or is not accessible\n" ) );
|
||||||
|
return EXIT_CODES::ERR_INVALID_INPUT_FILE;
|
||||||
|
}
|
||||||
|
|
||||||
wxString layers = FROM_UTF8( m_argParser.get<std::string>( ARG_LAYERS ).c_str() );
|
wxString layers = FROM_UTF8( m_argParser.get<std::string>( ARG_LAYERS ).c_str() );
|
||||||
|
|
||||||
LSET layerMask = LSET::AllCuMask();
|
LSET layerMask = LSET::AllCuMask();
|
||||||
|
@ -115,6 +124,10 @@ int CLI::EXPORT_PCB_SVG_COMMAND::Perform( KIWAY& aKiway ) const
|
||||||
{
|
{
|
||||||
layerMask |= layerMasks[token];
|
layerMask |= layerMasks[token];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxFprintf( stderr, _( "Invalid layer option: %s\n" ), token );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
bool PCB_PLOT_SVG::Plot( BOARD* aBoard, const PCB_PLOT_SVG_OPTIONS& aSvgPlotOptions )
|
bool PCB_PLOT_SVG::Plot( BOARD* aBoard, const PCB_PLOT_SVG_OPTIONS& aSvgPlotOptions )
|
||||||
{
|
{
|
||||||
PCB_PLOT_PARAMS plot_opts;
|
PCB_PLOT_PARAMS plot_opts;
|
||||||
|
wxString outputFile = aSvgPlotOptions.m_outputFile;
|
||||||
|
|
||||||
plot_opts.SetPlotFrameRef( aSvgPlotOptions.m_pageSizeMode );
|
plot_opts.SetPlotFrameRef( aSvgPlotOptions.m_pageSizeMode );
|
||||||
|
|
||||||
|
@ -64,6 +65,15 @@ bool PCB_PLOT_SVG::Plot( BOARD* aBoard, const PCB_PLOT_SVG_OPTIONS& aSvgPlotOpti
|
||||||
aBoard->GetDesignSettings().SetAuxOrigin( origin );
|
aBoard->GetDesignSettings().SetAuxOrigin( origin );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( outputFile.IsEmpty() )
|
||||||
|
{
|
||||||
|
wxFileName fn = aBoard->GetFileName();
|
||||||
|
fn.SetName( fn.GetName() );
|
||||||
|
fn.SetExt( wxS("svg") );
|
||||||
|
|
||||||
|
outputFile = fn.GetFullName();
|
||||||
|
}
|
||||||
|
|
||||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||||
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
||||||
|
|
||||||
|
@ -84,8 +94,7 @@ bool PCB_PLOT_SVG::Plot( BOARD* aBoard, const PCB_PLOT_SVG_OPTIONS& aSvgPlotOpti
|
||||||
|
|
||||||
//@todo allow controlling the sheet name and path that will be displayed in the title block
|
//@todo allow controlling the sheet name and path that will be displayed in the title block
|
||||||
// Leave blank for now
|
// Leave blank for now
|
||||||
SVG_PLOTTER* plotter = (SVG_PLOTTER*) StartPlotBoard( aBoard, &plot_opts, UNDEFINED_LAYER,
|
SVG_PLOTTER* plotter = (SVG_PLOTTER*) StartPlotBoard( aBoard, &plot_opts, UNDEFINED_LAYER, outputFile,
|
||||||
aSvgPlotOptions.m_outputFile,
|
|
||||||
wxEmptyString, wxEmptyString );
|
wxEmptyString, wxEmptyString );
|
||||||
|
|
||||||
if( plotter )
|
if( plotter )
|
||||||
|
|
Loading…
Reference in New Issue