From 22c64ef8be77bec671151c2007c1381778d777eb Mon Sep 17 00:00:00 2001 From: Uwe Date: Tue, 26 Jul 2022 01:47:09 +0200 Subject: [PATCH] [FEM] update bodyHeatSource - to the state of the other constraints (this constraint is currently completely broken by the way) --- .../femobjects/constraint_bodyheatsource.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Mod/Fem/femobjects/constraint_bodyheatsource.py b/src/Mod/Fem/femobjects/constraint_bodyheatsource.py index f14bf9c666..55df62f475 100644 --- a/src/Mod/Fem/femobjects/constraint_bodyheatsource.py +++ b/src/Mod/Fem/femobjects/constraint_bodyheatsource.py @@ -39,10 +39,17 @@ class ConstraintBodyHeatSource(base_fempythonobject.BaseFemPythonObject): def __init__(self, obj): super(ConstraintBodyHeatSource, self).__init__(obj) + self.add_properties(obj) - obj.addProperty( - "App::PropertyFloat", - "HeatSource", - "Base", - "Body heat source" - ) + def onDocumentRestored(self, obj): + self.add_properties(obj) + + def add_properties(self, obj): + if not hasattr(obj, "HeatSource"): + obj.addProperty( + "App::PropertyFloat", + "HeatSource", + "Base", + "Body heat source" + ) + obj.HeatSource = 0.0