Skip to content

VB.NET sample

Imports SIDRASolutions.SI.API

Module Program
    Sub Main()
        Dim apiType = Type.GetTypeFromProgID("SIDRASolutions.SI.API")
        If apiType Is Nothing Then
            Throw New InvalidOperationException(
                "SIDRA Intersection COM API is not registered. See COM activation.")
        End If

        Dim api As ISIAPI = CType(Activator.CreateInstance(apiType), ISIAPI)

        Try
            api.OpenProject("C:\Samples\Demo.sip")

            Dim project = api.Project
            Console.WriteLine($"Project: {project.Name}")

            api.Analysis.Run()

            For f = 0 To project.SiteFolders.Count - 1
                Dim folder = project.SiteFolders(f)
                For s = 0 To folder.Sites.Count - 1
                    Dim site = folder.Sites(s)
                    For i = 0 To site.Intersections.Count - 1
                        Dim intersection = site.Intersections(i)
                        Console.WriteLine($"  {intersection.Name}: LOS = {intersection.LevelOfService}")
                    Next
                Next
            Next
        Finally
            Marshal.FinalReleaseComObject(api)
        End Try
    End Sub
End Module

Project setup

Same as the C# sample: target net8.0-windows, x64 platform, COMReference to SIDRASolutions.SI.API.dll with EmbedInteropTypes set to True.