AnsweredAssumed Answered

In DxDesigner script, list all symbols attached to a net/symbol?

Question asked by pete.osborne on Oct 28, 2019

Does anyone have a code snippet of how to generate a list of all the components attached to a given net/symbol? 

 

Specifically, what I am trying to do is ... On a schematic sheet that contains on/off sheet (annotate type) symbols, find all of the component pins that are attached to that symbol.

In the example above, I would like to generate an output that looks something like this:

 

I have the code working nicely to grab the information pertaining to the On/Off sheet symbol.  I just haven't figured out how to backtrack down the net to the attached components.

 

' Get the information from the On/Off Page connectors - they are type annotate.
For Each oComp in oAllComps
        ' This function just filters out all symbols that are not annotate
          If IsAnnotate(oComp, sLevel) then
              sSymName = ""
              sSymID = ""
              sNetName = ""
            
            'Only worry about symbols that have a connection
              If Not oComp.GetConnections Is Nothing Then
              
                  'get the symbol name
                  sSymName = oComp.SymbolBlock.GetName(ViewDraw.VdNameType.FULL_PATH_FROM_BLOCK)
                
                  'get the symbol id
                  sSymID = oComp.GetName(0)
              
                  'Capture the Pins (should only be one) and Net information
                For Each oConnection in oComp.GetConnections
                    'If there is a net attached
                    If Not oConnection.Net Is Nothing Then
                        'The symbol will have a pin
                        If not oConnection.CompPin.Pin Is Nothing then

                            'get the net name off of the net segment
                            If Not oConnection.Net.GetSegments is nothing then
                                For each oSeg in oConnection.Net.GetSegments
                                     If Not oConnection.Net.GetLabel(oSeg) Is Nothing Then
                                        sNetName = oConnection.Net.GetLabel(oSeg).TextString
                                    End If
                                Next
                            end if
                        end if
                    End If
                  Next
              End If

            'Add the info to a collection to be used later
            If sNetName <> "" then
                sValue = sSymID & sDelim & sSymName & sDelim & sNetName        
                sKey = cstr(iKeyIndex)
                 Do Until NOT collAnnos.Exists(sKey)
                     iKeyIndex = iKeyIndex + 1
                     sKey = cstr(iKeyIndex)
                 Loop
        
                collAnnos.Add sKey , sValue
            End If
            
            iCompCount = iCompCount + 1
            
        End If        
    Next

Any advise would be appreciated.

Outcomes