I am implementing functions using VTK in C++ and trying binding to use these functions in Python.
As you know, if the ‘dataType’ used on the C++ side is not known on the python side, you need to do binding for ‘dataType’.
However, I have a problem when binding a function that uses the VTK dataType as the return type or argument of the function.
// unitFunctionBind.cpp
namespace Test{
vtkSmartPointer<vtkPolyData> get_poly_mesh(const std::filesystem::path &path);
}
// in pybind.cxx
PYBIND11_MODULE(bind_test, m)
{
m.def("get_poly_data", &Test::get_poly_mesh);
}
There is no problem building the code structured as above on the C++ side, but when running it on the python side, the data type related to VTK cannot be read.
Didn’t you bind the vtk type using the ‘cppOwned’ structure? (https://gitlab.kitware.com/cmb/smtk/-/blob/master/smtk/extension/vtk/pybind11/PybindVTKTypeCaster.h)
Until now, I have not been able to bind the VTK dataType directly, so I once again wrapped it with a data type known on the Python side.
In conclusion, I am curious about a way to directly bind VTK dataType. Thanks for reading.