FEM: extend the C++ fem mesh object to be able make python mesh object childs

This commit is contained in:
Bernd Hahnebach
2016-11-22 19:47:50 +01:00
parent 1c0920d624
commit 9f8a7b8642
7 changed files with 47 additions and 2 deletions

View File

@@ -29,6 +29,7 @@
#include "FemMeshObject.h"
#include "FemMesh.h"
#include <App/DocumentObjectPy.h>
#include <App/FeaturePythonPyImp.h>
#include <Base/Placement.h>
using namespace Fem;
@@ -70,3 +71,25 @@ void FemMeshObject::onChanged(const Property* prop)
}
}
// Python feature ---------------------------------------------------------
namespace App {
/// @cond DOXERR
PROPERTY_SOURCE_TEMPLATE(Fem::FemMeshObjectPython, Fem::FemMeshObject)
template<> const char* Fem::FemMeshObjectPython::getViewProviderName(void) const {
return "FemGui::ViewProviderFemMeshPython";
}
template<> PyObject* Fem::FemMeshObjectPython::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::FemMeshObject>;
}