diff --git a/src/Mod/Fem/App/FemResultObject.cpp b/src/Mod/Fem/App/FemResultObject.cpp
index b7db4b7ec..07f0e6496 100644
--- a/src/Mod/Fem/App/FemResultObject.cpp
+++ b/src/Mod/Fem/App/FemResultObject.cpp
@@ -40,6 +40,7 @@ FemResultObject::FemResultObject()
ADD_PROPERTY_TYPE(DataType,(""), "General",Prop_None,"Type identifier of the result data");
ADD_PROPERTY_TYPE(Unit,(Base::Quantity()), "General",Prop_None,"Unit of the data");
ADD_PROPERTY_TYPE(ElementNumbers,(0), "Data",Prop_None,"Numbers of the result elements");
+ ADD_PROPERTY_TYPE(Mesh,(0), "General",Prop_None,"Link to the corosbonding mesh");
}
FemResultObject::~FemResultObject()
diff --git a/src/Mod/Fem/App/FemResultObject.h b/src/Mod/Fem/App/FemResultObject.h
index 3db4b065b..2dd5ec4de 100644
--- a/src/Mod/Fem/App/FemResultObject.h
+++ b/src/Mod/Fem/App/FemResultObject.h
@@ -48,10 +48,13 @@ public:
App::PropertyQuantity Unit;
/// List of element numbers in this result object
App::PropertyIntegerList ElementNumbers;
+ /// Link to the corosbonding mesh
+ App::PropertyLink Mesh;
+
/// returns the type name of the ViewProvider
- //virtual const char* getViewProviderName(void) const {
- // return "FemGui::ViewProviderFemSet";
- //}
+ virtual const char* getViewProviderName(void) const {
+ return "FemGui::ViewProviderResult";
+ }
virtual App::DocumentObjectExecReturn *execute(void) {
return App::DocumentObject::StdReturn;
}
diff --git a/src/Mod/Fem/App/FemResultValue.cpp b/src/Mod/Fem/App/FemResultValue.cpp
index bb698858e..b882fe676 100644
--- a/src/Mod/Fem/App/FemResultValue.cpp
+++ b/src/Mod/Fem/App/FemResultValue.cpp
@@ -32,7 +32,7 @@
using namespace Fem;
using namespace App;
-PROPERTY_SOURCE(Fem::FemResultValue, App::DocumentObject)
+PROPERTY_SOURCE(Fem::FemResultValue, Fem::FemResultObject)
FemResultValue::FemResultValue()
diff --git a/src/Mod/Fem/App/FemResultVector.cpp b/src/Mod/Fem/App/FemResultVector.cpp
index 4b3cb2370..1196ecbae 100644
--- a/src/Mod/Fem/App/FemResultVector.cpp
+++ b/src/Mod/Fem/App/FemResultVector.cpp
@@ -32,7 +32,7 @@
using namespace Fem;
using namespace App;
-PROPERTY_SOURCE(Fem::FemResultVector, App::DocumentObject)
+PROPERTY_SOURCE(Fem::FemResultVector, Fem::FemResultObject)
FemResultVector::FemResultVector()
diff --git a/src/Mod/Fem/CalculixLib.py b/src/Mod/Fem/CalculixLib.py
index 2f0b384d8..573bbd872 100644
--- a/src/Mod/Fem/CalculixLib.py
+++ b/src/Mod/Fem/CalculixLib.py
@@ -23,6 +23,7 @@
import FreeCAD,os
+from math import pow,sqrt
__title__="FreeCAD Calculix library"
__author__ = "Juergen Riegel "
@@ -114,8 +115,12 @@ def readResult(frd_input) :
def importFrd(filename):
m = readResult(filename);
+ MeshObject = None
if(len(m) > 0):
import Fem
+ AnalysisName = os.path.splitext(os.path.basename(filename))[0]
+ AnalysisObject = FreeCAD.ActiveDocument.addObject('Fem::FemAnalysis','Analysis')
+ AnalysisObject.Label = AnalysisName
if(m.has_key('Tet10Elem') and m.has_key('Nodes') ):
mesh = Fem.FemMesh()
nds = m['Nodes']
@@ -127,7 +132,34 @@ def importFrd(filename):
e = elms[i]
mesh.addVolume([e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9]],i)
- Fem.show(mesh)
+ MeshObject = FreeCAD.ActiveDocument.addObject('Fem::FemMeshObject','ResultMesh')
+ MeshObject.FemMesh = mesh
+ AnalysisObject.Member = AnalysisObject.Member + [MeshObject]
+
+ if(m.has_key('Displacement')):
+ disp = m['Displacement']
+ o = FreeCAD.ActiveDocument.addObject('Fem::FemResultVector','Displacement')
+ o.Values = disp.values()
+ o.ElementNumbers = disp.keys()
+ if(MeshObject):
+ o.Mesh = MeshObject
+ AnalysisObject.Member = AnalysisObject.Member + [o]
+ if(m.has_key('Stress')):
+ stress = m['Stress']
+ o = FreeCAD.ActiveDocument.addObject('Fem::FemResultValue','MisesStress')
+ mstress = []
+ for i in stress.values():
+ # van mises stress (http://en.wikipedia.org/wiki/Von_Mises_yield_criterion)
+ mstress.append( sqrt( pow( i[0] - i[1] ,2) + pow( i[1] - i[2] ,2) + pow( i[2] - i[0] ,2) + 6 * (pow(i[3],2)+pow(i[4],2)+pow(i[5],2) ) ) )
+
+ o.Values = mstress
+ o.ElementNumbers = stress.keys()
+ if(MeshObject):
+ o.Mesh = MeshObject
+ AnalysisObject.Member = AnalysisObject.Member + [o]
+ if(FreeCAD.GuiUp):
+ import FemGui
+ FemGui.setActiveAnalysis(AnalysisObject)
def insert(filename,docname):
"called when freecad wants to import a file"
diff --git a/src/Mod/Fem/Gui/AppFemGui.cpp b/src/Mod/Fem/Gui/AppFemGui.cpp
index fbaf712b1..1edd9bcb5 100755
--- a/src/Mod/Fem/Gui/AppFemGui.cpp
+++ b/src/Mod/Fem/Gui/AppFemGui.cpp
@@ -45,6 +45,7 @@
#include "ViewProviderFemConstraintForce.h"
#include "ViewProviderFemConstraintGear.h"
#include "ViewProviderFemConstraintPulley.h"
+#include "ViewProviderResult.h"
#include "Workbench.h"
//#include "resources/qrc_Fem.cpp"
@@ -94,6 +95,7 @@ void FemGuiExport initFemGui()
FemGui::ViewProviderFemConstraintForce ::init();
FemGui::ViewProviderFemConstraintGear ::init();
FemGui::ViewProviderFemConstraintPulley ::init();
+ FemGui::ViewProviderResult ::init();
Base::Interpreter().loadModule("MechanicalAnalysis");
Base::Interpreter().loadModule("MechanicalMaterial");
diff --git a/src/Mod/Fem/Gui/CMakeLists.txt b/src/Mod/Fem/Gui/CMakeLists.txt
index e22f858c3..b6ca94af1 100755
--- a/src/Mod/Fem/Gui/CMakeLists.txt
+++ b/src/Mod/Fem/Gui/CMakeLists.txt
@@ -133,6 +133,8 @@ SET(FemGui_SRCS_ViewProvider
ViewProviderFemConstraintGear.h
ViewProviderFemConstraintPulley.cpp
ViewProviderFemConstraintPulley.h
+ ViewProviderResult.cpp
+ ViewProviderResult.h
)
SOURCE_GROUP("ViewProvider" FILES ${FemGui_SRCS_ViewProvider})
diff --git a/src/Mod/Fem/Gui/Resources/Fem.qrc b/src/Mod/Fem/Gui/Resources/Fem.qrc
index b39ff8291..ee00e6358 100755
--- a/src/Mod/Fem/Gui/Resources/Fem.qrc
+++ b/src/Mod/Fem/Gui/Resources/Fem.qrc
@@ -13,6 +13,9 @@
icons/Fem_AddPart.svg
icons/Fem_Material.svg
icons/Fem_NewAnalysis.svg
+ icons/Fem_Result.svg
+ icons/Fem_ResultDisplacement.svg
+ icons/Fem_ResultStress.svg
translations/Fem_af.qm
translations/Fem_de.qm
translations/Fem_fi.qm
diff --git a/src/Mod/Fem/Gui/Resources/icons/Fem_Analysis.svg b/src/Mod/Fem/Gui/Resources/icons/Fem_Analysis.svg
index a6d5d1992..990bbd30e 100644
--- a/src/Mod/Fem/Gui/Resources/icons/Fem_Analysis.svg
+++ b/src/Mod/Fem/Gui/Resources/icons/Fem_Analysis.svg
@@ -15,7 +15,7 @@
id="svg2860"
sodipodi:version="0.32"
inkscape:version="0.48.4 r9939"
- sodipodi:docname="Fem_FemMesh.svg"
+ sodipodi:docname="Fem_Analysis.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
@@ -98,7 +98,7 @@
image/svg+xml
-
+
@@ -108,7 +108,7 @@
inkscape:groupmode="layer">
+
+
+
diff --git a/src/Mod/Fem/Gui/Resources/icons/Fem_ResultDisplacement.svg b/src/Mod/Fem/Gui/Resources/icons/Fem_ResultDisplacement.svg
new file mode 100644
index 000000000..8d2ae9817
--- /dev/null
+++ b/src/Mod/Fem/Gui/Resources/icons/Fem_ResultDisplacement.svg
@@ -0,0 +1,181 @@
+
+
+
+
diff --git a/src/Mod/Fem/Gui/Resources/icons/Fem_ResultStress.svg b/src/Mod/Fem/Gui/Resources/icons/Fem_ResultStress.svg
new file mode 100644
index 000000000..457800825
--- /dev/null
+++ b/src/Mod/Fem/Gui/Resources/icons/Fem_ResultStress.svg
@@ -0,0 +1,194 @@
+
+
+
+
diff --git a/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp b/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp
index 6dd0d2767..f651ea3aa 100644
--- a/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp
+++ b/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp
@@ -50,7 +50,7 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemAnalysis, Gui::ViewProviderDocumentObject
ViewProviderFemAnalysis::ViewProviderFemAnalysis()
{
-
+ sPixmap = "Fem_Analysis";
}
diff --git a/src/Mod/Fem/Gui/ViewProviderAnalysis.h b/src/Mod/Fem/Gui/ViewProviderAnalysis.h
index 096ee7ba5..c1c89abad 100644
--- a/src/Mod/Fem/Gui/ViewProviderAnalysis.h
+++ b/src/Mod/Fem/Gui/ViewProviderAnalysis.h
@@ -60,6 +60,9 @@ public:
virtual bool onDelete(const std::vector &);
+ // shows solid in the tree
+ virtual bool isShow(void) const{return true;}
+
protected:
virtual bool setEdit(int ModNum);
virtual void unsetEdit(int ModNum);
diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp
index 6c40269b3..dd4e182ce 100755
--- a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp
+++ b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp
@@ -166,6 +166,7 @@ App::PropertyFloatConstraint::Constraints ViewProviderFemMesh::floatRange = {1.0
ViewProviderFemMesh::ViewProviderFemMesh()
{
+ sPixmap = "Fem_FemMesh";
ADD_PROPERTY(PointColor,(App::Color(0.7f,0.7f,0.7f)));
ADD_PROPERTY(PointSize,(5.0f));
diff --git a/src/Mod/Fem/Gui/ViewProviderResult.cpp b/src/Mod/Fem/Gui/ViewProviderResult.cpp
new file mode 100644
index 000000000..3d23639c6
--- /dev/null
+++ b/src/Mod/Fem/Gui/ViewProviderResult.cpp
@@ -0,0 +1,73 @@
+/***************************************************************************
+ * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
+ * *
+ * This file is part of the FreeCAD CAx development system. *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; see the file COPYING.LIB. If not, *
+ * write to the Free Software Foundation, Inc., 59 Temple Place, *
+ * Suite 330, Boston, MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+
+#include "PreCompiled.h"
+
+#ifndef _PreComp_
+# include
+
+#endif
+
+#include "ViewProviderResult.h"
+#include
+#include
+#include
+
+#include
+
+#include "TaskDlgAnalysis.h"
+
+using namespace FemGui;
+
+
+
+
+
+
+
+PROPERTY_SOURCE(FemGui::ViewProviderResult, Gui::ViewProviderDocumentObject)
+
+
+ViewProviderResult::ViewProviderResult()
+{
+ sPixmap = "Fem_Result";
+
+}
+
+ViewProviderResult::~ViewProviderResult()
+{
+
+}
+
+
+
+// Python feature -----------------------------------------------------------------------
+
+namespace Gui {
+/// @cond DOXERR
+PROPERTY_SOURCE_TEMPLATE(FemGui::ViewProviderResultPython, FemGui::ViewProviderResult)
+/// @endcond
+
+// explicit template instantiation
+template class FemGuiExport ViewProviderPythonFeatureT;
+}
diff --git a/src/Mod/Fem/Gui/ViewProviderResult.h b/src/Mod/Fem/Gui/ViewProviderResult.h
new file mode 100644
index 000000000..bdcdbd3a8
--- /dev/null
+++ b/src/Mod/Fem/Gui/ViewProviderResult.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
+ * *
+ * This file is part of the FreeCAD CAx development system. *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; see the file COPYING.LIB. If not, *
+ * write to the Free Software Foundation, Inc., 59 Temple Place, *
+ * Suite 330, Boston, MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+
+#ifndef FEM_ViewProviderResult_H
+#define FEM_ViewProviderResult_H
+
+#include
+#include
+#include
+
+class SoCoordinate3;
+class SoDrawStyle;
+class SoIndexedFaceSet;
+class SoIndexedLineSet;
+class SoShapeHints;
+class SoMaterialBinding;
+
+namespace FemGui
+{
+
+
+
+class FemGuiExport ViewProviderResult : public Gui::ViewProviderDocumentObject
+{
+ PROPERTY_HEADER(FemGui::ViewProviderResult);
+
+public:
+ /// constructor
+ ViewProviderResult();
+
+ /// destructor
+ ~ViewProviderResult();
+
+ // shows solid in the tree
+ virtual bool isShow(void) const{return true;}
+protected:
+
+};
+
+typedef Gui::ViewProviderPythonFeatureT ViewProviderResultPython;
+
+} //namespace FemGui
+
+
+#endif // FEM_ViewProviderResult_H