FEM: Make post object placement work
This commit is contained in:
committed by
Benjamin Nauck
parent
c8a4ff0a70
commit
0a1cc21b5c
@@ -26,6 +26,7 @@
|
||||
#include <vtkDataSet.h>
|
||||
#include <vtkXMLDataSetWriter.h>
|
||||
#include <vtkXMLMultiBlockDataWriter.h>
|
||||
#include <vtkTransform.h>
|
||||
#endif
|
||||
|
||||
#include <Base/Exception.h>
|
||||
@@ -43,6 +44,16 @@ PROPERTY_SOURCE(Fem::FemPostObject, App::GeoFeature)
|
||||
FemPostObject::FemPostObject()
|
||||
{
|
||||
ADD_PROPERTY(Data, (nullptr));
|
||||
|
||||
m_transform_filter = vtkSmartPointer<vtkTransformFilter>::New();
|
||||
|
||||
// define default transform
|
||||
double data[16];
|
||||
auto matrix = Placement.getValue().toMatrix();
|
||||
matrix.getMatrix(data);
|
||||
vtkTransform* transform = vtkTransform::New();
|
||||
transform->SetMatrix(data);
|
||||
m_transform_filter->SetTransform(transform);
|
||||
}
|
||||
|
||||
FemPostObject::~FemPostObject() = default;
|
||||
@@ -86,6 +97,26 @@ PyObject* FemPostObject::getPyObject()
|
||||
return Py::new_reference_to(PythonObject);
|
||||
}
|
||||
|
||||
void FemPostObject::onChanged(const App::Property* prop)
|
||||
{
|
||||
if(prop == &Placement) {
|
||||
// we update the transform filter to match the placement!
|
||||
double data[16];
|
||||
auto matrix = Placement.getValue().toMatrix();
|
||||
matrix.getMatrix(data);
|
||||
vtkTransform* transform = vtkTransform::New();
|
||||
transform->SetMatrix(data);
|
||||
m_transform_filter->SetTransform(transform);
|
||||
//note: no call to Update(), as we do not know the frame to use. has to happen
|
||||
//in derived class
|
||||
|
||||
// placement would not recompute, as it is a "not touch" prop.
|
||||
this->touch();
|
||||
}
|
||||
|
||||
App::GeoFeature::onChanged(prop);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user