FEM and Part: check if catched exception has an error message

This commit is contained in:
Bernd Hahnebach
2020-01-07 22:06:38 +01:00
parent 3b2bf60cdf
commit bb6228dde0
3 changed files with 20 additions and 12 deletions

View File

@@ -176,11 +176,13 @@ class _ViewProviderFemMeshGmsh:
return (reg_childs + gro_childs + bou_childs)
def onDelete(self, feature, subelements):
try:
for obj in self.claimChildren():
obj.ViewObject.show()
except Exception as err:
FreeCAD.Console.PrintError("Error in onDelete: " + err.message)
childs = self.claimChildren()
if len(childs) > 0:
try:
for obj in self.claimChildren():
obj.ViewObject.show()
except Exception as err:
FreeCAD.Console.PrintError("Error in onDelete: {0} \n".format(err))
return True
def canDragObjects(self):

View File

@@ -108,11 +108,13 @@ class _ViewProviderFemResultMechanical:
return [self.Object.Mesh] # claimChildren needs to return a list !
def onDelete(self, feature, subelements):
try:
for obj in self.claimChildren():
obj.ViewObject.show()
except Exception as err:
FreeCAD.Console.PrintError("Error in onDelete: {0} \n".format(err))
childs = self.claimChildren()
if len(childs) > 0:
try:
for obj in self.claimChildren():
obj.ViewObject.show()
except Exception as err:
FreeCAD.Console.PrintError("Error in onDelete: {0} \n".format(err))
return True