2 Replies Latest reply on Aug 6, 2013 10:39 PM by markus.reich

    Find net name connected to a part


      For analyses I want to find out which nets are connected to a specific part.


      I tried following

      ForEach cmpIn dxdApp.DesignComponents("", schName, -1, "STD", True)
        ForEach ConnIn cmp.GetConnections
          Set Net = Conn.Net
          Set CmpPin = Conn.CompPin
          If Not NetIsNothingThen
            If Not cmp.Refdes = ""Then
              Fileout.WriteLine (cmp.Refdes & "Net Attached to " & CmpPin.Pin.Label.TextString & Netzname)


      However I only get the Pin label and not the net name. What do I have to change?

        • 1. Re: Find net name connected to a part

          It looks like you've got an error in your code.  You're using a variable called Netzname, it should probably be Net.GetSignals() and you'd have to go through the list.



          • 2. Re: Find net name connected to a part

            I solved it now this way:


            Dim sSchematic, sSheet, dxdapp

            Dim ProjDir,ProjName

            'if isEmpty(dxdapp) then

              Set dxdapp = GetObject(,"Viewdraw.Application")

            'End If

              Dim dxdview:  Set dxdview = dxdapp.ActiveView

            Dim dxdblock: Set dxdblock = dxdview.ActiveBlock

            Dim SymName, SymVersion, SymPath, Net


            Dim fso

            Set fso = CreateObject("Scripting.FileSystemObject")

            Dim file

            ProjDir  = dxdapp.GetProjectData.GetProjectPath


            Set file = fso.OpenTextFile(ProjDir & "\Connections.txt", 2, true )


            For Each sSchematic In Application.SchematicSheetDocuments.GetAvailableSchematics

                For Each sSheet In Application.SchematicSheetDocuments.GetAvailableSheets(sSchematic)

                    Application.SchematicSheetDocuments.Open sSchematic, sSheet

                        For Each comp in dxdapp.Query(VDM_COMP, VD_ALL)

                            For Each Conn In comp.GetConnections

                                Set Net = Conn.Net

                                Set CmpPin = Conn.CompPin

                                If Not Net Is Nothing Then

                                    ' Find the net label

                                    For Each seg in Net.GetSegments

                                         If Not conn.Net.GetLabel(seg) Is Nothing Then

                                                If Not comp.Refdes = "" Then

                                                    file.WriteLine (comp.Refdes & " " & Net.GetLabel(seg).TextString & " attached to Pin " &  CmpPin.Pin.Label.TextString)       

                                               'MsgBox Net.GetLabel(seg).TextString  & " attached to " & CmpPin.Pin.Label.TextString

                                                end if

                                        end if


                                end if






            MsgBox "Fertig"


            Set file  = nothing



            One thing: I also get the parts with Refdes "R?"