From a7ea47847acb45969e58727862b6b6a4ccbdeb65 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Mon, 2 Mar 2020 20:36:46 +0100 Subject: [PATCH] FEM: mesh tools, better type checking --- src/Mod/Fem/femmesh/meshtools.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Mod/Fem/femmesh/meshtools.py b/src/Mod/Fem/femmesh/meshtools.py index e3e06fda01..09d2ba519c 100644 --- a/src/Mod/Fem/femmesh/meshtools.py +++ b/src/Mod/Fem/femmesh/meshtools.py @@ -732,15 +732,16 @@ def get_elset_short_name( obj, i ): - if hasattr(obj, "Proxy") and obj.Proxy.Type == "Fem::Material": + from femtools.femutils import is_of_type + if is_of_type(obj, "Fem::Material"): return "M" + str(i) - elif hasattr(obj, "Proxy") and obj.Proxy.Type == "Fem::FemElementGeometry1D": + elif is_of_type(obj, "Fem::FemElementGeometry1D"): return "B" + str(i) - elif hasattr(obj, "Proxy") and obj.Proxy.Type == "Fem::FemElementRotation1D": + elif is_of_type(obj, "Fem::FemElementRotation1D"): return "R" + str(i) - elif hasattr(obj, "Proxy") and obj.Proxy.Type == "Fem::FemElementFluid1D": + elif is_of_type(obj, "Fem::FemElementFluid1D"): return "F" + str(i) - elif hasattr(obj, "Proxy") and obj.Proxy.Type == "Fem::FemElementGeometry2D": + elif is_of_type(obj, "Fem::FemElementGeometry2D"): return "S" + str(i) else: FreeCAD.Console.PrintError(