Views:

Question

How to execute a PuT shortest path search by COM?

Answer

Use a RouteSearchPuT Object, that is given a NetElements container with network elements. An example could look like this:

Option Explicit


Sub shortest_path_search_OV()
Dim Visum As New VISUMLIB.Visum
Dim aLink As VISUMLIB.ILink
Dim aNode As VISUMLIB.INode
Dim aZone1 As VISUMLIB.IZone
Dim aZone2 As VISUMLIB.IZone
Dim aNetElementContainer As VISUMLIB.INetElements
Dim aRouteSearchPuT As VISUMLIB.IRouteSearchPuT


Visum.LoadVersion ActiveWorkbook.Worksheets("Einstellungen").Cells(1, 2)

Set aNetElementContainer = Visum.CreateNetElements
Set aRouteSearchPuT = Visum.Analysis.RouteSearchPuT
Set aZone1 = Visum.Net.Zones.ItemByKey(Cells(7, 2).Value)
Set aZone2 = Visum.Net.Zones.ItemByKey(Cells(8, 2).Value)

aNetElementContainer.Add aZone1
aNetElementContainer.Add aZone2

aRouteSearchPuT.Execute aNetElementContainer, "P", "08:00:00", "1", False, "ADDVAL1", False

End Sub

 

A more complex example is attached to this article.

 

 

Related Attachments (1)