这是我的班级:
#include <vtkPolyData>
class VTKUtilities
Mesh3D MeshfromVTKPolyData(vtkPolyData* pdmesh)
{
Mesh3D mesh;
//...
//my conversion code to do the actual conversion
//...
return mesh;
}
我试着用SWIG把它包装成python 但是我尝试在python中调用我的函数,如下所示:
^{pr2}$我的错误包括:
NotImplementedError: Wrong number of arguments... for VTKUtilities_MeshfromVTKPolyData
...
Possible prototypes are VTKUtilities::MeshfromVTKPolyData(vtkPolyData *);
我一直在读一些关于排版图的东西,但我想我不必把它搞得一团糟,因为SWIG应该帮我处理这个问题?
有人能告诉我在我的流量广告中遗漏了什么吗?在
这里有一个vtk.i为VTK的类提供SWIG类型映射,并为从SWIG包装的VTK对象派生的项目中定义的类提供内存管理钩子。在
代码
这是完整的代码。这是用VTK 8和SWIG 3.7测试的。请注意,上面的链接包括示例,可能还包括将来的更新。在
如果API使用vtkObjectBase和vtkDataObject,则SWIG.i文件将包括:
^{pr2}$在API中,每个VTK类都会有一个宏调用。在
示例用法
如果定义从vtkObject派生的类或其子类之一dataadapter,SWIG.i文件将包括:
注意,对于类的API中的任何VTK类,包括vtkObjectBase,还需要调用VTK_SWIG_INTEROP。在
我通过以下方法成功地包装了参数为vtkPolyData的函数:
首先,必须在swig
.i
文件中包含vtkPythonUtil:然后,您必须在swig
^{pr2}$.i
文件中映射vtkPolydata:我在ITK itkVTKGlue找到了。在
最后,您需要将模块与库
vtkPythonCore
链接起来相关问题 更多 >
编程相关推荐