make FemResultObject extensible in python as FemSolverObject

This commit is contained in:
qingfengxia 2016-09-14 22:42:56 +01:00
parent 279418f032
commit 73377204a1
2 changed files with 10 additions and 0 deletions

View File

@ -161,6 +161,7 @@ PyMODINIT_FUNC initFem()
Fem::ConstraintFluidBoundary ::init();
Fem::FemResultObject ::init();
Fem::FemResultObjectPython ::init();
Fem::FemSolverObject ::init();
Fem::FemSolverObjectPython ::init();

View File

@ -27,6 +27,7 @@
#endif
#include "FemResultObject.h"
#include <App/FeaturePythonPyImp.h>
#include <App/DocumentObjectPy.h>
using namespace Fem;
@ -96,6 +97,14 @@ template<> const char* Fem::FemResultObjectPython::getViewProviderName(void) con
}
/// @endcond
template<> PyObject* Fem::FemResultObjectPython::getPyObject(void) {
if (PythonObject.is(Py::_None())) {
// ref counter is set to 1
PythonObject = Py::Object(new App::FeaturePythonPyT<App::DocumentObjectPy>(this),true);
}
return Py::new_reference_to(PythonObject);
}
// explicit template instantiation
template class AppFemExport FeaturePythonT<Fem::FemResultObject>;