diff --git a/src/Mod/Material/MatPropDict.xml b/src/Mod/Material/MatPropDict.xml
index f7e159bc5805..cb5ff7d870f9 100644
--- a/src/Mod/Material/MatPropDict.xml
+++ b/src/Mod/Material/MatPropDict.xml
@@ -23,44 +23,44 @@
-
+
https://en.wikipedia.org/wiki/Density
-
+
https://en.wikipedia.org/wiki/Young%27s_modulus
https://en.wikipedia.org/wiki/Poisson%27s_ratio
-
+
https://en.wikipedia.org/wiki/Ultimate_tensile_strength
-
+
https://en.wikipedia.org/wiki/Compressive_strength
-
+
https://en.wikipedia.org/wiki/Yield_Strength
https://en.wikipedia.org/wiki/Deformation_(mechanics)
-
+
https://en.wikipedia.org/wiki/Fracture_toughness
-
+
https://en.wikipedia.org/wiki/Friction#Angle_of_friction
https://en.m.wikipedia.org/wiki/Mohr%E2%80%93Coulomb_theory
-
+
https://en.wikipedia.org/wiki/Thermal_conductivity
-
+
https://en.wikipedia.org/wiki/Volumetric_thermal_expansion_coefficient
-
+
https://en.wikipedia.org/wiki/Heat_capacity
diff --git a/src/Mod/Material/MaterialEditor.py b/src/Mod/Material/MaterialEditor.py
index 35710c21d783..f1465124cd3e 100644
--- a/src/Mod/Material/MaterialEditor.py
+++ b/src/Mod/Material/MaterialEditor.py
@@ -112,13 +112,11 @@ def implementModel(self):
widget = self.widget
treeView = widget.treeView
model = treeView.model()
- model.setHorizontalHeaderLabels(["Property", "Value",
- "Type", "Units"])
+ model.setHorizontalHeaderLabels(["Property", "Value", "Type"])
treeView.setColumnWidth(0, 250)
treeView.setColumnWidth(1, 250)
treeView.setColumnHidden(2, True)
- treeView.setColumnHidden(3, True)
tree = getMaterialAttributeStructure(True)
MatPropDict = tree.getroot()
@@ -141,13 +139,7 @@ def implementModel(self):
tt = properDict['Type']
itType = QtGui.QStandardItem(tt)
- try:
- uu = properDict['Units']
- itUnit = QtGui.QStandardItem(uu)
- except KeyError:
- itUnit = QtGui.QStandardItem()
-
- top.appendRow([item, it, itType, itUnit])
+ top.appendRow([item, it, itType])
top.sortChildren(0)
@@ -486,24 +478,22 @@ def createEditor(self, parent, option, index):
if column == 1:
row = index.row()
+
+ PP = group.child(row, 0)
+ matproperty = PP.text().replace(" ", "") # remove spaces
+
TT = group.child(row, 2)
if TT:
Type = TT.text()
- UU = group.child(row, 3)
- if UU:
- Units = UU.text()
- else:
- Units = None
else:
Type = "String"
- Units = None
VV = group.child(row, 1)
Value = VV.text()
- editor = matProperWidget(parent, Type, Units, Value)
+ editor = matProperWidget(parent, matproperty, Type, Value)
elif column == 0:
@@ -546,7 +536,7 @@ def setEditorData(self, editor, index):
ui = FreeCADGui.UiLoader()
-def matProperWidget(parent=None, Type="String", Units=None, Value=None,
+def matProperWidget(parent=None, matproperty=None, Type="String", Value=None,
minimum=None, maximum=None, stepsize=None, precision=None):
'''customs widgets for the material stuff.'''
@@ -569,13 +559,12 @@ def matProperWidget(parent=None, Type="String", Units=None, Value=None,
elif Type == "Quantity":
widget = ui.createWidget("Gui::InputField")
- if Units:
- vv = string2tuple(Units)
- unit = FreeCAD.Units.Unit(
- vv[0], vv[1], vv[2], vv[3], vv[4], vv[5], vv[6], vv[7]
- )
+ if hasattr(FreeCAD.Units, matproperty):
+ unit = getattr(FreeCAD.Units, matproperty)
quantity = FreeCAD.Units.Quantity(1, unit)
widget.setProperty('unit', quantity.getUserPreferred()[2])
+ else:
+ FreeCAD.Console.PrintError('Not known unit for property: ' + matproperty + '\n')
elif Type == "Integer":