Commit 534a3c1f authored by Ronald Sousa's avatar Ronald Sousa

- changed generatedDate back to date. this should keep compatibly

- the net file now has all project sheet title block using node 'sheets' and 'sheet'
- Updated bom_with_title_block_2_csv. Note, its only going to output the root title block.
parent ef20a2bb
...@@ -654,32 +654,37 @@ static XNODE* node( const wxString& aName, const wxString& aTextualContent = wxE ...@@ -654,32 +654,37 @@ static XNODE* node( const wxString& aName, const wxString& aTextualContent = wxE
XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader() XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader()
{ {
SCH_SCREEN* screen; SCH_SCREEN* screen;
SCH_SCREENS ScreenList; SCH_SCREENS screenList;
screen = ScreenList.GetFirst(); screen = screenList.GetFirst();
XNODE* xdesign = node( wxT("design") ); XNODE* xdesign = node( wxT("design") );
XNODE* xsheetNode;
XNODE* xsheetInfo;
// the root sheet is a special sheet, call it source // the root sheet is a special sheet, call it source
xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) ); xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) );
xdesign->AddChild( node( wxT( "generatedDate" ), DateAndTime() ) ); xdesign->AddChild( node( wxT( "date" ), DateAndTime() ) );
// which Eeschema tool // which Eeschema tool
xdesign->AddChild( node( wxT( "tool" ), wxT( "Eeschema " ) + GetBuildVersion() ) ); xdesign->AddChild( node( wxT( "tool" ), wxT( "Eeschema " ) + GetBuildVersion() ) );
// export project information xdesign->AddChild( xsheetNode = node( wxT( "sheets" ) ) );
if( screen != NULL )
{
for( screen = screenList.GetFirst(); screen != NULL; screen = screenList.GetNext() )
{
TITLE_BLOCK tb = screen->GetTitleBlock(); TITLE_BLOCK tb = screen->GetTitleBlock();
xdesign->AddChild( node( wxT( "title" ), tb.GetTitle() ) ); xsheetNode->AddChild( xsheetInfo = node( wxT( "sheet" ) ) );
xdesign->AddChild( node( wxT( "company" ), tb.GetCompany() ) );
xdesign->AddChild( node( wxT( "revision" ), tb.GetRevision() ) ); xsheetInfo->AddChild( node( wxT( "title" ), tb.GetTitle() ) );
xdesign->AddChild( node( wxT( "issueDate" ), tb.GetDate() ) ); xsheetInfo->AddChild( node( wxT( "company" ), tb.GetCompany() ) );
xdesign->AddChild( node( wxT( "comment1" ), tb.GetComment1() ) ); xsheetInfo->AddChild( node( wxT( "revision" ), tb.GetRevision() ) );
xdesign->AddChild( node( wxT( "comment2" ), tb.GetComment2() ) ); xsheetInfo->AddChild( node( wxT( "issueDate" ), tb.GetDate() ) );
xdesign->AddChild( node( wxT( "comment3" ), tb.GetComment3() ) ); xsheetInfo->AddChild( node( wxT( "comment1" ), tb.GetComment1() ) );
xdesign->AddChild( node( wxT( "comment4" ), tb.GetComment4() ) ); xsheetInfo->AddChild( node( wxT( "comment2" ), tb.GetComment2() ) );
xsheetInfo->AddChild( node( wxT( "comment3" ), tb.GetComment3() ) );
xsheetInfo->AddChild( node( wxT( "comment4" ), tb.GetComment4() ) );
} }
/* @todo might do a list of schematic pages /* @todo might do a list of schematic pages
......
...@@ -3,7 +3,11 @@ ...@@ -3,7 +3,11 @@
EESCHEMA BOM plugin. Creates BOM CSV files from the project net file. EESCHEMA BOM plugin. Creates BOM CSV files from the project net file.
Based on Stefan Helmert bom2csv.xsl Based on Stefan Helmert bom2csv.xsl
Arthur: Ronald Sousa HashDefineElectronics.com Note:
The project infomation (i.e title, company and revision) is taken from and the root sheet.
Arthur:
Ronald Sousa HashDefineElectronics.com
Usage: Usage:
on Windows: on Windows:
...@@ -12,16 +16,18 @@ ...@@ -12,16 +16,18 @@
xsltproc -o "%O.csv" /usr/local/lib/kicad/plugins/bom2csv.xsl "%I" xsltproc -o "%O.csv" /usr/local/lib/kicad/plugins/bom2csv.xsl "%I"
Ouput Example: Ouput Example:
Kicad Rev: working director and file source Source,
Generated Date: date this file was generated Kicad Rev, working director and file source
Document Title: the project tile Generated Date, date this file was generated
Company: the project company
Revision: the project revision Title, the project's tile
Issue Date: project issue date Company, the project's company
Comment: This is comment 1 Revision, the project's revision
Comment: This is comment 2 Date Source, project's issue date
Comment: This is comment 3 Comment, This is comment 1
Comment: This is comment 4 Comment, This is comment 2
Comment, This is comment 3
Comment, This is comment 4
Reference, Value, Fields[n], Library, Library Ref Reference, Value, Fields[n], Library, Library Ref
U1, PIC32MX, Fields[n], KicadLib, PIC U1, PIC32MX, Fields[n], KicadLib, PIC
...@@ -31,7 +37,6 @@ ...@@ -31,7 +37,6 @@
<!ENTITY nl "&#xd;&#xa;"> <!--new line CR, LF, or LF, your choice --> <!ENTITY nl "&#xd;&#xa;"> <!--new line CR, LF, or LF, your choice -->
]> ]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/> <xsl:output method="text"/>
...@@ -40,55 +45,95 @@ ...@@ -40,55 +45,95 @@
<!-- main part --> <!-- main part -->
<xsl:template match="/export"> <xsl:template match="/export">
<xsl:text>Source,</xsl:text><xsl:value-of select="design/source"/><xsl:text>&nl;</xsl:text>
<xsl:text>Source: </xsl:text><xsl:value-of select="design/source"/><xsl:text>&nl;</xsl:text> <xsl:text>Kicad Rev,</xsl:text><xsl:value-of select="design/tool"/><xsl:text>&nl;</xsl:text>
<xsl:text>Kicad Rev: </xsl:text><xsl:value-of select="design/tool"/><xsl:text>&nl;</xsl:text> <xsl:text>Generated Date,</xsl:text><xsl:value-of select="design/date"/><xsl:text>&nl;</xsl:text>
<xsl:text>Generated Date: </xsl:text><xsl:value-of select="design/generatedDate"/><xsl:text>&nl;</xsl:text>
<xsl:text>&nl;</xsl:text>
<!-- Ouput Root sheet project information -->
<xsl:apply-templates select="/export/design/sheets/sheet[1]"/>
<xsl:text>&nl;</xsl:text>
<!-- Output table header -->
<xsl:text>Reference,Value,</xsl:text>
<xsl:for-each select="components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]">
<xsl:value-of select="@name"/>
<xsl:text>,</xsl:text>
</xsl:for-each>
<xsl:text>Library,Library Ref</xsl:text>
<xsl:text>&nl;</xsl:text> <xsl:text>&nl;</xsl:text>
<xsl:text>Document Title: </xsl:text><xsl:value-of select="design/title"/><xsl:text>&nl;</xsl:text>
<xsl:text>Company: </xsl:text><xsl:value-of select="design/company"/><xsl:text>&nl;</xsl:text>
<xsl:text>Revision: </xsl:text><xsl:value-of select="design/revision"/><xsl:text>&nl;</xsl:text>
<xsl:text>Issue Date: </xsl:text><xsl:value-of select="design/issueDate"/><xsl:text>&nl;</xsl:text>
<!-- all table entries -->
<xsl:apply-templates select="components/comp"/>
</xsl:template>
<!-- generate the Root sheet project information -->
<xsl:template match="/export/design/sheets/sheet[1]">
<xsl:choose> <xsl:choose>
<xsl:when test="design/comment1 !=''"> <xsl:when test="title !=''">
<xsl:text>Comment: </xsl:text><xsl:value-of select="design/comment1"/><xsl:text>&nl;</xsl:text> <xsl:text>Title,</xsl:text><xsl:value-of select="title"/><xsl:text>&nl;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise>
<xsl:text>Title,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
</xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:choose> <xsl:choose>
<xsl:when test="design/comment2 !=''"> <xsl:when test="company !=''">
<xsl:text>Comment: </xsl:text><xsl:value-of select="design/comment2"/><xsl:text>&nl;</xsl:text> <xsl:text>Company,</xsl:text><xsl:value-of select="company"/><xsl:text>&nl;</xsl:text>
</xsl:when> </xsl:when>
<xsl:otherwise>
<xsl:text>Company,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="revision !=''">
<xsl:text>Revision,</xsl:text><xsl:value-of select="revision"/><xsl:text>&nl;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Revision,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="issueDate !=''">
<xsl:text>Date Issue,</xsl:text><xsl:value-of select="issueDate"/><xsl:text>&nl;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Date Issue,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
</xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:choose> <xsl:choose>
<xsl:when test="design/comment3 !=''"> <xsl:when test="comment1 !=''">
<xsl:text>Comment: </xsl:text><xsl:value-of select="design/comment3"/><xsl:text>&nl;</xsl:text> <xsl:text>Comment,</xsl:text><xsl:value-of select="comment1"/><xsl:text>&nl;</xsl:text>
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
<xsl:choose> <xsl:choose>
<xsl:when test="design/comment4 !=''"> <xsl:when test="comment2 !=''">
<xsl:text>Comment: </xsl:text><xsl:value-of select="design/comment4"/><xsl:text>&nl;</xsl:text> <xsl:text>Comment,</xsl:text><xsl:value-of select="comment2"/><xsl:text>&nl;</xsl:text>
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
<xsl:text>&nl;</xsl:text> <xsl:choose>
<xsl:when test="comment3 !=''">
<!-- Output table header --> <xsl:text>Comment,</xsl:text><xsl:value-of select="comment3"/><xsl:text>&nl;</xsl:text>
<xsl:text>Reference, Value, </xsl:text> </xsl:when>
<xsl:for-each select="components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]"> </xsl:choose>
<xsl:value-of select="@name"/>
<xsl:text>, </xsl:text>
</xsl:for-each>
<xsl:text>Library, Library Ref</xsl:text>
<xsl:text>&nl;</xsl:text>
<!-- all table entries --> <xsl:choose>
<xsl:apply-templates select="components/comp"/> <xsl:when test="comment4 !=''">
<xsl:text>Comment,</xsl:text><xsl:value-of select="comment4"/><xsl:text>&nl;</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template> </xsl:template>
<!-- the table entries --> <!-- the table entries -->
<xsl:template match="components/comp"> <xsl:template match="components/comp">
<xsl:value-of select="@ref"/><xsl:text>,</xsl:text> <xsl:value-of select="@ref"/><xsl:text>,</xsl:text>
......
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