wiki:BindingToPython
Last modified 11 years ago Last modified on 09/21/11 12:31:08

Binding to Python

To bind a MeshKit algorithm to Python, you'll need to add some SWIG code to meshkit/python/algs.i and meshkit/python/algs_factory.i. Specifically:

algs.i (near the bottom)

%include "meshkit/MyNewAlgorithm.hpp"

algs_factory.i

#include "meshkit/MyNewAlgorithm.hpp"

...

%factory(MeshKit::MeshOp * MeshKit::MKCore::construct_meshop,
         ...
         MeshKit::MyNewAlgorithm);

If this doesn't work, you may need to add bindings for other classes that your algorithm depends on (e.g. MeshKit::CopyMesh requires MeshKit::Transform). If this *still* doesn't work, you'll have to consult the SWIG documentation, or ask the Fathom list for assistance.