'Version 1.02 Dim SlavePinArray(100,1) As String Option Explicit Sub Main() Dim CompObj As Object Dim PinObj As Object Dim TempPinObj As Object Dim AttrObj As Object Dim report As String Dim Goo As String Dim MainNet As String Dim SlavePin As String Dim SwapSlavePin As String Dim Net As PowerLogic.Net Dim Pin As PowerLogic.Pin Dim Counter As Integer Dim First As Boolean first = True 'On Error Resume Next report = Application.DefaultFilePath & "\Signal.eco" Open report For Output As #1 Print #1, "*PADS-ECO-V3.0-MILS*" For Each CompObj In ActiveDocument.Components SlavePin ="0" counter = 0 For Each AttrObj In CompObj.Attributes If LCase(Left(AttrObj.Name, 13)) = "sch.slavepins" Then 'if attributevalue is empty then do nothing If attrobj.Value <> "" Then 'Net name of the MasterPin Set Pin = ActiveDocument.Pins.Item(PinName(Masterpin(AttrObj.Value), CompObj.Name)) MainNet = Pin.Net 'Tuhotaan SlavePinin netit While SlavePin <> "" SlavePin = GetSlavePin(AttrObj.Value,Counter,CompObj.Name) Set TempPinObj = ActiveDocument.Pins.Item(SlavePin) If slavepin <> "" Then If TempPinObj.Net Is Nothing Then Else slavepinarray(counter,0) = slavepin slavepinarray(counter,1) = TemppinObj.Net.Name End If End If Counter = Counter + 1 Wend counter =0 If SlavepinArray(0,0) <> "" Then Print #1,"*DELPIN*" While slavepinarray(counter,0) <> "" Print#1,SlavePinArray(counter,0);" "; SlavePinArray(counter,1) counter = counter +1 Wend End If Erase slavepinarray counter = 0 'Muutetaan Slavepinien Netit counter = 0 SwapSlavePin = "0" While SwapSlavePin <>"" SwapSlavePin = GetSlavePin(AttrObj.Value,Counter,CompObj.Name) SlavePin = Slavepin & " " & SwapSlavePin Counter = Counter + 1 Wend Print #1,"*NET*" Print #1,"*SIGNAL*" ;" "; MainNet;" ";12 Print #1,Slavepin End If End If counter = 0 Next Next Print #1,"*END*" Close #1 ActiveDocument.ImportECO(report) End Sub Private Property Get Masterpin(AttributeValue As String) As String Dim AttrValue As String Dim j As String Dim sana As String AttrValue = AttributeValue Masterpin = Trim(Left(AttrValue,InStr(1,AttrValue," "))) 'Masterpin = Left(AttributeValue, 1) End Property Private Function GetSlavePin(AttribVal As String, Index As Integer,Component As String) As String 'Returns name of the slave pin name defined by index Dim AttrValue As String Dim TempComp As PowerLogic.Component Dim Pinobj As Object Dim PinName As String Dim SpaceCounter As Integer Dim SpaceStarted As Boolean Dim SlavePinName As String AttrValue= AttribVal AttrValue = Trim(getdatabyindex(index+1,attribval)) If attrvalue <> "END" Then Set TempComp = ActiveDocument.Components.Item(Component) 'Määritellään pininumeron perusteella pinin nimi For Each Pinobj In TempComp.Pins If UCase(pinobj.Name) = UCase(tempcomp.Name & "." & attrvalue) Then SlavePinName = pinobj.Name End If Next Else attrvalue = "" End If GetSlavePin = SlavePinName End Function Private Property Get PinName(PinNum As String, componentName As String) As String 'Maaritellaan attribuutista saadun pinin koko nimi esim: A -> D1.A Dim TempComp As PowerLogic.Component Dim TempPin As PowerLogic.Pin Set TempComp = ActiveDocument.Components.Item(componentName) For Each TempPin In TempComp.Pins If TempPin.Number = PinNum Then PinName = TempPin.Name If UCase(temppin.Name) = UCase(tempcomp.Name & "." & pinnum) Then pinname = temppin.Name Next End Property Function EmptyMem() Dim Counter As Integer While SlavePinArray(counter,0) <> "" SlavePinArray(counter,0) = "" SlavePinArray(counter,1) = "" counter = counter +1 Wend End Function Private Function GetDataByIndex(Index As Integer, Line As String) As String 'Ottaa rivista indexin maarittaman tiedon Dim Counter As Integer Dim Place As Integer Place = 1 If Index = 0 And Len(Line) = 1 Then GetDataByIndex = Line Else While Counter < Index And Place <= Len(Line) If Mid(Line, Place, 1) = " " Then Counter = Counter + 1 While Mid(Line, Place, 1) = " " Place = Place + 1 Wend Else Place = Place + 1 End If Wend If Place > Len(Line) Then GetdataByIndex = "END" Else If InStr(Place, Line, " ") = 0 Then GetDataByIndex = Mid(Line, Place, Len(Line)) Else GetDataByIndex = Mid(Line, Place, InStr(Place, Line, " ") - Place) End If End If End If End Function