AnsweredAssumed Answered

Netlist report (alphanumerical sort) with vbs script

Question asked by cristiano.murtas on Mar 22, 2013
Latest reply on Mar 26, 2013 by matheisl.florian

Hello, everyone!
I'm working on a script to get a netlist in this format:

 

NetClassNetNamePinCountAll_Ref.Pin (not sorted)
CHANNELNET_A3JA1.1,CNT1_1.2,JA2.1,
CHANNELNET_B5C2_1.2,C1_1.2,DUT.54,DUT.328,DUT.250,
CHANNELNET_C3JA1.3,JA2.3,CNT2_1.2,
CHANNELNET_D3DUT.432,C4_1.2,CNT2_1.1,

 

 


The problem is that I can sort only NetName, I don't know how to sort comp.ref.pin (All_Ref.Pin column) information extracted from netlist.

Here the vbs code used:

 

'***********************************************************

' Get a collection of nets.
Dim netColl   ' Collection of all nets
Dim netObj   ' Net object for iteration
Dim countNet
Set netColl = pcbDocObj.Nets
Dim pin

' Sort the component collection
   Call netColl.Sort()
  
countNet = 0


' Iterate through all nets
For Each netObj In netColl
' Report information on each net.
txtStreamObj.Write(netObj.NetClass)
txtStreamObj.Write(vbTab & netObj.Name)
countNet = countNet + 1
txtStreamObj.Write(vbTab & netObj.Pins.Count & vbTab)
   For Each pin In netObj.Pins
    txtStreamObj.Write(pin.component.refdes & "." & pin.name & ",")
   Next
txtStreamObj.WriteLine()
Next

'***********************************************************

 


Below you can see an example of what I need:

 

NetClassNetNamePinCountAll_Ref.Pin (sorted)
CHANNELNET_A3CNT1_1.2,JA1.1,JA2.1,
CHANNELNET_B5C1_1.2,C2_1.2,DUT.54,DUT.250,DUT.328,
CHANNELNET_C3CNT2_1.2,JA1.3,JA2.3,
CHANNELNET_D3C4_1.2,CNT2_1.1,DUT.432,

 


Any idea, suggestion are appreciated.
Thanks
Best regards
Cris

Outcomes