0 Replies Latest reply on Sep 5, 2018 6:29 AM by cathy_terwedow

    How to find a CompPin's pin type

    cathy_terwedow

      Admin's note: This topic was split off from the thread on Re: xDxDesigner - readout Attribute which is multiple times on the same Sheet via Automation

       

      Hi Peter,

       

      I am a new associate AE who is on board this year. I am learning DxDesigner automation recently.

      Here I have a question. Could you help me and answer my question?

       

      According to your discussion, we can read symbol level value by objComp.SymbolBlock.Attributes. However, If I want to read the symbol value of a CompPin's pin type, objCompPin.SymbolBlock.findattribute(""Pin Type") is not available. Is there any method to read the symbol value of pin type when there is no block value?

       

      Best regards,

      Xiaowen Min

       

      Here enclose part of my script:

      For Each Conn In Comp.GetConnections()

      Set CompPin = Conn.CompPin

      If Not CompPin Is Nothing Then

      Set Pin = CompPin.Pin

      Set Net = Conn.Net

      PinUID = Pin.UID

      PinNumber = CompPin.Number

      Dim Attr

      Set Attr = CompPin.FindAttribute("Pin Type")

      If Attr Is Nothing Then

      PinType = "No PINTYPE"

      Else

      PinType = Attr.Value

      End If

      ...

      ...

       

       

      •  

        Re: xDxDesigner - readout Attribute which is multiple times on the same Sheet via Automation
        Stefan HaasHello mxw to Readout PinType, and Sense, you do: First get a Componet, than its PinObject   '# Get the connections(pins) on the symbol
          Dim pinObj As ViewDraw.IVdObjs
          Set pinObj = comp.GetConnections()
          For x = 1 To pinObj.Count()      Dim theConnection As ViewDraw.Connection
              Set theConnection = pinObj.Item(x)
              Dim pinType As ViewDraw.VdObjectType
              pinType = theConnection.CompPin.Type
              Dim theSense As String
              theSense = getPinSense(theConnection)
                                 
              Dim pinDirection As String
              pinDirection = getPinDirection(theConnection)
        next x Function getPinSense(theConnection As ViewDraw.Connection) As String         '#
                 '# inverted or not
                 Dim Sense As ViewDraw.VdSense
                 Sense = theConnection.CompPin.pin.Sense
                                         
                 Dim theSense As String
                 Select Case Sense
                        Case ViewDraw.VdSense.VDINVERTED
                             theSense = "Inverted"
                        Case ViewDraw.VdSense.VDNOTINVERTED
                             theSense = "NotInverted"
                        Case Else
                             theSense = "?"
                 End Select
                
                 '# alternative idea for
                 '# inverted/notInverted Pin/Signal
                 If 1 Then
                   
                    Dim PinName As String
                        PinName = theConnection.CompPin.pin.GetName(ViewDraw.VdNameType.SHORT_NAME)  'pin Name
                
                    If Left(PinName, 1) = "~" Then
                       theSense = "Inverted"
                    Else
                       theSense = "NotInverted"
                    End If
                 End If
                 getPinSense = theSenseEnd Function Function getPinDirection(theConnection As ViewDraw.Connection) As String         Dim pinDirection As String
                     pinDirection = ""
               
                 '# We try to get Pin Direction
                 '# (Pin = in, out, bi, ...)
                 Dim numOfAttributes As Integer
                     numOfAttributes = theConnection.CompPin.pin.Attributes.Count
                
                 Dim j As Integer
                
                 Dim attribPinTypeFound As Boolean
                     attribPinTypeFound = False
                    
                 For j = 1 To numOfAttributes
                   
                    Dim pinAttrib As ViewDraw.Attribute
                    Set pinAttrib = theConnection.CompPin.pin.Attributes.Item(j)
                   
                    'Debug.Print "attributeName: " & pinAttrib.name & " --> Value: " & pinAttrib.Value
                    
                    Dim attribName As String
                    Dim attribValue As String
                    Dim attribTextString As String
                    
                    attribName = pinAttrib.name
                    attribValue = pinAttrib.Value
                    attribTextString = pinAttrib.TextString
                   
                    pinDirection = ""
                              
                   
                    If attribName = "Pin Type" Then
                      
                       If attribValue <> "" Then
                          pinDirection = attribValue
                          attribPinTypeFound = True
                          Exit For
                       ElseIf attribValue = "" Then
                              pinDirection = "?"
                       ElseIf attribTextString = "" Then
                      
                       Else
                           pinDirection = "??"
                       End If
                      
                    ElseIf attribName = "BlahBlah" Then
                   
                    ElseIf attribName = "VHDL_PORT" Then
                   
                    ElseIf attribName = "VHDL Type" Then
                   
                    Else
                   
                    End If
                    
                 Next j
                
                 If attribPinTypeFound = False Then
                    pinDirection = "Property Not Found"
                 End If
                
                 '# Return our Result
                 getPinDirection = pinDirection
          
        End Function

        Check the "getPinDirection" Function, it loops manually through each AttributeIn my case it works perfect. Hope this can guide you a little bit further.regards Stefan

         

      •  

        Re: xDxDesigner - readout Attribute which is multiple times on the same Sheet via Automation
        Peter FestesenHello - thanks for reaching out to the community ! I will have to do some digging. /Peter