Skip to content

How to Add Python APIs?

Python APIs in ShapeWorks are pybind wrappers of C++ functions and additions/modifications can be made in Python/shapeworks/ShapeworksPython.cpp

  • Header file must be included.

  • To add a new class,

py:class_<c++ClassName> objectName(m, "pythonClassName);
  • To add a new function,
objectName.def("pythonFunctionName", &c++ClassName::c++FunctionName, "description/help", "argument1"_a, "argument2"_a=defaultValue)

For more information on how to add pybind bindings, check out pybind documentation.