tomkcook wrote: ↑
Fri Jun 14, 2019 5:04 pm
If not, what's involved in creating one? Can you point me towards an example? Or some documentation? I'm a reasonably competent C, C++ & Python programmer and I'm already building FreeCAD from source, but have very little background in the FreeCAD source code.
This sounds like it would fit in .../Mod/Part/App/AppPartPy.cpp or maybe in one of the TopoShape related xxxxxPyImp.cpp files.
The basic structure of a program to expose functionality to Python is something like this:
- get the Py object parameters and convert them to c++ variables using PyArg_ParseTuple(),
- use various c++ routines from OpenCascade and/or FreeCAD to produce the desired result,
- convert the c++ result into Py object using routines like PyLong_AsLong(), Py::asObject(), etc,
- return the Py object.
Most of the c++ modules have an AppModule
Py.cpp that you can borrow code from.