netform.cpp: added in intermediate netlist the pin list of each component in schematic. Some netlist formats (spice, orcadpcb2) are very simple to create with this pins list.

This commit is contained in:
jean-pierre charras 2010-08-29 21:35:50 +02:00
commit 84a009f70f
1 changed files with 24 additions and 1 deletions

View File

@ -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 );
}
}
}