diff --git a/common/jobs/job_export_sch_bom.h b/common/jobs/job_export_sch_pythonbom.h
similarity index 79%
rename from common/jobs/job_export_sch_bom.h
rename to common/jobs/job_export_sch_pythonbom.h
index f1d3bb1064..c280e32444 100644
--- a/common/jobs/job_export_sch_bom.h
+++ b/common/jobs/job_export_sch_pythonbom.h
@@ -18,32 +18,24 @@
* with this program. If not, see .
*/
-#ifndef JOB_EXPORT_SCH_BOM_H
-#define JOB_EXPORT_SCH_BOM_H
+#ifndef JOB_EXPORT_SCH_PYTHONBOM_H
+#define JOB_EXPORT_SCH_PYTHONBOM_H
#include
#include "job.h"
-class JOB_EXPORT_SCH_BOM : public JOB
+class JOB_EXPORT_SCH_PYTHONBOM : public JOB
{
public:
- JOB_EXPORT_SCH_BOM( bool aIsCli ) :
- JOB( "bom", aIsCli ),
+ JOB_EXPORT_SCH_PYTHONBOM( bool aIsCli ) :
+ JOB( "pythonbom", aIsCli ),
m_filename(),
m_outputFile()
{
- format = FORMAT::XML;
}
wxString m_filename;
wxString m_outputFile;
-
- enum class FORMAT
- {
- XML
- };
-
- FORMAT format;
};
#endif
\ No newline at end of file
diff --git a/eeschema/eeschema_jobs_handler.cpp b/eeschema/eeschema_jobs_handler.cpp
index 3f56c95763..15a1830c4e 100644
--- a/eeschema/eeschema_jobs_handler.cpp
+++ b/eeschema/eeschema_jobs_handler.cpp
@@ -20,7 +20,7 @@
#include "eeschema_jobs_handler.h"
#include
-#include
+#include
#include
#include
#include
@@ -53,8 +53,8 @@
EESCHEMA_JOBS_HANDLER::EESCHEMA_JOBS_HANDLER()
{
- Register( "bom",
- std::bind( &EESCHEMA_JOBS_HANDLER::JobExportBom, this, std::placeholders::_1 ) );
+ Register( "pythonbom",
+ std::bind( &EESCHEMA_JOBS_HANDLER::JobExportPythonBom, this, std::placeholders::_1 ) );
Register( "netlist",
std::bind( &EESCHEMA_JOBS_HANDLER::JobExportNetlist, this, std::placeholders::_1 ) );
Register( "pdf",
@@ -261,9 +261,9 @@ int EESCHEMA_JOBS_HANDLER::JobExportNetlist( JOB* aJob )
}
-int EESCHEMA_JOBS_HANDLER::JobExportBom( JOB* aJob )
+int EESCHEMA_JOBS_HANDLER::JobExportPythonBom( JOB* aJob )
{
- JOB_EXPORT_SCH_BOM* aNetJob = dynamic_cast( aJob );
+ JOB_EXPORT_SCH_PYTHONBOM* aNetJob = dynamic_cast( aJob );
SCHEMATIC* sch = EESCHEMA_HELPERS::LoadSchematic( aNetJob->m_filename, SCH_IO_MGR::SCH_KICAD );
@@ -297,33 +297,28 @@ int EESCHEMA_JOBS_HANDLER::JobExportBom( JOB* aJob )
wxPrintf( _( "Warning: duplicate sheet names.\n" ) );
}
- if( aNetJob->format == JOB_EXPORT_SCH_BOM::FORMAT::XML )
+ std::unique_ptr xmlNetlist =
+ std::make_unique( sch );
+
+ wxString fileExt = wxS( "xml" );
+
+ if( aNetJob->m_outputFile.IsEmpty() )
{
- std::unique_ptr xmlNetlist =
- std::make_unique( sch );
+ wxFileName fn = sch->GetFileName();
+ fn.SetName( fn.GetName() + "-bom" );
+ fn.SetExt( fileExt );
- wxString fileExt = wxS( "xml" );
-
- if( aNetJob->m_outputFile.IsEmpty() )
- {
- wxFileName fn = sch->GetFileName();
- fn.SetName( fn.GetName() + "-bom" );
- fn.SetExt( fileExt );
-
- aNetJob->m_outputFile = fn.GetFullName();
- }
-
- bool res = xmlNetlist->WriteNetlist( aNetJob->m_outputFile, GNL_OPT_BOM, *this );
-
- if( !res )
- {
- return CLI::EXIT_CODES::ERR_UNKNOWN;
- }
-
- return CLI::EXIT_CODES::OK;
+ aNetJob->m_outputFile = fn.GetFullName();
}
- return CLI::EXIT_CODES::ERR_UNKNOWN;
+ bool res = xmlNetlist->WriteNetlist( aNetJob->m_outputFile, GNL_OPT_BOM, *this );
+
+ if( !res )
+ {
+ return CLI::EXIT_CODES::ERR_UNKNOWN;
+ }
+
+ return CLI::EXIT_CODES::OK;
}
diff --git a/eeschema/eeschema_jobs_handler.h b/eeschema/eeschema_jobs_handler.h
index 6e2b273364..a06e853139 100644
--- a/eeschema/eeschema_jobs_handler.h
+++ b/eeschema/eeschema_jobs_handler.h
@@ -39,7 +39,7 @@ class EESCHEMA_JOBS_HANDLER : public JOB_DISPATCHER, REPORTER
{
public:
EESCHEMA_JOBS_HANDLER();
- int JobExportBom( JOB* aJob );
+ int JobExportPythonBom( JOB* aJob );
int JobExportNetlist( JOB* aJob );
int JobExportPdf( JOB* aJob );
int JobExportSvg( JOB* aJob );
diff --git a/eeschema/netlist_exporters/netlist_exporter_xml.cpp b/eeschema/netlist_exporters/netlist_exporter_xml.cpp
index 7add2b0aa7..685ee24e56 100644
--- a/eeschema/netlist_exporters/netlist_exporter_xml.cpp
+++ b/eeschema/netlist_exporters/netlist_exporter_xml.cpp
@@ -54,15 +54,7 @@ bool NETLIST_EXPORTER_XML::WriteNetlist( const wxString& aOutFileName, unsigned
return false;
wxXmlDocument xdoc;
-
- unsigned aCtl = aNetlistOptions;
-
- if( aNetlistOptions & GNL_OPT_BOM )
- aCtl |= ( GNL_SYMBOLS | GNL_HEADER | GNL_PARTS );
- else
- aCtl |= GNL_ALL;
-
- xdoc.SetRoot( makeRoot( aCtl ) );
+ xdoc.SetRoot( makeRoot( GNL_ALL | aNetlistOptions ) );
return xdoc.Save( stream, 2 /* indent bug, today was ignored by wxXml lib */ );
}
diff --git a/kicad/CMakeLists.txt b/kicad/CMakeLists.txt
index 1115eec15d..e0fa180ff1 100644
--- a/kicad/CMakeLists.txt
+++ b/kicad/CMakeLists.txt
@@ -27,7 +27,7 @@ set( KICAD_SRCS
cli/command_export_pcb_svg.cpp
cli/command_fp_upgrade.cpp
cli/command_pcb_export.cpp
- cli/command_export_sch_bom.cpp
+ cli/command_export_sch_pythonbom.cpp
cli/command_export_sch_netlist.cpp
cli/command_export_sch_pdf.cpp
cli/command_export_sch_svg.cpp
diff --git a/kicad/cli/command_export_sch_bom.cpp b/kicad/cli/command_export_sch_pythonbom.cpp
similarity index 64%
rename from kicad/cli/command_export_sch_bom.cpp
rename to kicad/cli/command_export_sch_pythonbom.cpp
index c399b61415..6bc8295d33 100644
--- a/kicad/cli/command_export_sch_bom.cpp
+++ b/kicad/cli/command_export_sch_pythonbom.cpp
@@ -18,29 +18,26 @@
* with this program. If not, see .
*/
-#include "command_export_sch_bom.h"
+#include "command_export_sch_pythonbom.h"
#include
-#include "jobs/job_export_sch_bom.h"
+#include "jobs/job_export_sch_pythonbom.h"
#include
#include
#include
#include
-#define ARG_FORMAT "--format"
-CLI::EXPORT_SCH_BOM_COMMAND::EXPORT_SCH_BOM_COMMAND() : EXPORT_PCB_BASE_COMMAND( "bom" )
+CLI::EXPORT_SCH_PYTHONBOM_COMMAND::EXPORT_SCH_PYTHONBOM_COMMAND() :
+ EXPORT_PCB_BASE_COMMAND( "python-bom" )
{
- m_argParser.add_argument( ARG_FORMAT )
- .default_value( std::string( "xml" ) )
- .help( UTF8STDSTR( _( "Bom output format, valid options: xml" ) ) );
}
-int CLI::EXPORT_SCH_BOM_COMMAND::Perform( KIWAY& aKiway )
+int CLI::EXPORT_SCH_PYTHONBOM_COMMAND::Perform( KIWAY& aKiway )
{
- std::unique_ptr bomJob =
- std::make_unique( true );
+ std::unique_ptr bomJob =
+ std::make_unique( true );
bomJob->m_filename = FROM_UTF8( m_argParser.get( ARG_INPUT ).c_str() );
bomJob->m_outputFile = FROM_UTF8( m_argParser.get( ARG_OUTPUT ).c_str() );
@@ -51,16 +48,6 @@ int CLI::EXPORT_SCH_BOM_COMMAND::Perform( KIWAY& aKiway )
return EXIT_CODES::ERR_INVALID_INPUT_FILE;
}
- wxString format = FROM_UTF8( m_argParser.get( ARG_FORMAT ).c_str() );
- if( format == "xml" )
- {
- bomJob->format = JOB_EXPORT_SCH_BOM::FORMAT::XML;
- }
- else
- {
- wxFprintf( stderr, _( "Invalid format\n" ) );
- return EXIT_CODES::ERR_ARGS;
- }
int exitCode = aKiway.ProcessJob( KIWAY::FACE_SCH, bomJob.get() );
diff --git a/kicad/cli/command_export_sch_bom.h b/kicad/cli/command_export_sch_pythonbom.h
similarity index 84%
rename from kicad/cli/command_export_sch_bom.h
rename to kicad/cli/command_export_sch_pythonbom.h
index 4624ede3d7..cf8297c561 100644
--- a/kicad/cli/command_export_sch_bom.h
+++ b/kicad/cli/command_export_sch_pythonbom.h
@@ -18,17 +18,17 @@
* with this program. If not, see .
*/
-#ifndef COMMAND_EXPORT_SCH_BOM_H
-#define COMMAND_EXPORT_SCH_BOM_H
+#ifndef COMMAND_EXPORT_SCH_PYTHONBOM_H
+#define COMMAND_EXPORT_SCH_PYTHONBOM_H
#include "command_export_pcb_base.h"
namespace CLI
{
-class EXPORT_SCH_BOM_COMMAND : public EXPORT_PCB_BASE_COMMAND
+class EXPORT_SCH_PYTHONBOM_COMMAND : public EXPORT_PCB_BASE_COMMAND
{
public:
- EXPORT_SCH_BOM_COMMAND();
+ EXPORT_SCH_PYTHONBOM_COMMAND();
int Perform( KIWAY& aKiway ) override;
};
diff --git a/kicad/kicad_cli.cpp b/kicad/kicad_cli.cpp
index 1efd6a7874..8ad6c033c8 100644
--- a/kicad/kicad_cli.cpp
+++ b/kicad/kicad_cli.cpp
@@ -56,7 +56,7 @@
#include "cli/command_export_pcb_pos.h"
#include "cli/command_export_pcb_svg.h"
#include "cli/command_export_pcb_step.h"
-#include "cli/command_export_sch_bom.h"
+#include "cli/command_export_sch_pythonbom.h"
#include "cli/command_export_sch_netlist.h"
#include "cli/command_export_sch_pdf.h"
#include "cli/command_export_sch_svg.h"
@@ -113,25 +113,25 @@ struct COMMAND_ENTRY
handler( aHandler ), subCommands( aSub ){};
};
-static CLI::EXPORT_PCB_DRILL_COMMAND exportPcbDrillCmd{};
-static CLI::EXPORT_PCB_DXF_COMMAND exportPcbDxfCmd{};
-static CLI::EXPORT_PCB_STEP_COMMAND exportPcbStepCmd{};
-static CLI::EXPORT_PCB_SVG_COMMAND exportPcbSvgCmd{};
-static CLI::EXPORT_PCB_PDF_COMMAND exportPcbPdfCmd{};
-static CLI::EXPORT_PCB_POS_COMMAND exportPcbPosCmd{};
-static CLI::EXPORT_PCB_GERBER_COMMAND exportPcbGerberCmd{};
-static CLI::EXPORT_PCB_COMMAND exportPcbCmd{};
-static CLI::PCB_COMMAND pcbCmd{};
-static CLI::EXPORT_SCH_COMMAND exportSchCmd{};
-static CLI::SCH_COMMAND schCmd{};
-static CLI::EXPORT_SCH_BOM_COMMAND exportSchBomCmd{};
-static CLI::EXPORT_SCH_NETLIST_COMMAND exportSchNetlistCmd{};
-static CLI::EXPORT_SCH_PDF_COMMAND exportSchPdfCmd{};
-static CLI::EXPORT_SCH_SVG_COMMAND exportSchSvgCmd{};
-static CLI::FP_COMMAND fpCmd{};
-static CLI::FP_UPGRADE_COMMAND fpUpgradeCmd{};
-static CLI::SYM_COMMAND symCmd{};
-static CLI::SYM_UPGRADE_COMMAND symUpgradeCmd{};
+static CLI::EXPORT_PCB_DRILL_COMMAND exportPcbDrillCmd{};
+static CLI::EXPORT_PCB_DXF_COMMAND exportPcbDxfCmd{};
+static CLI::EXPORT_PCB_STEP_COMMAND exportPcbStepCmd{};
+static CLI::EXPORT_PCB_SVG_COMMAND exportPcbSvgCmd{};
+static CLI::EXPORT_PCB_PDF_COMMAND exportPcbPdfCmd{};
+static CLI::EXPORT_PCB_POS_COMMAND exportPcbPosCmd{};
+static CLI::EXPORT_PCB_GERBER_COMMAND exportPcbGerberCmd{};
+static CLI::EXPORT_PCB_COMMAND exportPcbCmd{};
+static CLI::PCB_COMMAND pcbCmd{};
+static CLI::EXPORT_SCH_COMMAND exportSchCmd{};
+static CLI::SCH_COMMAND schCmd{};
+static CLI::EXPORT_SCH_PYTHONBOM_COMMAND exportSchPythonBomCmd{};
+static CLI::EXPORT_SCH_NETLIST_COMMAND exportSchNetlistCmd{};
+static CLI::EXPORT_SCH_PDF_COMMAND exportSchPdfCmd{};
+static CLI::EXPORT_SCH_SVG_COMMAND exportSchSvgCmd{};
+static CLI::FP_COMMAND fpCmd{};
+static CLI::FP_UPGRADE_COMMAND fpUpgradeCmd{};
+static CLI::SYM_COMMAND symCmd{};
+static CLI::SYM_UPGRADE_COMMAND symUpgradeCmd{};
static std::vector commandStack = {
{
@@ -163,9 +163,9 @@ static std::vector commandStack = {
{
{ &exportSchCmd,
{
- &exportSchBomCmd,
&exportSchNetlistCmd,
&exportSchPdfCmd,
+ &exportSchPythonBomCmd,
&exportSchSvgCmd
}
}