From 800b96d25b387400a56b135333ed140212b15cde Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Wed, 14 Jul 2021 22:24:04 +0200 Subject: [PATCH] FEM: material task panel, catch wrong ThermalConductivity quantity --- src/Mod/Fem/femtaskpanels/task_material_common.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Mod/Fem/femtaskpanels/task_material_common.py b/src/Mod/Fem/femtaskpanels/task_material_common.py index 7bf592b1a2..95248510c5 100644 --- a/src/Mod/Fem/femtaskpanels/task_material_common.py +++ b/src/Mod/Fem/femtaskpanels/task_material_common.py @@ -477,6 +477,19 @@ class _TaskPanel: self.material["VolumetricThermalExpansionCoefficient"] = "0 m^3/m^3/K" # Thermal properties if "ThermalConductivity" in self.material: + # TODO implement for all task panel values + # https://forum.freecadweb.org/viewtopic.php?f=18&t=56912&p=516826#p516800 + try: + Units.Quantity(self.material["ThermalConductivity"]) + except Exception: + FreeCAD.Console.PrintError( + "Problem with the quantity for ThermalConductivity: '{}' Reset value.\n" + "May try the following in Python console:\n" + "from FreeCAD import Units\n" + "Units.Quantity('{}')\n" + .format(self.material["ThermalConductivity"], self.material["ThermalConductivity"]) + ) + self.material["ThermalConductivity"] = "0 W/m/K" if "ThermalConductivity" not in str(Units.Unit(self.material["ThermalConductivity"])): FreeCAD.Console.PrintMessage( "ThermalConductivity in material data seems to have no unit "