Language Interface Setup

The NxLib API is available from C and through wrappers for other programming languages. This page shows the basic steps for using the language interfaces in your program.

C and C++

The headers and the import library (on Windows) for NxLib and NxLibRemote are located in $ENSENSO_INSTALL/development/c/.

On Linux you can use CMake to set up the include path and link NxLib or NxLibRemote:

find_package(NxLib CONFIG REQUIRED)
target_link_libraries(<YOUR TARGET> PRIVATE NxLib::NxLib)
find_package(NxLibRemote CONFIG REQUIRED)
target_link_libraries(<YOUR TARGET> PRIVATE NxLibRemote::NxLibRemote)

Alternatively, pkg-config files are installed with the SDK:

pkg-config --cflags --libs ensenso-nxlib

In the source code, include the NxLib header:

#include <nxLib.h>

The C interface is documented in the C API reference, the C++ wrapper in the C++ API reference.

Note

The code snippets omit includes for simplicity. They usually require an include of the nxLib.h header as well as some standard library headers.

Python

The Python package nxlib is installed from the SDK or from PyPI. To install it from the SDK installation:

pip3 install --upgrade --force-reinstall --find-links "$ENSENSO_INSTALL/development/python" nxlib

Or from PyPI, matching your SDK version:

pip3 install --upgrade nxlib==<Installed Ensenso SDK Version>

In the source code, import the package:

from nxlib import NxLib, NxLibItem, NxLibCommand
from nxlib.constants import ITM_CAMERAS

See the Python API reference for the full documentation.

Note

The Python snippets omit any imports for simplicity. They usually require imports from the nxlib package as well as imports of the constants (ITM_*, CMD_*, VAL_*) from nxlib.constants.

.NET

The NuGet package Ensenso.NxLib ships with the SDK and is also hosted on nuget.org:

dotnet add package Ensenso.NxLib -v <VERSION> -s $ENSENSO_INSTALL/development/dotnet

In the source code, import the namespace:

using Ensenso;

See the .NET API reference for the full documentation.

Note

The C# snippets omit the namespace import for simplicity.