Commit 0ac378fa authored by jean-pierre charras's avatar jean-pierre charras

More about BOM dialog. Still not perfect, but more easy to use.

parent f3765a32
...@@ -161,7 +161,7 @@ private: ...@@ -161,7 +161,7 @@ private:
// the first is the title // the first is the title
// the second is the command line // the second is the command line
wxArrayString m_plugins; wxArrayString m_plugins;
wxConfigBase* m_config; // to store the "plugins" wxConfigBase* m_config; // to store the "plugins"
public: public:
// Constructor and destructor // Constructor and destructor
...@@ -181,18 +181,25 @@ private: ...@@ -181,18 +181,25 @@ private:
void pluginInit(); void pluginInit();
void installPluginsList(); void installPluginsList();
wxString getPluginFileName();
/**
* @return the Plugin filename from a command line
* @param aCommand = the command line
*/
wxString getPluginFileName( const wxString& aCommand );
/** /**
* display (when exists) the text found between the keyword "@package" * display (when exists) the text found between the keyword "@package"
* (compatible with doxygen comments)
* and the end of comment block (""" in python", --> in xml) * and the end of comment block (""" in python", --> in xml)
*/ */
void displayPluginInfo( FILE * aFile, const wxString& aFilename ); void displayPluginInfo( FILE * aFile, const wxString& aFilename );
/** /**
* Browse plugin files, and set m_CommandStringCtrl field * Browse plugin files, and set m_CommandStringCtrl field
* @return a command line ro run the plugin
*/ */
void choosePlugin(); wxString choosePlugin();
}; };
// Create and show DIALOG_BOM. // Create and show DIALOG_BOM.
...@@ -299,7 +306,7 @@ void DIALOG_BOM::pluginInit() ...@@ -299,7 +306,7 @@ void DIALOG_BOM::pluginInit()
m_textCtrlName->SetValue( m_plugins[2 * ii] ); m_textCtrlName->SetValue( m_plugins[2 * ii] );
m_textCtrlCommand->SetValue( m_plugins[(2 * ii)+1] ); m_textCtrlCommand->SetValue( m_plugins[(2 * ii)+1] );
wxString pluginName = getPluginFileName(); wxString pluginName = getPluginFileName( m_textCtrlCommand->GetValue() );
if( pluginName.IsEmpty() ) if( pluginName.IsEmpty() )
return; return;
...@@ -317,14 +324,13 @@ void DIALOG_BOM::pluginInit() ...@@ -317,14 +324,13 @@ void DIALOG_BOM::pluginInit()
displayPluginInfo( pluginFile, pluginName ); displayPluginInfo( pluginFile, pluginName );
} }
/* display (when exists) the text found between the keyword "@package"
* and the end of comment block (""" in python", --> in xml)
*/
void DIALOG_BOM::displayPluginInfo( FILE * aFile, const wxString& aFilename ) void DIALOG_BOM::displayPluginInfo( FILE * aFile, const wxString& aFilename )
{ {
m_Messages->Clear(); m_Messages->Clear();
// display (when exists) the text found between the keyword "@package" // display (when exists) the text found between the keyword "@package"
// (compatible with doxygen comments)
// and the end of comment block (""" in python", --> in xml) // and the end of comment block (""" in python", --> in xml)
wxString data; wxString data;
...@@ -340,6 +346,10 @@ void DIALOG_BOM::displayPluginInfo( FILE * aFile, const wxString& aFilename ) ...@@ -340,6 +346,10 @@ void DIALOG_BOM::displayPluginInfo( FILE * aFile, const wxString& aFilename )
if( fn.GetExt().IsSameAs( wxT("py"), false ) ) if( fn.GetExt().IsSameAs( wxT("py"), false ) )
endsection = wxT( "\"\"\"" ); endsection = wxT( "\"\"\"" );
else if( !fn.GetExt().IsSameAs( wxT("xsl"), false ) )
// If this is not a python file, we know nothing about file
// and the info cannot be found
return;
// Extract substring between @package and """ // Extract substring between @package and """
int strstart = data.Find( header ); int strstart = data.Find( header );
...@@ -422,8 +432,17 @@ void DIALOG_BOM::OnRemovePlugin( wxCommandEvent& event ) ...@@ -422,8 +432,17 @@ void DIALOG_BOM::OnRemovePlugin( wxCommandEvent& event )
*/ */
void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event ) void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event )
{ {
wxString cmdLine = choosePlugin();
if( cmdLine.IsEmpty() )
return;
// Creates a new plugin entry // Creates a new plugin entry
wxString name = wxGetTextFromUser( _("Plugin name in plugin list") ); wxFileName fn( getPluginFileName( cmdLine ) );
wxString defaultName = fn.GetName();
wxString name = wxGetTextFromUser( _("Plugin name in plugin list") ,
_("Plugin name"), defaultName );
if( name.IsEmpty() ) if( name.IsEmpty() )
return; return;
...@@ -438,12 +457,13 @@ void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event ) ...@@ -438,12 +457,13 @@ void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event )
} }
} }
// Eppend the new plugin
m_plugins.Add( name ); m_plugins.Add( name );
m_plugins.Add( wxEmptyString ); m_plugins.Add( wxEmptyString );
m_lbPlugins->SetSelection( m_lbPlugins->GetCount() - 1 );
m_lbPlugins->Append( name ); m_lbPlugins->Append( name );
m_lbPlugins->SetSelection( m_lbPlugins->GetCount() - 1 ); m_lbPlugins->SetSelection( m_lbPlugins->GetCount() - 1 );
m_textCtrlCommand->SetValue( cmdLine );
choosePlugin();
pluginInit(); pluginInit();
} }
...@@ -451,7 +471,7 @@ void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event ) ...@@ -451,7 +471,7 @@ void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event )
/* /*
* Browse plugin files, and set m_CommandStringCtrl field * Browse plugin files, and set m_CommandStringCtrl field
*/ */
void DIALOG_BOM::choosePlugin() wxString DIALOG_BOM::choosePlugin()
{ {
wxString mask = wxT( "*" ); wxString mask = wxT( "*" );
#ifndef __WXMAC__ #ifndef __WXMAC__
...@@ -470,7 +490,7 @@ void DIALOG_BOM::choosePlugin() ...@@ -470,7 +490,7 @@ void DIALOG_BOM::choosePlugin()
true true
); );
if( fullFileName.IsEmpty() ) if( fullFileName.IsEmpty() )
return; return wxEmptyString;
// Creates a default command line, // Creates a default command line,
// suitable to run the external tool xslproc or python // suitable to run the external tool xslproc or python
...@@ -489,36 +509,35 @@ void DIALOG_BOM::choosePlugin() ...@@ -489,36 +509,35 @@ void DIALOG_BOM::choosePlugin()
else else
cmdLine.Printf(wxT("\"%s\""), GetChars( fullFileName ) ); cmdLine.Printf(wxT("\"%s\""), GetChars( fullFileName ) );
m_textCtrlCommand->SetValue( cmdLine ); return cmdLine;
} }
wxString DIALOG_BOM::getPluginFileName() wxString DIALOG_BOM::getPluginFileName( const wxString& aCommand )
{ {
wxString pluginName; wxString pluginName;
// Try to find the plugin name. // Try to find the plugin name.
// This is possible if the name ends by .py or .xsl // This is possible if the name ends by .py or .xsl
wxString cmdline = m_textCtrlCommand->GetValue();
int pos = -1; int pos = -1;
if( (pos = cmdline.Find( wxT(".py") )) != wxNOT_FOUND ) if( (pos = aCommand.Find( wxT(".py") )) != wxNOT_FOUND )
pos += 2; pos += 2;
else if( (pos = cmdline.Find( wxT(".xsl") )) != wxNOT_FOUND ) else if( (pos = aCommand.Find( wxT(".xsl") )) != wxNOT_FOUND )
pos += 3; pos += 3;
// the end of plugin name is at position pos. // the end of plugin name is at position pos.
if( pos > 0 ) if( pos > 0 )
{ {
// Be sure this is the end of the name: the next char is " or space // Be sure this is the end of the name: the next char is " or space
int eos = cmdline[pos+1]; int eos = aCommand[pos+1];
if( eos == ' '|| eos == '\"' ) if( eos == ' '|| eos == '\"' )
{ {
// search for the starting point of the name // search for the starting point of the name
int jj = pos-1; int jj = pos-1;
while( jj >= 0 ) while( jj >= 0 )
if( cmdline[jj] != eos ) if( aCommand[jj] != eos )
jj--; jj--;
else else
break; break;
...@@ -526,12 +545,12 @@ wxString DIALOG_BOM::getPluginFileName() ...@@ -526,12 +545,12 @@ wxString DIALOG_BOM::getPluginFileName()
// extract the name // extract the name
if( jj >= 0 ) if( jj >= 0 )
{ {
eos = cmdline[jj]; eos = aCommand[jj];
if( eos == ' '|| eos == '\"' ) // do not include delimiters if( eos == ' '|| eos == '\"' ) // do not include delimiters
jj++; jj++;
pluginName = cmdline.SubString( jj, pos ); pluginName = aCommand.SubString( jj, pos );
} }
} }
} }
...@@ -541,7 +560,7 @@ wxString DIALOG_BOM::getPluginFileName() ...@@ -541,7 +560,7 @@ wxString DIALOG_BOM::getPluginFileName()
void DIALOG_BOM::OnEditPlugin( wxCommandEvent& event ) void DIALOG_BOM::OnEditPlugin( wxCommandEvent& event )
{ {
wxString pluginName = getPluginFileName(); wxString pluginName = getPluginFileName( m_textCtrlCommand->GetValue() );
if( pluginName.Length() <= 2 ) // if name != "" if( pluginName.Length() <= 2 ) // if name != ""
{ {
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML> <html>
<HEAD> <head>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252"> <meta http-equiv="content-type" content="text/html; charset=windows-1252"/>
<TITLE>kicad help</TITLE> <title>kicad help</title>
<META NAME="GENERATOR" CONTENT="LibreOffice 4.0.2.2 (Windows)"> <meta name="generator" content="LibreOffice 4.3.4.1 (Windows)"/>
<META NAME="CREATED" CONTENT="0;0"> <meta name="created" content="00:00:00"/>
<META NAME="CHANGED" CONTENT="20130614;10225357"> <meta name="changed" content="2014-12-03T20:04:24.723000000"/>
<STYLE TYPE="text/css"> <meta name="created" content="00:00:00">
<!-- <meta name="changed" content="2014-12-03T20:04:06.003000000">
<meta name="created" content="00:00:00">
<meta name="changed" content="2014-12-03T19:59:24.882000000">
<style type="text/css">
@page { margin: 2cm } @page { margin: 2cm }
P { margin-bottom: 0.21cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto } p { margin-bottom: 0.21cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto }
P.western { font-family: "Arial", sans-serif; font-size: 10pt; so-language: en-US } p.western { font-family: "Arial", sans-serif; font-size: 10pt; so-language: en-US }
A:link { color: #004586; text-decoration: none } a:link { color: #004586; text-decoration: none }
A.western:link { font-family: "Liberation Sans", sans-serif; so-language: zxx; font-style: italic } a.western:link { font-family: "Liberation Sans", sans-serif; so-language: zxx; font-style: italic }
A.sdfootnotesym-western { font-family: "DejaVu Serif", serif } a.sdfootnotesym-western { font-family: "DejaVu Serif", serif }
--> </style>
</STYLE> </head>
</HEAD> <body lang="en-AU" link="#004586" dir="ltr">
<BODY LANG="en-AU" LINK="#004586" DIR="LTR"> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"><a name="__RefHeading__2925_482973253"></a>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"><A NAME="__RefHeading__2925_482973253"></A> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>1
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>1 - Full - Full documentation:</b></font></font></p>
documentation:</B></FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>The
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN LANG="en-US"><B>The </b></font></font><font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><i><b>Eeschema
</B></SPAN></FONT></FONT><FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN LANG="en-US"><I><B>Eeschema documentation, chapter 14</b></i></font></font> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>describes
documentation, chapter 14</B></I></SPAN></FONT></FONT><FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN LANG="en-US"><B> this intermediate netlist and gives examples<br>See also
describes this intermediate netlist and gives examples<BR>See also </b></font></font><font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><i><b>https://answers.launchpad.net/kicad/+faq/2265</b></i></font></font></p>
</B></SPAN></FONT></FONT><FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN LANG="en-US"><I><B>https://answers.launchpad.net/kicad/+faq/2265</B></I></SPAN></FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b><i>2
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B><I>2 - </I>The - </i>The intermediate Netlist File</b></font></font></p>
intermediate Netlist File</B></FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">BOM
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>BOM files (and files (and netlist files) can be created from an Intermediate netlist
netlist files) can be created from an Intermediate netlist file file created by Eeschema.</font></font></p>
created by Eeschema.</FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">This
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>This file uses XML file uses XML syntax and is called the intermediate netlist. The
syntax and is called the intermediate netlist. The intermediate intermediate netlist includes a large amount of data about your board
netlist includes a large amount of data about your board and because and because of this, it can be used with post-processing to create a
of this, it can be used with post-processing to create a BOM or other BOM or other reports.</font></font></p>
reports.</FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">Depending
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Depending on the on the output (BOM or netlist), different subsets of the complete
output (BOM or netlist), different subsets of the complete Intermediate Netlist file will be used in the post-processing.</font></font></p>
Intermediate Netlist file will be used in the post-processing.</FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>3
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>3 - Conversion to - Conversion to a new format</b></font></font></p>
a new format</B></FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">By
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>By applying a applying a post-processing filter to the Intermediate netlist file
post-processing filter to the Intermediate netlist file you can you can generate foreign netlist files as well as BOM files. Because
generate foreign netlist files as well as BOM files. Because this this conversion is a text to text transformation.</font></font></p>
conversion is a text to text transformation.</FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">this
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>this post-processing post-processing filter can be written using Python, XSLT, or any
filter can be written using Python, XSLT, or any other tool capable other tool capable of taking XML as input.</font></font></p>
of taking XML as input.</FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">XSLT
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">XSLT
itself is a XML language very suitable for XML transformations. There itself is a XML language very suitable for XML transformations. There
is a free program called </SPAN></SPAN></SPAN><I><SPAN STYLE="font-weight: normal">xsltproc</SPAN></I><SPAN STYLE="font-variant: normal"> is a free program called </span></span></span><i><span style="font-weight: normal">xsltproc</span></i><span style="font-variant: normal">
</SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">that </span><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">that
you can download and install. The</SPAN></SPAN></SPAN><SPAN STYLE="font-variant: normal"> you can download and install. The</span></span></span><span style="font-variant: normal">
</SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">xsltproc </span><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">xsltproc
program can be used to read the Intermediate XML netlist input file, program can be used to read the Intermediate XML netlist input file,
apply</SPAN></SPAN></SPAN><SPAN STYLE="font-variant: normal"> </SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">a apply</span></span></span><span style="font-variant: normal"> </span><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">a
style-sheet to transform the input, and save the results in an output style-sheet to transform the input, and save the results in an output
file. Use of xsltproc requires a style-sheet file using XSLT file. Use of xsltproc requires a style-sheet file using XSLT
conventions. The full conversion process is handled</SPAN></SPAN></SPAN><SPAN STYLE="font-variant: normal"> conventions. The full conversion process is handled</span></span></span><span style="font-variant: normal">
</SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">by </span><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">by
Eeschema, after it is configured once to run xsltproc in a specific Eeschema, after it is configured once to run xsltproc in a specific
way.</SPAN></SPAN></SPAN></FONT></FONT></P> way.</span></span></span></font></font></p>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>4 - <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>4
Initialization of the dialog window</B></FONT></FONT></P> - Initialization of the dialog window</b></font></font></p>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>You should add a new <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">You
pluging (a script) in plugin list by clicking on the Add Plugin should add a new pluging (a script) in plugin list by clicking on the
button.</FONT></FONT></P> Add Plugin button.</font></font></p>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>4.1 - Plugin <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>4.1
Configuration Parameters</B></FONT></FONT></P> - Plugin Configuration Parameters</b></font></font></p>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>The Eeschema plug-in <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">The
configuration dialog requires the following information:</FONT></FONT></P> Eeschema plug-in configuration dialog requires the following
<UL> information:</font></font></p>
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <ul>
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>The title: for <li/>
instance, the name of the netlist format.</FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">The
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>The command line to title: for instance, the name of the netlist format.</font></font></p>
launch the converter (usually a script).</FONT></FONT></P> <li/>
</UL> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">The
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Once you click on command line to launch the converter (usually a script).</font></font></p>
the generate button the following will happen:</FONT></FONT></P> </ul>
<OL> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">Once
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Eeschema creates an you click on the generate button the following will happen:</font></font></p>
intermediate netlist file *.xml, for instance <I>test.xml.</I></FONT></FONT></P> <ol>
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <li/>
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Eeschema runs the <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
script from the command line to create the final output file.</FONT></FONT></P> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">Eeschema
</OL> creates an intermediate netlist file *.xml, for instance <i>test.xml.</i></font></font></p>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <li/>
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>4.2 - Generate <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
netlist files with the command line</B></FONT></FONT></P> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">Eeschema
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> runs the script from the command line to create the final output
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Assuming we are file.</font></font></p>
using the program <I>xsltproc.exe</I><SPAN STYLE="font-variant: normal"> </ol>
</SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">to <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
apply the sheet style to the intermediate file, </SPAN></SPAN><I>xsltproc.exe</I><SPAN STYLE="font-variant: normal"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>4.2
</SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">is - Generate netlist files with the command line</b></font></font></p>
executed with the following command.</SPAN></SPAN></FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">Assuming
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>xsltproc.exe -o &lt; we are using the program <i>xsltproc.exe</i><span style="font-variant: normal">
output filename &gt; &lt; style-sheet filename &gt; &lt; input XML </span><span style="font-variant: normal"><span style="font-style: normal">to
file to convert &gt;</FONT></FONT></P> apply the sheet style to the intermediate file, </span></span><i>xsltproc.exe</i><span style="font-variant: normal">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> </span><span style="font-variant: normal"><span style="font-style: normal">is
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><FONT SIZE=2 STYLE="font-size: 11pt">On</FONT> executed with the following command.</span></span></font></font></p>
<FONT SIZE=2 STYLE="font-size: 11pt">Windows the command line is the <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
following.<BR></FONT><FONT SIZE=2 STYLE="font-size: 11pt"><I>f:/kicad/bin/xsltproc.exe <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">xsltproc.exe
-o &ldquo;%O&rdquo; f:/kicad/bin/plugins/myconverter.xsl &ldquo;%I&rdquo;</I></FONT></FONT></FONT></P> -o &lt; output filename &gt; &lt; style-sheet filename &gt; &lt;
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> input XML file to convert &gt;</font></font></p>
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><FONT SIZE=2 STYLE="font-size: 11pt">On</FONT> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<FONT SIZE=2 STYLE="font-size: 11pt">Linux the command becomes as <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><font size="2" style="font-size: 11pt">On</font>
following.<BR></FONT><FONT SIZE=2 STYLE="font-size: 11pt"><I>xsltproc <font size="2" style="font-size: 11pt">Windows the command line is
the following.<br></font><font size="2" style="font-size: 11pt"><i>f:/kicad/bin/xsltproc.exe
-o &ldquo;%O&rdquo; f:/kicad/bin/plugins/myconverter.xsl &ldquo;%I&rdquo;</i></font></font></font></p>
<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><font size="2" style="font-size: 11pt">On</font>
<font size="2" style="font-size: 11pt">Linux the command becomes as
following.<br></font><font size="2" style="font-size: 11pt"><i>xsltproc
-o &ldquo;%O&rdquo; /usr/local/kicad/bin/plugins/myconverter .xsl -o &ldquo;%O&rdquo; /usr/local/kicad/bin/plugins/myconverter .xsl
&ldquo;%I&rdquo;</I></FONT></FONT></FONT></P> &ldquo;%I&rdquo;</i></font></font></font></p>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN STYLE="font-variant: normal"><FONT SIZE=2 STYLE="font-size: 11pt"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">Where <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><span style="font-variant: normal"><font size="2" style="font-size: 11pt"><span style="font-style: normal"><span style="font-weight: normal">Where
</SPAN></SPAN></FONT></SPAN><SPAN STYLE="font-variant: normal"><FONT SIZE=2 STYLE="font-size: 11pt"><I><SPAN STYLE="font-weight: normal">myconverter</SPAN></I></FONT></SPAN><FONT SIZE=2 STYLE="font-size: 11pt"><I><SPAN STYLE="font-weight: normal">.xsl</SPAN></I></FONT><SPAN STYLE="font-variant: normal"> </span></span></font></span><span style="font-variant: normal"><font size="2" style="font-size: 11pt"><i><span style="font-weight: normal">myconverter</span></i></font></span><font size="2" style="font-size: 11pt"><i><span style="font-weight: normal">.xsl</span></i></font><span style="font-variant: normal">
</SPAN><SPAN STYLE="font-variant: normal"><FONT SIZE=2 STYLE="font-size: 11pt"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">is </span><span style="font-variant: normal"><font size="2" style="font-size: 11pt"><span style="font-style: normal"><span style="font-weight: normal">is
the style-sheet that you are applying. Do not forget the double the style-sheet that you are applying. Do not forget the double
quotes</SPAN></SPAN></FONT></SPAN><SPAN STYLE="font-variant: normal"> quotes</span></span></font></span><span style="font-variant: normal">
</SPAN><SPAN STYLE="font-variant: normal"><FONT SIZE=2 STYLE="font-size: 11pt"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">around </span><span style="font-variant: normal"><font size="2" style="font-size: 11pt"><span style="font-style: normal"><span style="font-weight: normal">around
the file names, this allows them to have spaces after the the file names, this allows them to have spaces after the
substitution by Eeschema.</SPAN></SPAN></FONT></SPAN></FONT></FONT></P> substitution by Eeschema.</span></span></font></span></font></font></p>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>The command line <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">The
format accepts parameters for filenames:</FONT></FONT></P> command line format accepts parameters for filenames:</font></font></p>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>The supported <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">The
formatting parameters are.</FONT></FONT></P> supported formatting parameters are.</font></font></p>
<UL> <ul>
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <li/>
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>%B =&gt; base <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
filename and path of selected output file, minus path and extension.</FONT></FONT></P> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">%B
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> =&gt; base filename and path of selected output file, minus path and
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>%I =&gt; complete extension.</font></font></p>
filename and path of the temporary input file (the intermediate net <li/>
file).</FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">%I
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>%O =&gt; complete =&gt; complete filename and path of the temporary input file (the
filename and path of the user chosen output file.</FONT></FONT></P> intermediate net file).</font></font></p>
</UL> <li/>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>%I will be replaced <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">%O
by the actual intermediate file name<BR><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">%O =&gt; complete filename and path (but without extension) of the user
will be replaced by the actual output file name.</SPAN></SPAN></SPAN></FONT></FONT></P> chosen output file.</font></font></p>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> </ul>
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>4.3 - Command <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
line format: example for <SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">xsltproc</SPAN></SPAN></B></FONT></FONT></P> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">%I
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> will be replaced by the actual intermediate file name<br><span style="font-variant: normal"><span style="font-style: normal"><span style="font-weight: normal">%O
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">The will be replaced by the actual output file name.</span></span></span></font></font></p>
command line format for xsltproc is the following:<BR>&lt; path of <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
</SPAN></SPAN>xsltproc &gt; <SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">xsltproc <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>4.3
&lt; </SPAN></SPAN>xsltproc parameters &gt;</FONT></FONT></P> - Command line format: example for <span style="font-variant: normal"><span style="font-style: normal">xsltproc</span></span></b></font></font></p>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <p lang="en-US" class="western" style="margin-bottom: 0cm; font-variant: normal; font-style: normal; widows: 0; orphans: 0">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>On <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>4.3.1
Windows:<BR><I><B>f:/kicad/bin/xsltproc.exe -o &ldquo;%O&rdquo; - Command line</b></font></font></p>
f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl &ldquo;%I&rdquo;</B></I></FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><span style="font-variant: normal"><span style="font-style: normal">The
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><FONT SIZE=2 STYLE="font-size: 11pt">On</FONT> command line format for xsltproc is the following:<br>&lt; path of
<FONT SIZE=2 STYLE="font-size: 11pt">Linux:<BR></FONT><FONT SIZE=2 STYLE="font-size: 11pt"><I><B>xsltproc </span></span>xsltproc &gt; <span style="font-variant: normal"><span style="font-style: normal">xsltproc
&lt; </span></span>xsltproc parameters &gt;</font></font></p>
<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">On
Windows:<br><i><b>f:/kicad/bin/xsltproc.exe -o &ldquo;%O&rdquo;
f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl &ldquo;%I&rdquo;</b></i></font></font></p>
<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><font size="2" style="font-size: 11pt">On</font>
<font size="2" style="font-size: 11pt">Linux:<br></font><font size="2" style="font-size: 11pt"><i><b>xsltproc
-o &ldquo;%O&rdquo; -o &ldquo;%O&rdquo;
/usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl &ldquo;%I&rdquo;</B></I></FONT></FONT></FONT></P> /usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl &ldquo;%I&rdquo;</b></i></font></font></font></p>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN STYLE="font-variant: normal"><FONT SIZE=2 STYLE="font-size: 11pt"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">The <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><span style="font-variant: normal"><font size="2" style="font-size: 11pt"><span style="font-style: normal"><span style="font-weight: normal">The
above examples assume</SPAN></SPAN></FONT></SPAN><SPAN STYLE="font-variant: normal"> above examples assume</span></span></font></span><span style="font-variant: normal">
</SPAN><SPAN STYLE="font-variant: normal"><FONT SIZE=2 STYLE="font-size: 11pt"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">xsltproc </span><span style="font-variant: normal"><font size="2" style="font-size: 11pt"><span style="font-style: normal"><span style="font-weight: normal">xsltproc
is installed on your PC under Windows and all files located in is installed on your PC under Windows and all files located in
kicad/bin.</SPAN></SPAN></FONT></SPAN></FONT></FONT></P> kicad/bin.</span></span></font></span></font></font></p>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <p lang="en-US" class="western" style="margin-bottom: 0cm; font-variant: normal; font-style: normal; widows: 0; orphans: 0">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>4.4 - Command <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>4.3.2
line format: example fo<SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">r - Remark:</b></font></font></p>
python scripts</SPAN></SPAN></B></FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">Most
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>The command line of time, the created file must have an extension, depending on its
format for python is something like:<BR><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">python</SPAN></SPAN><SPAN STYLE="font-variant: normal"> type.<br>Therefore you have to add to the option <i><b>%O</b></i> the
</SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">&lt; right file extension.</font></font></p>
script file name </SPAN></SPAN>&gt; &lt; input filename &gt; &lt; <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0">
output filename &gt;</FONT></FONT></P> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">For
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> instance <i><b>%O.csv</b></i> to create a .csv file (comma separated
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>On value file).</font></font></p>
Windows:<BR><I><B>python.exe f:/kicad/python/my_python_script.py</B></I> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0">
&ldquo;<I><B>%I&rdquo; &ldquo;%O&rdquo;</B></I></FONT></FONT></P> <br/>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>On Linux:<BR><I><B>python</B></I> </p>
<I><B>/usr/local/kicad/python/my_python_script.py</B></I> &ldquo;<I><B>%I&rdquo; <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
&ldquo;%O&rdquo;</B></I></FONT></FONT></P> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>4.4
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> - Command line format: example fo<span style="font-variant: normal"><span style="font-style: normal">r
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Assuming python is python scripts</span></span></b></font></font></p>
installed on your PC.</FONT></FONT></P> <p lang="en-US" class="western" style="margin-bottom: 0cm; font-variant: normal; font-style: normal; widows: 0; orphans: 0">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"><A NAME="__RefHeading__1787_435485510"></A> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>4.4.1
<BR> - Command line</b></font></font></p>
</P> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
</BODY> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">The
</HTML> command line format for python is something like:<br><span style="font-variant: normal"><span style="font-style: normal">python</span></span><span style="font-variant: normal">
\ No newline at end of file </span><span style="font-variant: normal"><span style="font-style: normal">&lt;
script file name </span></span>&gt; &lt; input filename &gt; &lt;
output filename &gt;</font></font></p>
<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">On
Windows:<br><i><b>python.exe f:/kicad/python/my_python_script.py</b></i>
&ldquo;<i><b>%I&rdquo; &ldquo;%O&rdquo;</b></i></font></font></p>
<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">On
Linux:<br><i><b>python</b></i>
<i><b>/usr/local/kicad/python/my_python_script.py</b></i> &ldquo;<i><b>%I&rdquo;
&ldquo;%O&rdquo;</b></i></font></font></p>
<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">Assuming
python is installed on your PC.</font></font></p>
<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
<br/>
</p>
<p lang="en-US" class="western" style="margin-bottom: 0cm; font-variant: normal; font-style: normal; widows: 0; orphans: 0"><a name="__RefHeading__1787_435485510"></a>
<font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>4.4.2
- Remark:</b></font></font></p>
<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0">
<font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">Most
of time, the created file must have an extension, depending on its
type.<br>Therefore you have to add to the option <i><b>%O</b></i> the
right file extension.</font></font></p>
<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0">
<font face="Times New Roman, serif"><font size="3" style="font-size: 12pt">For
instance <i><b>%O.html</b></i> to create a .html file.</font></font></p>
<p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0">
<br/>
</p>
</body>
</html>
\ No newline at end of file
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
--> -->
<!-- <!--
@package @package
Generate a Tab delimited list (csv file type). Generate a comma separated value BOM list (csv file type).
Components are sorted by value Components are sorted by value
One component per line One component per line
Fields are Fields are
Quantity, 'Part name', 'Description', 'lib' Quantity, 'Part name', Description, lib
--> -->
<!DOCTYPE xsl:stylesheet [ <!DOCTYPE xsl:stylesheet [
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
Components are sorted by ref and grouped by value Components are sorted by ref and grouped by value
One component per line One component per line
Fields are (if exist) Fields are (if exist)
Ref, Quantity, value, Part, 'footprint', 'Description', 'Vendor' Ref, Quantity, value, Part, footprint, 'Description', 'Vendor'
""" """
from __future__ import print_function from __future__ import print_function
......
#
# Example python script to generate a BOM from a KiCad generic netlist
#
# Example: Sorted and Grouped CSV BOM
#
"""
@package
Generate a Tab delimited list (csv file type).
Components are sorted by ref and grouped by value
Fields are (if exist)
'Ref', 'Qnty', 'Value', 'Sch lib name', 'footprint', 'Description', 'Vendor'
"""
# Import the KiCad python helper module and the csv formatter
import kicad_netlist_reader
import csv
import sys
# Generate an instance of a generic netlist, and load the netlist tree from
# the command line option. If the file doesn't exist, execution will stop
net = kicad_netlist_reader.netlist(sys.argv[1])
# Open a file to write to, if the file cannot be opened output to stdout
# instead
try:
f = open(sys.argv[2], 'w')
except IOError:
e = "Can't open output file for writing: " + sys.argv[2]
print(__file__, ":", e, sys.stderr)
f = sys.stdout
# Create a new csv writer object to use as the output formatter
out = csv.writer(f, lineterminator='\n', delimiter=',', quotechar='\"', quoting=csv.QUOTE_ALL)
# Output a set of rows for a header providing general information
out.writerow(['Source:', net.getSource()])
out.writerow(['Date:', net.getDate()])
out.writerow(['Tool:', net.getTool()])
out.writerow(['Component Count:', len(net.components)])
out.writerow(['Ref', 'Qnty', 'Value', 'Sch lib name', 'footprint', 'Description', 'Vendor'])
# Get all of the components in groups of matching parts + values
# (see ky_generic_netlist_reader.py)
grouped = net.groupComponents()
# Output all of the component information
for group in grouped:
refs = ""
# Add the reference of every component in the group and keep a reference
# to the component so that the other data can be filled in once per group
for component in group:
refs += component.getRef() + ", "
c = component
# Fill in the component groups common data
out.writerow([refs, len(group), c.getValue(), c.getLibName() + "/" + c.getPartName(), c.getFootprint(),
c.getDescription(), c.getField("Vendor")])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment