FEM: add ConstraintPython object type
Constraints implemented in python can use this object as their base. That makes it easier to identify them as constraint objects.
This commit is contained in:
committed by
Bernd Hahnebach
parent
b7e8348e85
commit
ef85389cbc
@@ -54,6 +54,9 @@
|
||||
#include "FemConstraint.h"
|
||||
#include "FemTools.h"
|
||||
|
||||
#include <App/DocumentObjectPy.h>
|
||||
#include <App/FeaturePythonPyImp.h>
|
||||
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
@@ -391,3 +394,27 @@ const Base::Vector3d Constraint::getDirection(const App::PropertyLinkSub &direct
|
||||
|
||||
return Fem::Tools::getDirectionFromShape(sh);
|
||||
}
|
||||
|
||||
// Python feature ---------------------------------------------------------
|
||||
|
||||
namespace App {
|
||||
/// @cond DOXERR
|
||||
PROPERTY_SOURCE_TEMPLATE(Fem::ConstraintPython, Fem::Constraint)
|
||||
template<> const char* Fem::ConstraintPython::getViewProviderName(void) const {
|
||||
return "FemGui::ViewProviderFemConstraintPython";
|
||||
}
|
||||
|
||||
template<> PyObject* Fem::ConstraintPython::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::Constraint>;
|
||||
|
||||
/// @endcond
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user