diff --git a/src/Mod/Fem/MechanicalAnalysis.py b/src/Mod/Fem/MechanicalAnalysis.py
index 40112306f..966d43d34 100644
--- a/src/Mod/Fem/MechanicalAnalysis.py
+++ b/src/Mod/Fem/MechanicalAnalysis.py
@@ -88,7 +88,9 @@ class _CommandMechanicalJobControl:
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Analysis","Dialog to start the calculation of the machanical anlysis")}
def Activated(self):
- taskd = _JobControlTaskPanel()
+ import FemGui
+
+ taskd = _JobControlTaskPanel(FemGui.getActiveAnalysis())
#taskd.obj = vobj.Object
taskd.update()
FreeCADGui.Control.showDialog(taskd)
@@ -96,7 +98,8 @@ class _CommandMechanicalJobControl:
def IsActive(self):
import FemGui
- return True
+ return FreeCADGui.ActiveDocument != None and FemGui.getActiveAnalysis() != None
+
class _FemAnalysis:
@@ -163,13 +166,13 @@ class _ViewProviderFemAnalysis:
class _JobControlTaskPanel:
'''The editmode TaskPanel for Material objects'''
- def __init__(self):
+ def __init__(self,object):
# the panel has a tree widget that contains categories
# for the subcomponents, such as additions, subtractions.
# the categories are shown only if they are not empty.
form_class, base_class = uic.loadUiType(FreeCAD.getHomePath() + "Mod/Fem/MechanicalAnalysis.ui")
- #self.obj = object
+ self.obj = object
self.formUi = form_class()
self.form = QtGui.QWidget()
self.formUi.setupUi(self.form)
diff --git a/src/Mod/Fem/MechanicalMaterial.py b/src/Mod/Fem/MechanicalMaterial.py
index 1003d4cb5..064995ae4 100644
--- a/src/Mod/Fem/MechanicalMaterial.py
+++ b/src/Mod/Fem/MechanicalMaterial.py
@@ -33,11 +33,7 @@ __title__="Machine-Distortion FemSetGeometryObject managment"
__author__ = "Juergen Riegel"
__url__ = "http://free-cad.sourceforge.net"
-StartMat = {'General_name' :'Steel',
- 'Mechanical_youngsmodulus' :'7000.00',
- 'FEM_poissonratio' :'0.30',
- }
-
+
def makeMechanicalMaterial(name):
'''makeMaterial(name): makes an Material
@@ -66,8 +62,8 @@ class _CommandMechanicalMaterial:
FreeCAD.ActiveDocument.openTransaction("Create Material")
FreeCADGui.addModule("MechanicalMaterial")
FreeCADGui.doCommand("MechanicalMaterial.makeMechanicalMaterial('MechanicalMaterial')")
- FreeCADGui.doCommand("App.activeDocument()."+FemGui.getActiveAnalysis().Name+".Member = App.activeDocument()."+FemGui.getActiveAnalysis().Name+".Member + [App.ActiveDocument.activeObject()]")
- FreeCADGui.doCommand("Gui.activeDocument().setEdit(mat.Name,0)")
+ FreeCADGui.doCommand("App.activeDocument()."+FemGui.getActiveAnalysis().Name+".Member = App.activeDocument()."+FemGui.getActiveAnalysis().Name+".Member + [App.ActiveDocument.ActiveObject]")
+ FreeCADGui.doCommand("Gui.activeDocument().setEdit(App.ActiveDocument.ActiveObject.Name,0)")
#FreeCADGui.doCommand("Fem.makeMaterial()")
else:
FreeCADGui.doCommand("Gui.activeDocument().setEdit('"+MatObj.Name+"',0)")
@@ -84,7 +80,7 @@ class _MechanicalMaterial:
def __init__(self,obj):
self.Type = "MechanicaltMaterial"
obj.Proxy = self
- obj.Material = StartMat
+ #obj.Material = StartMat
def execute(self,obj):
@@ -154,7 +150,7 @@ class _MechanicalMaterialTaskPanel:
matmap = self.obj.Material
- matmap['Mechanical_youngsmodulus'] = str(self.formUi.spinBox_young_modulus.value())
+ matmap['Mechanical_youngsmodulus'] = str(self.formUi.spinBox_young_modulus.value() * 1e+6)
matmap['FEM_poissonratio'] = str(self.formUi.spinBox_poisson_ratio.value())
self.obj.Material = matmap
@@ -165,8 +161,10 @@ class _MechanicalMaterialTaskPanel:
matmap = self.obj.Material
if matmap.has_key('Mechanical_youngsmodulus'):
- self.formUi.spinBox_young_modulus.setValue(float(matmap['Mechanical_youngsmodulus']))
+ print float(matmap['Mechanical_youngsmodulus'])
+ self.formUi.spinBox_young_modulus.setValue(float(matmap['Mechanical_youngsmodulus'])/1e+6)
if matmap.has_key('FEM_poissonratio'):
+ print float(matmap['FEM_poissonratio'])
self.formUi.spinBox_poisson_ratio.setValue(float(matmap['FEM_poissonratio']))
def isAllowedAlterSelection(self):
@@ -180,6 +178,8 @@ class _MechanicalMaterialTaskPanel:
def update(self):
'fills the widgets'
+ self.formUi.spinBox_young_modulus.setValue(0.0)
+ self.formUi.spinBox_poisson_ratio.setValue(0.0)
self.transferFrom()
self.fillMaterialCombo()
@@ -218,10 +218,14 @@ class _MechanicalMaterialTaskPanel:
def fillMaterialCombo(self):
import glob,os
+ matmap = self.obj.Material
dirname = FreeCAD.ConfigGet("AppHomePath")+"data/Mod/Material/StandardMaterial"
self.pathList = glob.glob(dirname + '/*.FCMat')
self.formUi.comboBox_MaterialsInDir.clear()
- self.formUi.comboBox_MaterialsInDir.addItem('-> choose Material')
+ if(matmap.has_key('General_name')):
+ self.formUi.comboBox_MaterialsInDir.addItem(matmap['General_name'])
+ else:
+ self.formUi.comboBox_MaterialsInDir.addItem('-> choose Material')
for i in self.pathList:
self.formUi.comboBox_MaterialsInDir.addItem(os.path.basename(i) )
diff --git a/src/Mod/Fem/MechanicalMaterial.ui b/src/Mod/Fem/MechanicalMaterial.ui
index 7d121ed41..120266931 100644
--- a/src/Mod/Fem/MechanicalMaterial.ui
+++ b/src/Mod/Fem/MechanicalMaterial.ui
@@ -6,7 +6,7 @@
0
0
- 194
+ 196
142
@@ -63,25 +63,31 @@
- 60
+ 80
20
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+ 3
+
- 999999.989999999990687
+ 2000.000000000000000
+
+
+ 2.000000000000000
- 70000.000000000000000
+ 0.000000000000000
-
- Young Modulus (kPa)
+ Young's Mod.(GPa)
@@ -95,13 +101,19 @@
- 60
+ 80
20
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+ 3
+
+
+ 1.000000000000000
+
0.100000000000000
diff --git a/src/Mod/Material/StandardMaterial/ABS.FCMat b/src/Mod/Material/StandardMaterial/ABS.FCMat
index 32b754f05..8797224b0 100644
--- a/src/Mod/Material/StandardMaterial/ABS.FCMat
+++ b/src/Mod/Material/StandardMaterial/ABS.FCMat
@@ -24,3 +24,6 @@ SpecificPrice= 3
YoungsModulus=2.32e+06
; http://en.wikipedia.org/wiki/Ultimate_tensile_strength in kPa
UltimateTensileStrength= 38000
+
+[FEM]
+PoissonRatio = 0.35
\ No newline at end of file
diff --git a/src/Mod/Material/StandardMaterial/PLA.FCMat b/src/Mod/Material/StandardMaterial/PLA.FCMat
index 3fcd2ac43..bd5c72ba9 100644
--- a/src/Mod/Material/StandardMaterial/PLA.FCMat
+++ b/src/Mod/Material/StandardMaterial/PLA.FCMat
@@ -24,3 +24,7 @@ SpecificPrice= 4
YoungsModulus=3.64e+06
; http://en.wikipedia.org/wiki/Ultimate_tensile_strength in kPa
UltimateTensileStrength= 49600
+
+
+[FEM]
+PoissonRatio = 0.36
\ No newline at end of file
diff --git a/src/Mod/Material/StandardMaterial/Steel.FCMat b/src/Mod/Material/StandardMaterial/Steel.FCMat
index 361cc411a..984f4c2a2 100644
--- a/src/Mod/Material/StandardMaterial/Steel.FCMat
+++ b/src/Mod/Material/StandardMaterial/Steel.FCMat
@@ -30,3 +30,6 @@ CompressiveStrength=
Elasticity=
; http://en.wikipedia.org/wiki/Fracture_toughness
FractureToughness:
+
+[FEM]
+PoissonRatio = 0.3
\ No newline at end of file