diff --git a/src/Mod/Fem/App/FemMeshPy.xml b/src/Mod/Fem/App/FemMeshPy.xml
index 3a8958d50c..3f388a7425 100755
--- a/src/Mod/Fem/App/FemMeshPy.xml
+++ b/src/Mod/Fem/App/FemMeshPy.xml
@@ -78,17 +78,22 @@
Use a Placement object to perform a translation or rotation
-
-
-
- Make a copy of this FEM mesh.
-
-
-
+
+
+
+ Make a copy of this FEM mesh.
+
+
+
+
+ Get the node position vector by an Node-ID
+
+
+
- Tuple of node points.
+ Dictionary of Nodes by ID (int ID:Vector())
-
+
diff --git a/src/Mod/Fem/App/FemMeshPyImp.cpp b/src/Mod/Fem/App/FemMeshPyImp.cpp
index d614fdee75..6a925e56b3 100755
--- a/src/Mod/Fem/App/FemMeshPyImp.cpp
+++ b/src/Mod/Fem/App/FemMeshPyImp.cpp
@@ -460,12 +460,34 @@ PyObject* FemMeshPy::setTransform(PyObject *args)
Py_Return;
}
+PyObject* FemMeshPy::getNodeById(PyObject *args)
+{
+ int id;
+ if (!PyArg_ParseTuple(args, "i", &id))
+ return 0;
+
+ Base::Matrix4D Mtrx = getFemMeshPtr()->getTransform();
+ const SMDS_MeshNode* aNode = getFemMeshPtr()->getSMesh()->GetMeshDS()->FindNode(id);
+
+ if(aNode){
+ Base::Vector3d vec(aNode->X(),aNode->Y(),aNode->Z());
+ vec = Mtrx * vec;
+ return new Base::VectorPy( vec );
+ }else{
+ PyErr_SetString(PyExc_Exception, "No valid ID");
+ return 0;
+ }
+}
+
+
// ===== Atributes ============================================================
-Py::Tuple FemMeshPy::getNodes(void) const
+Py::Dict FemMeshPy::getNodes(void) const
{
- int count = getFemMeshPtr()->getSMesh()->GetMeshDS()->NbNodes();
- Py::Tuple tup(count);
+ //int count = getFemMeshPtr()->getSMesh()->GetMeshDS()->NbNodes();
+ //Py::Tuple tup(count);
+ Py::Dict dict;
+
// get the actuall transform of the FemMesh
Base::Matrix4D Mtrx = getFemMeshPtr()->getTransform();
@@ -475,11 +497,12 @@ Py::Tuple FemMeshPy::getNodes(void) const
Base::Vector3d vec(aNode->X(),aNode->Y(),aNode->Z());
// Apply the matrix to hold the BoundBox in absolute space.
vec = Mtrx * vec;
+ int id = aNode->GetID();
- tup.setItem(i, Py::asObject(new Base::VectorPy( vec )));
+ dict[Py::Int(id)] = Py::asObject(new Base::VectorPy( vec ));
}
- return tup;
+ return dict;
}
Py::Int FemMeshPy::getNodeCount(void) const
diff --git a/src/Mod/Machining_Distortion/MachDistAlignment.py b/src/Mod/Machining_Distortion/MachDistAlignment.py
index 17dd792de0..24f77e9137 100644
--- a/src/Mod/Machining_Distortion/MachDistAlignment.py
+++ b/src/Mod/Machining_Distortion/MachDistAlignment.py
@@ -99,7 +99,7 @@ class _AlignTaskPanel:
QtGui.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
import Mesh
# find the eigen axis
- self.obj.Placement = Mesh.calculateEigenTransform(self.obj.FemMesh.Nodes)
+ self.obj.Placement = Mesh.calculateEigenTransform(self.obj.FemMesh.Nodes.values())
# make the first alignment persistent
m = Fem.FemMesh(self.obj.FemMesh)
diff --git a/src/Mod/Machining_Distortion/MachDistIsostatic.py b/src/Mod/Machining_Distortion/MachDistIsostatic.py
index ac437017b4..1028891c9d 100644
--- a/src/Mod/Machining_Distortion/MachDistIsostatic.py
+++ b/src/Mod/Machining_Distortion/MachDistIsostatic.py
@@ -44,23 +44,23 @@ def getBoundaryCoditions(Mesh):
SecondIndex = -1
ThirdLength = 10000.0
ThirdIndex = -1
- Index = 0
- for i in Mesh.Nodes:
+
+ for id,i in Mesh.Nodes.items():
l = (i-FreeCAD.Vector(BndBox.XMin,BndBox.YMin,BndBox.ZMin)).Length
if FirstLength > l:
FirstLength = l
- FirstIndex = Index
+ FirstIndex = id
l = (i-FreeCAD.Vector(BndBox.XMax,BndBox.YMin,BndBox.ZMin)).Length
if SecondLength > l:
SecondLength = l
- SecondIndex = Index
+ SecondIndex = id
l = (i-FreeCAD.Vector(BndBox.XMin,BndBox.YMax,BndBox.ZMin)).Length
if ThirdLength > l:
ThirdLength = l
- ThirdIndex = Index
- Index = Index + 1
+ ThirdIndex = id
+
print FirstIndex,SecondIndex,ThirdIndex
return (FirstIndex,SecondIndex,ThirdIndex)