FEM Post: Command for creation of post pipeline from result

This commit is contained in:
Stefan Tröger 2015-11-14 12:14:02 +01:00 committed by wmayer
parent 51f2a0efc6
commit 2f9e70af09
7 changed files with 358 additions and 36 deletions

View File

@ -27,8 +27,11 @@
#endif
#include "FemPostPipeline.h"
#include "FemMesh.h"
#include "FemMeshObject.h"
#include <Base/Console.h>
#include <App/Document.h>
#include <SMESH_Mesh.hxx>
#include <App/DocumentObjectPy.h>
#include <vtkDataSetReader.h>
#include <vtkGeometryFilter.h>
@ -36,6 +39,13 @@
#include <vtkStructuredGrid.h>
#include <vtkCellData.h>
#include <vtkUnstructuredGrid.h>
#include <vtkCellArray.h>
#include <vtkDoubleArray.h>
#include <vtkTetra.h>
#include <vtkQuadraticTetra.h>
#include <vtkTriangle.h>
#include <vtkQuadraticTriangle.h>
#include <vtkQuad.h>
using namespace Fem;
using namespace App;
@ -174,3 +184,160 @@ FemPostObject* FemPostPipeline::getLastPostObject() {
return static_cast<FemPostObject*>(Filter.getValues().back());
}
void FemPostPipeline::load(FemResultObject* res) {
vtkSmartPointer<vtkUnstructuredGrid> grid = vtkUnstructuredGrid::New();
source = grid;
//first copy the mesh over
//########################
if(!res->Mesh.getValue() || !res->Mesh.getValue()->isDerivedFrom(Fem::FemMeshObject::getClassTypeId()))
return;
const FemMesh& mesh = static_cast<FemMeshObject*>(res->Mesh.getValue())->FemMesh.getValue();
SMESH_Mesh* smesh = const_cast<SMESH_Mesh*>(mesh.getSMesh());
SMESHDS_Mesh* meshDS = smesh->GetMeshDS();
const SMDS_MeshInfo& info = meshDS->GetMeshInfo();
//start with the nodes
vtkSmartPointer<vtkPoints> points = vtkPoints::New();
SMDS_NodeIteratorPtr aNodeIter = meshDS->nodesIterator();
points->SetNumberOfPoints(info.NbNodes());
for(; aNodeIter->more(); ) {
const SMDS_MeshNode* node = aNodeIter->next();
float coords[3] = {float(node->X()), float(node->Y()), float(node->Z())};
points->SetPoint(node->GetID()-1, coords);
}
grid->SetPoints(points);
//start with 2d elements
vtkSmartPointer<vtkCellArray> triangleArray = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkCellArray> quadTriangleArray = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkCellArray> quadArray = vtkSmartPointer<vtkCellArray>::New();
SMDS_FaceIteratorPtr aFaceIter = meshDS->facesIterator();
for (;aFaceIter->more();) {
const SMDS_MeshFace* aFace = aFaceIter->next();
//triangle
if(aFace->NbNodes() == 3) {
vtkSmartPointer<vtkTriangle> tria = vtkTriangle::New();
tria->GetPointIds()->SetId(0, aFace->GetNode(0)->GetID()-1);
tria->GetPointIds()->SetId(1, aFace->GetNode(1)->GetID()-1);
tria->GetPointIds()->SetId(2, aFace->GetNode(2)->GetID()-1);
triangleArray->InsertNextCell(tria);
}
//quad
else if(aFace->NbNodes() == 4) {
vtkSmartPointer<vtkQuad> quad = vtkQuad::New();
quad->GetPointIds()->SetId(0, aFace->GetNode(0)->GetID()-1);
quad->GetPointIds()->SetId(1, aFace->GetNode(1)->GetID()-1);
quad->GetPointIds()->SetId(2, aFace->GetNode(2)->GetID()-1);
quadArray->InsertNextCell(quad);
}
else if (aFace->NbNodes() == 6) {
vtkSmartPointer<vtkQuadraticTriangle> tria = vtkQuadraticTriangle::New();
tria->GetPointIds()->SetId(0, aFace->GetNode(0)->GetID()-1);
tria->GetPointIds()->SetId(1, aFace->GetNode(1)->GetID()-1);
tria->GetPointIds()->SetId(2, aFace->GetNode(2)->GetID()-1);
tria->GetPointIds()->SetId(3, aFace->GetNode(3)->GetID()-1);
tria->GetPointIds()->SetId(4, aFace->GetNode(4)->GetID()-1);
tria->GetPointIds()->SetId(5, aFace->GetNode(5)->GetID()-1);
quadTriangleArray->InsertNextCell(tria);
}
}
if(triangleArray->GetNumberOfCells()>0)
grid->SetCells(VTK_TRIANGLE, triangleArray);
if(quadArray->GetNumberOfCells()>0)
grid->SetCells(VTK_QUAD, quadArray);
if(quadTriangleArray->GetNumberOfCells()>0)
grid->SetCells(VTK_QUADRATIC_TRIANGLE, quadTriangleArray);
//now all volumes
vtkSmartPointer<vtkCellArray> tetraArray = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkCellArray> quadTetraArray = vtkSmartPointer<vtkCellArray>::New();
tetraArray->SetNumberOfCells(info.NbTetras());
SMDS_VolumeIteratorPtr aVolIter = meshDS->volumesIterator();
for (;aVolIter->more();) {
const SMDS_MeshVolume* aVol = aVolIter->next();
//tetrahedra
if(aVol->NbNodes() == 4) {
vtkSmartPointer<vtkTetra> tetra = vtkTetra::New();
tetra->GetPointIds()->SetId(0, aVol->GetNode(0)->GetID()-1);
tetra->GetPointIds()->SetId(1, aVol->GetNode(1)->GetID()-1);
tetra->GetPointIds()->SetId(2, aVol->GetNode(2)->GetID()-1);
tetra->GetPointIds()->SetId(3, aVol->GetNode(3)->GetID()-1);
tetraArray->InsertNextCell(tetra);
}
//quadratic tetrahedra
else if( aVol->NbNodes() == 10) {
vtkSmartPointer<vtkQuadraticTetra> tetra = vtkQuadraticTetra::New();
tetra->GetPointIds()->SetId(0, aVol->GetNode(0)->GetID()-1);
tetra->GetPointIds()->SetId(1, aVol->GetNode(1)->GetID()-1);
tetra->GetPointIds()->SetId(2, aVol->GetNode(2)->GetID()-1);
tetra->GetPointIds()->SetId(3, aVol->GetNode(3)->GetID()-1);
tetra->GetPointIds()->SetId(4, aVol->GetNode(4)->GetID()-1);
tetra->GetPointIds()->SetId(5, aVol->GetNode(5)->GetID()-1);
tetra->GetPointIds()->SetId(6, aVol->GetNode(6)->GetID()-1);
tetra->GetPointIds()->SetId(7, aVol->GetNode(7)->GetID()-1);
tetra->GetPointIds()->SetId(8, aVol->GetNode(8)->GetID()-1);
tetra->GetPointIds()->SetId(9, aVol->GetNode(9)->GetID()-1);
quadTetraArray->InsertNextCell(tetra);
}
}
if(tetraArray->GetNumberOfCells()>0)
grid->SetCells(VTK_TETRA, tetraArray);
if(quadTetraArray->GetNumberOfCells()>0)
grid->SetCells(VTK_QUADRATIC_TETRA, quadTetraArray);
//Now copy the point data over
//############################
if(!res->StressValues.getValues().empty()) {
const std::vector<double>& vec = res->StressValues.getValues();
vtkSmartPointer<vtkDoubleArray> data = vtkDoubleArray::New();
data->SetNumberOfValues(vec.size());
data->SetName("Stress");
for(size_t i=0; i<vec.size(); ++i)
data->SetValue(i, vec[i]);
grid->GetPointData()->AddArray(data);
}
if(!res->StressValues.getValues().empty()) {
const std::vector<Base::Vector3d>& vec = res->DisplacementVectors.getValues();
vtkSmartPointer<vtkDoubleArray> data = vtkDoubleArray::New();
data->SetNumberOfComponents(3);
data->SetName("Displacement");
for(std::vector<Base::Vector3d>::const_iterator it=vec.begin(); it!=vec.end(); ++it) {
double tuple[] = {it->x, it->y, it->z};
Base::Console().Message("disp mag; %f\n", it->Length());
data->InsertNextTuple(tuple);
}
grid->GetPointData()->AddArray(data);
}
polyDataSource = vtkGeometryFilter::New();
polyDataSource->SetInputData(source);
polyDataSource->Update();
}

View File

@ -27,6 +27,7 @@
#include "FemPostObject.h"
#include "FemPostFilter.h"
#include "FemPostFunction.h"
#include "FemResultObject.h"
#include <vtkSmartPointer.h>
#include <vtkDataSet.h>
@ -59,6 +60,9 @@ public:
static bool canRead(Base::FileInfo file);
void read(Base::FileInfo file);
//load from results
void load(FemResultObject* res);
//Pipeline handling
vtkSmartPointer<vtkDataSet> getSource() {return source;};
FemPostObject* getLastPostObject();

View File

@ -1023,6 +1023,53 @@ Gui::Action * CmdFemPostApllyChanges::createAction(void)
#endif
DEF_STD_CMD_A(CmdFemPostPipelineFromResult);
CmdFemPostPipelineFromResult::CmdFemPostPipelineFromResult()
: Command("Fem_PostPipelineFromResult")
{
sAppModule = "Fem";
sGroup = QT_TR_NOOP("Fem");
sMenuText = QT_TR_NOOP("Creates a post processing pipeline from a result object");
sToolTipText = QT_TR_NOOP("Creates a post processing pipeline from a result object");
sWhatsThis = "Fem_PostPipelineFromResult";
sStatusTip = sToolTipText;
sPixmap = "fem-fem-mesh-create-node-by-poly";
}
void CmdFemPostPipelineFromResult::activated(int iMsg)
{
Gui::SelectionFilter ResultFilter("SELECT Fem::FemResultObject COUNT 1");
if (ResultFilter.match()) {
Fem::FemResultObject* result = static_cast<Fem::FemResultObject*>(ResultFilter.Result[0][0].getObject());
std::string FeatName = getUniqueObjectName("Pipeline");
openCommand("Create pipeline from result");
doCommand(Doc,"App.activeDocument().addObject('Fem::FemPostPipeline','%s')",FeatName.c_str());
//TODO: use python function call for this
static_cast<Fem::FemPostPipeline*>(getDocument()->getObject(FeatName.c_str()))->load(result);
this->updateActive();
}
else {
QMessageBox::warning(Gui::getMainWindow(),
qApp->translate("CmdFemPostCreateClipFilter", "Wrong selection"),
qApp->translate("CmdFemPostCreateClipFilter", "Select a result, please."));
}
}
bool CmdFemPostPipelineFromResult::isActive(void)
{
return hasActiveDocument();
}
//--------------------------------------------------------------------------------------
@ -1047,5 +1094,6 @@ void CreateFemCommands(void)
rcCmdMgr.addCommand(new CmdFemPostCreateScalarClipFilter);
rcCmdMgr.addCommand(new CmdFemPostFunctions);
rcCmdMgr.addCommand(new CmdFemPostApllyChanges);
rcCmdMgr.addCommand(new CmdFemPostPipelineFromResult);
#endif
}

View File

@ -1,4 +1,4 @@
<<<<<<< 387862dfe753cf0cb062032e97840353b14dcbae
<<<<<<< 146d87b88ef2e7376f2633828c2341a44c146220
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* *
@ -776,8 +776,8 @@ CmdFemPostCreateClipFilter::CmdFemPostCreateClipFilter()
{
sAppModule = "Fem";
sGroup = QT_TR_NOOP("Fem");
sMenuText = QT_TR_NOOP("Define/create a clip filter for a post processing pipeline...");
sToolTipText = QT_TR_NOOP("Define/create a clip filter for a post processing pipeline...");
sMenuText = QT_TR_NOOP("Define/create a clip filter which uses functions to define the cliped region");
sToolTipText = QT_TR_NOOP("Define/create a clip filter which uses functions to define the cliped region");
sWhatsThis = "Fem_PostCreateClipFilter";
sStatusTip = sToolTipText;
sPixmap = "fem-fem-mesh-create-node-by-poly";
@ -785,10 +785,9 @@ CmdFemPostCreateClipFilter::CmdFemPostCreateClipFilter()
void CmdFemPostCreateClipFilter::activated(int iMsg)
{
Gui::SelectionFilter ObjectFilter("SELECT Fem::FemPostPipeline COUNT 1");
if (ObjectFilter.match()) {
Fem::FemPostPipeline *pipeline = static_cast<Fem::FemPostPipeline*>(ObjectFilter.Result[0][0].getObject());
std::vector<Fem::FemPostPipeline*> pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
if (!pipelines.empty()) {
Fem::FemPostPipeline *pipeline = pipelines.front();
std::string FeatName = getUniqueObjectName("Clip");
@ -800,6 +799,8 @@ void CmdFemPostCreateClipFilter::activated(int iMsg)
doCommand(Doc,"del __list__");
this->updateActive();
doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str());
}
else {
QMessageBox::warning(Gui::getMainWindow(),
@ -813,6 +814,50 @@ bool CmdFemPostCreateClipFilter::isActive(void)
return hasActiveDocument();
}
DEF_STD_CMD_A(CmdFemPostCreateScalarClipFilter);
CmdFemPostCreateScalarClipFilter::CmdFemPostCreateScalarClipFilter()
: Command("Fem_PostCreateScalarClipFilter")
{
sAppModule = "Fem";
sGroup = QT_TR_NOOP("Fem");
sMenuText = QT_TR_NOOP("Define/create a clip filter which clips a field with a scalar value");
sToolTipText = QT_TR_NOOP("Define/create a clip filter which clips a field with a scalar value");
sWhatsThis = "Fem_PostCreateScalarClipFilter";
sStatusTip = sToolTipText;
sPixmap = "fem-fem-mesh-create-node-by-poly";
}
void CmdFemPostCreateScalarClipFilter::activated(int iMsg)
{
std::vector<Fem::FemPostPipeline*> pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
if (!pipelines.empty()) {
Fem::FemPostPipeline *pipeline = pipelines.front();
std::string FeatName = getUniqueObjectName("ScalarClip");
openCommand("Create scalar clip filter");
doCommand(Doc,"App.activeDocument().addObject('Fem::FemPostScalarClipFilter','%s')",FeatName.c_str());
doCommand(Doc,"__list__ = App.ActiveDocument.%s.Filter", pipeline->getNameInDocument());
doCommand(Doc,"__list__.append(App.ActiveDocument.%s)", FeatName.c_str());
doCommand(Doc,"App.ActiveDocument.%s.Filter = __list__", pipeline->getNameInDocument());
doCommand(Doc,"del __list__");
this->updateActive();
doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str());
}
else {
QMessageBox::warning(Gui::getMainWindow(),
qApp->translate("CmdFemPostCreateScalarClipFilter", "Wrong selection"),
qApp->translate("CmdFemPostCreateScalarClipFilter", "Select a pipeline, please."));
}
}
bool CmdFemPostCreateScalarClipFilter::isActive(void)
{
return hasActiveDocument();
}
// #####################################################################################################
@ -827,31 +872,30 @@ CmdFemPostFunctions::CmdFemPostFunctions()
sToolTipText = QT_TR_NOOP("Functions for use in postprocessing filter...");
sWhatsThis = "Fem_PostCreateFunctions";
sStatusTip = sToolTipText;
eType = eType|ForEdit;
}
void CmdFemPostFunctions::activated(int iMsg)
{
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
std::string name;
if (iMsg==0)
name = "Plane";
else if (iMsg==1)
rcCmdMgr.runCommandByName("Part_JoinEmbed");
else if (iMsg==2)
rcCmdMgr.runCommandByName("Part_JoinCutout");
name = "Sphere";
else
return;
//create the object
Gui::SelectionFilter ObjectFilter("SELECT Fem::FemPostPipeline COUNT 1");
if (ObjectFilter.match()) {
Fem::FemPostPipeline *pipeline = static_cast<Fem::FemPostPipeline*>(ObjectFilter.Result[0][0].getObject());
std::vector<Fem::FemPostPipeline*> pipelines = App::GetApplication().getActiveDocument()->getObjectsOfType<Fem::FemPostPipeline>();
if (!pipelines.empty()) {
Fem::FemPostPipeline *pipeline = pipelines.front();
openCommand("Create function");
//check if the pipeline has a filter provider and add one if needed
Fem::FemPostFunctionProvider* provider;
if(!pipeline->Function.getValue() || pipeline->Function.getValue()->getTypeId() == Fem::FemPostFunctionProvider::getClassTypeId()) {
if(!pipeline->Function.getValue() || pipeline->Function.getValue()->getTypeId() != Fem::FemPostFunctionProvider::getClassTypeId()) {
std::string FuncName = getUniqueObjectName("Functions");
doCommand(Doc,"App.ActiveDocument.addObject('Fem::FemPostFunctionProvider','%s')", FuncName.c_str());
doCommand(Doc,"App.ActiveDocument.%s.Function = App.ActiveDocument.%s", pipeline->getNameInDocument(), FuncName.c_str());
@ -869,6 +913,7 @@ void CmdFemPostFunctions::activated(int iMsg)
doCommand(Doc,"del __list__");
this->updateActive();
doCommand(Gui,"Gui.activeDocument().setEdit('%s')",FeatName.c_str());
}
else {
QMessageBox::warning(Gui::getMainWindow(),
@ -892,7 +937,7 @@ Gui::Action * CmdFemPostFunctions::createAction(void)
applyCommandData(this->className(), pcAction);
QAction* cmd0 = pcAction->addAction(QString());
//cmd0->setIcon(Gui::BitmapFactory().pixmap("Part_JoinConnect"));
pcAction->addAction(QString());
_pcAction = pcAction;
languageChange();
@ -913,10 +958,15 @@ void CmdFemPostFunctions::languageChange()
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
QList<QAction*> a = pcAction->actions();
QAction* cmd0 = a[0];
cmd0->setText(QApplication::translate("CmdFemPostFunctions","Plane"));
cmd0->setToolTip(QApplication::translate("Fem_PostCreateFunctions","Create a plane function, defined by its orgin and normal"));
cmd0->setStatusTip(cmd0->toolTip());
QAction* cmd = a[0];
cmd->setText(QApplication::translate("CmdFemPostFunctions","Plane"));
cmd->setToolTip(QApplication::translate("Fem_PostCreateFunctions","Create a plane function, defined by its orgin and normal"));
cmd->setStatusTip(cmd->toolTip());
cmd = a[1];
cmd->setText(QApplication::translate("CmdFemPostFunctions","Sphere"));
cmd->setToolTip(QApplication::translate("Fem_PostCreateFunctions","Create a phere function, defined by its center and radius"));
cmd->setStatusTip(cmd->toolTip());
}
@ -928,6 +978,7 @@ bool CmdFemPostFunctions::isActive(void)
return false;
}
DEF_STD_CMD_AC(CmdFemPostApllyChanges);
CmdFemPostApllyChanges::CmdFemPostApllyChanges()
@ -940,6 +991,7 @@ CmdFemPostApllyChanges::CmdFemPostApllyChanges()
sWhatsThis = "Fem_PostApplyChanges";
sStatusTip = sToolTipText;
sPixmap = "view-refresh";
eType = eType|ForEdit;
}
void CmdFemPostApllyChanges::activated(int iMsg)
@ -993,6 +1045,7 @@ void CreateFemCommands(void)
#ifdef FC_USE_VTK
rcCmdMgr.addCommand(new CmdFemPostCreateClipFilter);
rcCmdMgr.addCommand(new CmdFemPostCreateScalarClipFilter);
rcCmdMgr.addCommand(new CmdFemPostFunctions);
rcCmdMgr.addCommand(new CmdFemPostApllyChanges);
#endif
@ -2023,6 +2076,53 @@ Gui::Action * CmdFemPostApllyChanges::createAction(void)
#endif
DEF_STD_CMD_A(CmdFemPostPipelineFromResult);
CmdFemPostPipelineFromResult::CmdFemPostPipelineFromResult()
: Command("Fem_PostPipelineFromResult")
{
sAppModule = "Fem";
sGroup = QT_TR_NOOP("Fem");
sMenuText = QT_TR_NOOP("Creates a post processing pipeline from a result object");
sToolTipText = QT_TR_NOOP("Creates a post processing pipeline from a result object");
sWhatsThis = "Fem_PostPipelineFromResult";
sStatusTip = sToolTipText;
sPixmap = "fem-fem-mesh-create-node-by-poly";
}
void CmdFemPostPipelineFromResult::activated(int iMsg)
{
Gui::SelectionFilter ResultFilter("SELECT Fem::FemResultObject COUNT 1");
if (ResultFilter.match()) {
Fem::FemResultObject* result = static_cast<Fem::FemResultObject*>(ResultFilter.Result[0][0].getObject());
std::string FeatName = getUniqueObjectName("Pipeline");
openCommand("Create pipeline from result");
doCommand(Doc,"App.activeDocument().addObject('Fem::FemPostPipeline','%s')",FeatName.c_str());
//TODO: use python function call for this
static_cast<Fem::FemPostPipeline*>(getDocument()->getObject(FeatName.c_str()))->load(result);
this->updateActive();
}
else {
QMessageBox::warning(Gui::getMainWindow(),
qApp->translate("CmdFemPostCreateClipFilter", "Wrong selection"),
qApp->translate("CmdFemPostCreateClipFilter", "Select a result, please."));
}
}
bool CmdFemPostPipelineFromResult::isActive(void)
{
return hasActiveDocument();
}
//--------------------------------------------------------------------------------------
@ -2047,6 +2147,7 @@ void CreateFemCommands(void)
rcCmdMgr.addCommand(new CmdFemPostCreateScalarClipFilter);
rcCmdMgr.addCommand(new CmdFemPostFunctions);
rcCmdMgr.addCommand(new CmdFemPostApllyChanges);
rcCmdMgr.addCommand(new CmdFemPostPipelineFromResult);
#endif
}
>>>>>>> Detail filter infrastructure
>>>>>>> Command for creation of post pipeline from result

View File

@ -25,7 +25,7 @@
#ifndef _PreComp_
#include <Inventor/nodes/SoCoordinate3.h>
#include <Inventor/nodes/SoIndexedMarkerSet.h>
#include <Inventor/nodes/SoIndexedPointSet.h>
#include <Inventor/nodes/SoIndexedLineSet.h>
#include <Inventor/nodes/SoIndexedFaceSet.h>
#include <Inventor/nodes/SoIndexedTriangleStripSet.h>
@ -85,7 +85,7 @@ ViewProviderFemPostObject::ViewProviderFemPostObject() : m_blockPropertyChanges(
m_faces->ref();
m_triangleStrips = new SoIndexedTriangleStripSet();
m_triangleStrips->ref();
m_markers = new SoIndexedMarkerSet();
m_markers = new SoIndexedPointSet();
m_markers->ref();
m_lines = new SoIndexedLineSet();
m_lines->ref();
@ -155,8 +155,8 @@ void ViewProviderFemPostObject::setDisplayMode(const char* ModeName)
m_currentAlgorithm = static_cast<Fem::FemPostObject*>(getObject())->getPolyAlgorithm();
else if (strcmp("Wireframe",ModeName)==0)
m_currentAlgorithm = m_wireframe;
/*else if (strcmp("Nodes",ModeName)==0)
setDisplayMaskMode("Nodes");*/
else if (strcmp("Nodes",ModeName)==0)
m_currentAlgorithm = m_points;
update();
@ -167,7 +167,7 @@ std::vector<std::string> ViewProviderFemPostObject::getDisplayModes(void) const
{
std::vector<std::string> StrList;
StrList.push_back("Outline");
// StrList.push_back("Points");
StrList.push_back("Nodes");
StrList.push_back("Surface");
StrList.push_back("Surface with Edges");
StrList.push_back("Wireframe");
@ -344,22 +344,17 @@ void ViewProviderFemPostObject::update3D() {
m_lines->coordIndex.setNum(0);
// write out verts if any
// (more complex because there is no IndexedPointSet)
if (pd->GetNumberOfVerts() > 0){
Base::Console().Message("render verts\n");
Base::Console().Message("render verts: %i\n", pd->GetNumberOfVerts());
int soidx = 0;
cells = pd->GetVerts();
m_markers->coordIndex.startEditing();
m_markers->coordIndex.setNum(pd->GetNumberOfVerts());
for (cells->InitTraversal(); cells->GetNextCell(npts,indx); ) {
for (int i = 0; i < npts; i++) {
m_markers->coordIndex.set1Value(soidx, static_cast<int>(indx[i]));
++soidx;
}
m_markers->coordIndex.set1Value(soidx, -1);
++soidx;
m_markers->coordIndex.set1Value(soidx, static_cast<int>(indx[0]));
++soidx;
}
m_markers->coordIndex.setNum(soidx);
m_markers->coordIndex.finishEditing();
}
else
@ -487,6 +482,9 @@ bool ViewProviderFemPostObject::setupPipeline() {
m_outline = vtkOutlineCornerFilter::New();
m_outline->SetInputConnection(algorithm->GetOutputPort());
m_points = vtkVertexGlyphFilter::New();
m_points->SetInputConnection(algorithm->GetOutputPort());
m_surface = vtkGeometryFilter::New();
m_surface->SetInputConnection(algorithm->GetOutputPort());

View File

@ -35,7 +35,9 @@
#include <vtkExtractEdges.h>
#include <vtkAppendPolyData.h>
#include <vtkGeometryFilter.h>
#include <vtkVertexGlyphFilter.h>
class SoIndexedPointSet;
class vtkUnsignedCharArray;
class vtkDataArray;
class vtkPoints;
@ -107,7 +109,7 @@ protected:
void update();
SoCoordinate3* m_coordinates;
SoIndexedMarkerSet* m_markers;
SoIndexedPointSet* m_markers;
SoIndexedLineSet* m_lines;
SoIndexedFaceSet* m_faces;
SoIndexedTriangleStripSet* m_triangleStrips;
@ -124,6 +126,7 @@ protected:
vtkSmartPointer<vtkAppendPolyData> m_surfaceEdges;
vtkSmartPointer<vtkOutlineCornerFilter> m_outline;
vtkSmartPointer<vtkExtractEdges> m_wireframe;
vtkSmartPointer<vtkVertexGlyphFilter> m_points;
vtkSmartPointer<vtkLookupTable> m_lookup;
private:

View File

@ -83,6 +83,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
Gui::ToolBarItem* post = new Gui::ToolBarItem(root);
post->setCommand("Post Processing");
*post << "Fem_PostApplyChanges"
<< "Fem_PostPipelineFromResult"
<< "Separator"
<< "Fem_PostCreateClipFilter"
<< "Fem_PostCreateScalarClipFilter"