From 4264ddb0610c1c98ad76a4d037c0e74e01770b23 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 29 Aug 2010 21:33:29 +0200 Subject: [PATCH] netform.cpp added in intermediate netlist the pin list for each component in schematic. Some netlist formats (spice, orcadpcb2) are very simple to create with this pins list. --- eeschema/netform.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/eeschema/netform.cpp b/eeschema/netform.cpp index c67e9c27d2..8c4d180f9f 100644 --- a/eeschema/netform.cpp +++ b/eeschema/netform.cpp @@ -923,6 +923,9 @@ XNODE* EXPORT_HELP::makeGenericComponents() wxString sLib = wxT( "lib" ); wxString sPart = wxT( "part" ); wxString sNames = wxT( "names" ); + wxString sPinNum = wxT( "num" ); + wxString sPinNetname = wxT( "netname" ); + wxString sPinNetcode = wxT( "netcode" ); m_ReferencesAlreadyFound.Clear(); @@ -936,7 +939,7 @@ XNODE* EXPORT_HELP::makeGenericComponents() { for( EDA_BaseStruct* schItem = path->LastDrawList(); schItem; schItem = schItem->Next() ) { - SCH_COMPONENT* comp = findNextComponent( schItem, path ); + SCH_COMPONENT* comp = findNextComponentAndCreatPinList( schItem, path ); if( !comp ) break; // No component left @@ -1000,6 +1003,26 @@ XNODE* EXPORT_HELP::makeGenericComponents() timeStamp.Printf( sTSFmt, comp->m_TimeStamp ); xcomp->AddChild( node( sTStamp, timeStamp ) ); + + // Add pins list for this cmponent. + // Usedful to build netlist which have pads connection inside the footprint description + // (Spice, OrcadPCB2 ...) + XNODE* xpinslist; + xcomp->AddChild( xpinslist = node( sPins ) ); + for( unsigned ii = 0; ii < m_SortedComponentPinList.size(); ii++ ) + { + NETLIST_OBJECT* Pin = m_SortedComponentPinList[ii]; + if( !Pin ) + continue; + XNODE* xpin; + xpinslist->AddChild( xpin = node( sPin ) ); + wxString text; + xpin->AddAttribute( sPinNum, Pin->GetPinNumText() ); + sprintPinNetName( &text, wxT( "N-%.6d" ), Pin ); + xpin->AddAttribute( sPinNetname, text ); + text.Printf( wxT( "%d" ), Pin->GetNet() ); + xpin->AddAttribute( sPinNetcode, text ); + } } }