Hi,
I’d like to share a technique for creating C++ and Python bindings. This approach allows you to develop your code both locally and cross-platform. The package includes a PYPI setup with GitHub Actions configured for Linux, Windows, and macOS, making it easy to install via pip
in Rhino’s ScriptEditor.
It’s been successfully tested with several well-known C++ geometry libraries, including:
- CGAL
Documentation of COMPAS CGAL — COMPAS CGAL - libigl + clipper2
compas_libigl — COMPAS Libigl - ShapeOp
compas_shapeop — COMPAS ShapeOp - OpenCascade
GitHub - petrasvestartas/compas_occt: https://petrasvestartas.github.io/compas_occt/latest/
You can even create Python bindings for Fortran using this method! The best part is that data transfer can happen without any copies — from simple collections to unique pointers and classes.
Here’s a step-by-step guide to creating bindings for your own C++ library:
Google Slides Guide
@eirannejad — Your ScriptEditor is awesome! It has made our work at ETH Zurich much easier. Thank you, and keep up the great work!