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
XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader()
{
SCH_SCREEN* screen;
SCH_SCREENS ScreenList;
screen = ScreenList.GetFirst();
SCH_SCREENS screenList;
screen = screenList.GetFirst();
XNODE* xdesign = node( wxT("design") );
XNODE* xsheetNode;
XNODE* xsheetInfo;
// the root sheet is a special sheet, call it source
xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) );
xdesign->AddChild( node( wxT( "generatedDate" ), DateAndTime() ) );
xdesign->AddChild( node( wxT( "date" ), DateAndTime() ) );
// which Eeschema tool
xdesign->AddChild( node( wxT( "tool" ), wxT( "Eeschema " ) + GetBuildVersion() ) );
// export project information
if( screen != NULL )
{
xdesign->AddChild( xsheetNode = node( wxT( "sheets" ) ) );
for( screen = screenList.GetFirst(); screen != NULL; screen = screenList.GetNext() )
{
TITLE_BLOCK tb = screen->GetTitleBlock();
xdesign->AddChild( node( wxT( "title" ), tb.GetTitle() ) );
xdesign->AddChild( node( wxT( "company" ), tb.GetCompany() ) );
xdesign->AddChild( node( wxT( "revision" ), tb.GetRevision() ) );
xdesign->AddChild( node( wxT( "issueDate" ), tb.GetDate() ) );
xdesign->AddChild( node( wxT( "comment1" ), tb.GetComment1() ) );
xdesign->AddChild( node( wxT( "comment2" ), tb.GetComment2() ) );
xdesign->AddChild( node( wxT( "comment3" ), tb.GetComment3() ) );
xdesign->AddChild( node( wxT( "comment4" ), tb.GetComment4() ) );
xsheetNode->AddChild( xsheetInfo = node( wxT( "sheet" ) ) );
xsheetInfo->AddChild( node( wxT( "title" ), tb.GetTitle() ) );
xsheetInfo->AddChild( node( wxT( "company" ), tb.GetCompany() ) );
xsheetInfo->AddChild( node( wxT( "revision" ), tb.GetRevision() ) );
xsheetInfo->AddChild( node( wxT( "issueDate" ), tb.GetDate() ) );
xsheetInfo->AddChild( node( wxT( "comment1" ), tb.GetComment1() ) );
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
......
......@@ -3,7 +3,11 @@
EESCHEMA BOM plugin. Creates BOM CSV files from the project net file.
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:
on Windows:
......@@ -12,16 +16,18 @@
xsltproc -o "%O.csv" /usr/local/lib/kicad/plugins/bom2csv.xsl "%I"
Ouput Example:
Kicad Rev: working director and file source
Generated Date: date this file was generated
Document Title: the project tile
Company: the project company
Revision: the project revision
Issue Date: project issue date
Comment: This is comment 1
Comment: This is comment 2
Comment: This is comment 3
Comment: This is comment 4
Source,
Kicad Rev, working director and file source
Generated Date, date this file was generated
Title, the project's tile
Company, the project's company
Revision, the project's revision
Date Source, project's issue date
Comment, This is comment 1
Comment, This is comment 2
Comment, This is comment 3
Comment, This is comment 4
Reference, Value, Fields[n], Library, Library Ref
U1, PIC32MX, Fields[n], KicadLib, PIC
......@@ -31,7 +37,6 @@
<!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:output method="text"/>
......@@ -40,55 +45,95 @@
<!-- main part -->
<xsl:template match="/export">
<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>Generated Date: </xsl:text><xsl:value-of select="design/generatedDate"/><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>Generated Date,</xsl:text><xsl:value-of select="design/date"/><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>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:when test="design/comment1 !=''">
<xsl:text>Comment: </xsl:text><xsl:value-of select="design/comment1"/><xsl:text>&nl;</xsl:text>
<xsl:when test="title !=''">
<xsl:text>Title,</xsl:text><xsl:value-of select="title"/><xsl:text>&nl;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Title,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="design/comment2 !=''">
<xsl:text>Comment: </xsl:text><xsl:value-of select="design/comment2"/><xsl:text>&nl;</xsl:text>
<xsl:when test="company !=''">
<xsl:text>Company,</xsl:text><xsl:value-of select="company"/><xsl:text>&nl;</xsl:text>
</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:when test="design/comment3 !=''">
<xsl:text>Comment: </xsl:text><xsl:value-of select="design/comment3"/><xsl:text>&nl;</xsl:text>
<xsl:when test="comment1 !=''">
<xsl:text>Comment,</xsl:text><xsl:value-of select="comment1"/><xsl:text>&nl;</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="design/comment4 !=''">
<xsl:text>Comment: </xsl:text><xsl:value-of select="design/comment4"/><xsl:text>&nl;</xsl:text>
<xsl:when test="comment2 !=''">
<xsl:text>Comment,</xsl:text><xsl:value-of select="comment2"/><xsl:text>&nl;</xsl:text>
</xsl:when>
</xsl:choose>
<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:choose>
<xsl:when test="comment3 !=''">
<xsl:text>Comment,</xsl:text><xsl:value-of select="comment3"/><xsl:text>&nl;</xsl:text>
</xsl:when>
</xsl:choose>
<!-- all table entries -->
<xsl:apply-templates select="components/comp"/>
<xsl:choose>
<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>
<!-- the table entries -->
<xsl:template match="components/comp">
<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