Monday, March 19, 2012

Net Classes and the members

Iterate through the net classes and the members but skip pass any net class that begins with "All"

Sub ClassMembers
Dim I
' Checks if the current document is a PCB document
  Set Board = PCBServer.GetCurrentPCBBoard
  If Board is Nothing Then Exit Sub
  Iterator = Board.BoardIterator_Create
  Iterator.AddFilter_ObjectSet(MkSet(eClassObject))
  Iterator.AddFilter_LayerSet(AllLayers)
  Set NetClass = Iterator.FirstPCBObject
  I = 0

  While Not (NetClass Is Nothing) 'Get Net Classes
    If NetClass.MemberKind = eClassMemberKind_Net Then
       If Left(NetClass.Name,3) <> "All"   Then  'Ignore any class the begins with "All"
           ShowMessage NetClass.Name & " is a netclass"
        
          While NetClass.MemberName(I) <> ""
              ShowMessage NetClass.MemberName(I) & " is in the netclass " & NetClass.Name
              I = I + 1
          Wend
       End If

       I = 0
    End if
    Set NetClass = Iterator.NextPcbObject
  Wend

Board.BoardIterator_Destroy(Iterator)
End Sub



www.tdpcb.com