Wednesday, June 15, 2011

Via Rules

Get the details of the via routing style rule.

Sub GetViaRule

Dim Board
Dim tmpStr

Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub

Iterator = Board.BoardIterator_Create
Iterator.AddFilter_ObjectSet(MkSet(eRuleObject))
Iterator.AddFilter_LayerSet(AllLayers)
Iterator.AddFilter_Method(eProcessAll)
Set Rule = Iterator.FirstPCBObject

While Not (Rule Is Nothing)

 If  Rule.Rulekind =  eRule_RoutingViaStyle Then
 tmpStr = "Name: " & Rule.Name & vbcrlf
 tmpStr = tmpStr & "Pref Via Width: " & CoordtoMils(Rule.PreferedWidth)
 tmpStr = tmpStr & "mils" & vbcrlf
 tmpStr = tmpStr & "Min Via Width: " & CoordtoMils(Rule.MinWidth)
 tmpStr = tmpStr & "mils" & vbcrlf
 tmpStr = tmpStr & "Max Via Width: " & CoordtoMils(Rule.MaxWidth)
 tmpStr = tmpStr & "mils" & vbcrlf
 tmpStr = tmpStr & "Pref Via Hole Width: " & CoordtoMils(Rule.PreferedHoleWidth)
 tmpStr = tmpStr & "mils" & vbcrlf
 tmpStr = tmpStr & "Min Via Hole Width: " & CoordtoMils(Rule.MinHoleWidth)
 tmpStr = tmpStr & "mils" & vbcrlf
 tmpStr = tmpStr & "Max Via Hole Width: " & CoordtoMils(Rule.MaxHoleWidth)
 tmpStr = tmpStr & "mils" & vbcrlf
 tmpStr = tmpStr & "Scope1: " & Rule.Scope1Expression & vbcrlf
 tmpStr = tmpStr & "Scope2: " & Rule.Scope2Expression
 ShowMessage( tmpStr )
 End If

 Set Rule = Iterator.NextPCBObject
Wend

Board.BoardIterator_Destroy(Iterator)
End Sub




www.tdpcb.com