Getting started¶
Use the SIDRA INTERSECTION API to create and update projects, work with Site and Network data, run analyses, and read results from your own applications. From SIDRA INTERSECTION 11.0.4 it also works with SIDRA ASSIGN data: Assign Volume Bins, O-D trip matrices and assignment results. See SIDRA ASSIGN. This page gets a working "hello world" running against it.
Windows 64-bit · .NET 8 · C# / VB.NET · C++ · Python · VBA
Prerequisites¶
- SIDRA INTERSECTION 11.0.4 installed and licensed. The API
is included with your SIDRA INTERSECTION licence at no extra charge. The
installer registers the COM type library (
SIDRASolutions.SI.API.tlb) and the .NET COM host (SIDRASolutions.SI.API.comhost.dll). - A 64-bit host process. The API is
net8.0-windowsx64-only and cannot be loaded into a 32-bit process. Set your project's Platform target tox64(notAnyCPU). - .NET 8 runtime present on the machine. The SIDRA INTERSECTION installer satisfies this.
- Which version you need. Programs written for SIDRA INTERSECTION 11.0.3
also run on 11.0.4, with one change: setting
ISIAPIMovementClass.Display_idno longer has any effect (see Release notes). The SIDRA ASSIGN types are new in 11.0.4, so a program that uses them needs 11.0.4 or later.
Your application can check the installed copy with
ISIAPI.IsLicensed, which
returns false for an unlicensed copy. See
Licensing for licence requirements.
Supported languages¶
The API is a .NET 8 assembly for 64-bit Windows. The host process must be 64-bit in every language.
| Language | How it accesses the API |
|---|---|
| C# / VB.NET | Reference the late-binding wrapper LB_SI11API.dll, targeting net8.0-windows and x64. |
| C++ | Use the COM type library registered by the SIDRA INTERSECTION installer. |
| Python | Use Python.NET to host the .NET 8 runtime and load the API assembly directly. |
| VBA | Through COM, as for C++. Microsoft Office must be 64-bit. Our VOLUMES Excel utility is a worked example. |
Add the reference¶
C# / VB.NET¶
The API ships with a late-binding wrapper assembly, LB_SI11API.dll, that
exposes the SIDRASolutions.SI.API types and loads the installed SIDRA
INTERSECTION runtime at run time. Reference it directly instead of going
through COM:
- Download the Version 11 late-binding wrapper
and extract
LB_SI11API.dlland itsLB_SI11API.deps.jsoninto your project. - Add an assembly reference to it (a
<Reference Include="LB_SI11API">with a<HintPath>; see the C# sample). - Target
net8.0-windowsand x64 (notAnyCPU).
C++¶
Use the installed SIDRASolutions.SI.API.tlb type library from a 64-bit
Visual C++ project with ATL. Initialise COM on an STA thread before creating
the API object. The C++ sample includes the type-library
import, build instructions and cleanup.
Python (Python.NET)¶
Python does not go through COM. Use Python.NET
(pythonnet) to host the .NET 8 runtime and load the API assembly directly:
import os
from pythonnet import set_runtime
from clr_loader import get_coreclr
sidra = r"C:\Program Files\SIDRA SOLUTIONS\SIDRA INTERSECTION 11"
# Host the API's own .NET 8 runtime via its runtimeconfig, then load the DLL.
set_runtime(get_coreclr(
runtime_config=os.path.join(sidra, "SIDRASolutions.SI.API.runtimeconfig.json")))
import clr
clr.AddReference(os.path.join(sidra, "SIDRASolutions.SI.API.dll"))
from SIDRASolutions.SI.API import SIAPI
api = SIAPI()
See the Python sample for locating the install folder from the registry and reading results.
Open a project and read its name¶
using System;
using SIDRASolutions.SI.API;
class Program
{
[STAThread]
static void Main()
{
var api = new SIAPI();
try
{
if (!api.IsLicensed)
throw new InvalidOperationException("SIDRA INTERSECTION must be licensed.");
if (!api.OpenProject(@"C:\Samples\MyProject.sipx"))
throw new InvalidOperationException(api.LastErrorMessage);
ISIAPIProject project = api.Project;
Console.WriteLine($"Opened: {project.Name}");
Console.WriteLine($"Site folders: {project.SiteFolders.Count}");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
if (ex.InnerException != null)
Console.WriteLine(ex.InnerException.Message);
}
finally
{
api.Close();
}
}
}
The entry interface is always ISIAPI.
Once a project is open, ISIAPI.Project returns the
ISIAPIProject wrapper which is
your gateway to Sites (intersections), Networks and analyses.
Next steps¶
- Object model: the
Project -> Site -> Leg -> Lanehierarchy. - SIDRA ASSIGN: build O-D trip matrices, process an Assign Network and read its results. New in 11.0.4.
- Code samples: choose a short C#, C++ or Python walkthrough.
- Sample project guide: download the larger examples and follow their explanations and run instructions.
- Downloads: the sample ZIP, wrapper files and workshop materials.
- Previous versions: API Help, wrappers and sample projects for SIDRA INTERSECTION 10 and 9.1.
- Troubleshooting: if the API fails to load, activate, or open your project.