Add python object for the FemMesh ViewProvider for later postprecessing capabilities
This commit is contained in:
parent
88d558b984
commit
a5262f9cb7
|
@ -24,10 +24,21 @@ include_directories(
|
|||
|
||||
link_directories(${OCC_LIBRARY_DIR})
|
||||
|
||||
|
||||
|
||||
set(FemGui_LIBS
|
||||
Fem
|
||||
FreeCADGui
|
||||
)
|
||||
|
||||
generate_from_xml(ViewProviderFemMeshPy)
|
||||
|
||||
SET(Python_SRCS
|
||||
ViewProviderFemMeshPy.xml
|
||||
ViewProviderFemMeshPyImp.cpp
|
||||
)
|
||||
SOURCE_GROUP("Python" FILES ${Python_SRCS})
|
||||
|
||||
|
||||
set(FemGui_MOC_HDRS
|
||||
Hypothesis.h
|
||||
|
@ -167,6 +178,7 @@ SET(FemGui_SRCS_Module
|
|||
SOURCE_GROUP("Module" FILES ${FemGui_SRCS_Module})
|
||||
|
||||
SET(FemGui_SRCS
|
||||
${Python_SRCS}
|
||||
${FemGui_DLG_SRCS}
|
||||
${FemResource_SRCS}
|
||||
${FemGui_SRCS_ViewProvider}
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#endif
|
||||
|
||||
#include "ViewProviderFemMesh.h"
|
||||
#include "ViewProviderFemMeshPy.h"
|
||||
|
||||
#include <Mod/Fem/App/FemMeshObject.h>
|
||||
#include <Mod/Fem/App/FemMesh.h>
|
||||
|
@ -477,6 +478,14 @@ void ViewProviderFemMesh::resetHighlightNodes(void)
|
|||
pcAnoCoords->point.setNum(0);
|
||||
}
|
||||
|
||||
PyObject * ViewProviderFemMesh::getPyObject()
|
||||
{
|
||||
if (PythonObject.is(Py::_None())){
|
||||
// ref counter is set to 1
|
||||
PythonObject = Py::Object(new ViewProviderFemMeshPy(this),true);
|
||||
}
|
||||
return Py::new_reference_to(PythonObject);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <Gui/ViewProviderGeometryObject.h>
|
||||
#include <Gui/ViewProviderBuilder.h>
|
||||
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
class SoCoordinate3;
|
||||
class SoDrawStyle;
|
||||
class SoIndexedFaceSet;
|
||||
|
@ -95,8 +97,12 @@ public:
|
|||
void setHighlightNodes(const std::set<long>&);
|
||||
void resetHighlightNodes(void);
|
||||
|
||||
PyObject *getPyObject();
|
||||
|
||||
private:
|
||||
static App::PropertyFloatConstraint::Constraints floatRange;
|
||||
|
||||
Py::Object PythonObject;
|
||||
|
||||
protected:
|
||||
/// get called by the container whenever a property has been changed
|
||||
|
|
30
src/Mod/Fem/Gui/ViewProviderFemMeshPy.xml
Normal file
30
src/Mod/Fem/Gui/ViewProviderFemMeshPy.xml
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
|
||||
<PythonExport
|
||||
Father="ViewProviderPy"
|
||||
Name="ViewProviderFemMeshPy"
|
||||
Twin="ViewProviderFemMesh"
|
||||
TwinPointer="ViewProviderFemMesh"
|
||||
Include="Mod/Fem/Gui/ViewProviderFemMesh.h"
|
||||
Namespace="FemGui"
|
||||
FatherInclude="Gui/ViewProviderPy.h"
|
||||
FatherNamespace="Gui"
|
||||
Constructor="false"
|
||||
Delete="false">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Juergen Riegel" EMail="Juergen.Riegel@web.de" />
|
||||
<UserDocu>ViewProviderFemMesh class</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="animate">
|
||||
<Documentation>
|
||||
<UserDocu></UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="NodeColor" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>Pose of Axis 1 in degrees</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NodeColor" Type="List"/>
|
||||
</Attribute>
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
51
src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp
Normal file
51
src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include "Mod/Fem/Gui/ViewProviderFemMesh.h"
|
||||
|
||||
// inclusion of the generated files (generated out of ViewProviderFemMeshPy.xml)
|
||||
#include "ViewProviderFemMeshPy.h"
|
||||
#include "ViewProviderFemMeshPy.cpp"
|
||||
|
||||
using namespace FemGui;
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string ViewProviderFemMeshPy::representation(void) const
|
||||
{
|
||||
return std::string("<ViewProviderFemMesh object>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
PyObject* ViewProviderFemMeshPy::animate(PyObject * /*args*/)
|
||||
{
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Py::List ViewProviderFemMeshPy::getNodeColor(void) const
|
||||
{
|
||||
//return Py::List();
|
||||
throw Py::AttributeError("Not yet implemented");
|
||||
}
|
||||
|
||||
void ViewProviderFemMeshPy::setNodeColor(Py::List /*arg*/)
|
||||
{
|
||||
throw Py::AttributeError("Not yet implemented");
|
||||
}
|
||||
|
||||
PyObject *ViewProviderFemMeshPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViewProviderFemMeshPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user