Assign via on Net using vb script in Pads Layout

Discussion created by venkateswaran.k on Aug 16, 2013
Latest reply on Aug 16, 2013 by vladimir.stoyanov
I have requirement to assign a via on the nets which has without any via points. So i have written automation script using vb to assign via on net here the issue is not assigning any via on net.


I appreciate your help on this.


Sub Main()


Dim PowerPcbapp As Object
Dim docu As Object
Set PowerPcbapp = GetObject(, "PowerPCB.Application")
Set docu = PowerPcbapp.ActiveDocument


Set PowerPcbapp = Nothing
tpnts = GetviaPoints(docu, True)
'MsgBox Pcbapp.ActiveDocument.Name


End Sub
Function GetviaPoints(doc As Object, Optional Sorted As Boolean = False)
Set GetviaPoints = doc.GetObjects(0)
Set nets = doc.nets
If Sorted Then nets.Sort
For Each aNet In nets
Set vias = aNet.vias
If vias.Count > 0 Then
viaavail = True
viaavail = False
GetviaPoints.Add aNet
End If


End Function


venkateswaran K