Skip to main content

Python binding for the 3Dconnexion's Navigation Library.

Project description

PyNavlib

PyNavlib is a Python extension module that binds original C++ accessors of the 3Dconnexion Navigation Library into a Python code. The binding covers most of the C/C++ API defined within 3Dconnexion’s SDK header <SpaceMouse/CNavigation3D.hpp> and a minimal subset of propietary data types. It was created using pybind11 library.

About 3Dconnexion Navigation Library

The Navigation Library is a part of 3Dconnexion software. It is responsible for handling data exchange between the driver and a client application. The 3Dconnexion SDK provides C/C++ API to interact with the NavLib from within client application's code or plugin. From now on, with PyNavlib binding, it is also possible for the NavLib to be used by Python applications.

Installation

The package was released on PyPI and can be installed using pip.

pip install pynavlib

General usage

The package contains pre-built extension module responsible for binding C++ NavLib accessors to Python. The extension attempts to dynamically load the Navigation Library which is being installed on the system along with 3DxWare. The binding is accessible via interface module called pynavlib_interface.

from pynavlib import pynavlib_interface as pynav

PyNavlib's main class is called NavlibNavigationModel. It is a base class which provides an interface that has to be implemented by derived NavLib client class. The interface consists of setter and getter methods (no underscore preffixed), which are responsible for sending and receiving relevant 3D view data.


class NavlibClient(pynav.NavlibNavigationModel):

    def get_camera_matrix(self) -> pynav.NavlibMatrix:
        return pynav.NavlibMatrix()
    
    def get_model_extents(self) -> pynav.NavlibBox:
        return pynav.NavlibBox(pynav.NavlibVector(-10., -10., -10.), pynav.NavlibVector(10., 10., 10.))

    def get_is_view_perspective(self) -> bool:
        return False

    ...

    def set_camera_matrix(self, matrix) :
        matrix_as_list = matrix._matrix
        print(f'set_camera_matrix:\n{matrix_as_list[0]}\n{matrix_as_list[1]}\n{matrix_as_list[2]}\n{matrix_as_list[3]}\n')
    
    def set_view_extents(self, extents) :
        _min = extents._min
        _max = extents._max
        print(f'set_view_extents: {[_min._x, _min._y, _min._z]}, {[_max._x, _max._y, _max._z]}')
    
    def set_view_fov(self, fov) :
        pass

    ...

To see the full set of overridable setter and getter methods refer to the pynavlib_interface.py source.

Examples

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pynavlib-0.9.1-cp310-cp310-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.10Windows x86-64

pynavlib-0.9.1-cp310-cp310-macosx_12_0_universal2.whl (856.6 kB view details)

Uploaded CPython 3.10macOS 12.0+ universal2 (ARM64, x86-64)

File details

Details for the file pynavlib-0.9.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pynavlib-0.9.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pynavlib-0.9.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 085e461863d62c735c8cb76b2e5b60dbc35683820bd348cb38a70e26f69cb32b
MD5 b31f9d96bdd52f7cf2c6506ae9971427
BLAKE2b-256 674880e06219070722bdf0dfcc3429f2f6399e6ab5c2e963773f7f5b8d9387bd

See more details on using hashes here.

File details

Details for the file pynavlib-0.9.1-cp310-cp310-macosx_12_0_universal2.whl.

File metadata

File hashes

Hashes for pynavlib-0.9.1-cp310-cp310-macosx_12_0_universal2.whl
Algorithm Hash digest
SHA256 92f9cb4a1b8c081fed1c3b6805fd603c189c4985b8a87aa4bebb07cf9c532e4d
MD5 07d343aed962afcdcaa1e14584bfb4b6
BLAKE2b-256 44b779b0cb5e04c2ff8a32c176805b099f3e7ca205866607732b6cb15b6bbe3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page