From 441b3d517e9767d22a7fd11c0e219b192c92e2fb Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Wed, 26 Jun 2019 23:55:38 +0200 Subject: [PATCH] FEM: utils, add a method to get the Part to mesh --- src/Mod/Fem/femtools/femutils.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Mod/Fem/femtools/femutils.py b/src/Mod/Fem/femtools/femutils.py index 47817ad776ef..11051e15a9fa 100644 --- a/src/Mod/Fem/femtools/femutils.py +++ b/src/Mod/Fem/femtools/femutils.py @@ -152,6 +152,23 @@ def get_pref_working_dir(solver_obj): # other +def get_part_to_mesh(mesh_obj): + ''' + gmsh mesh object: the Attribute is Part + netgen mesh object: the Attribute is Shape + other mesh objects: do not have a Attribute which holds the part to mesh + ''' + if is_derived_from(mesh_obj, "Fem::FemMeshGmsh"): + return mesh_obj.Part + elif is_derived_from(mesh_obj, "Fem::FemMeshShapeNetgenObject"): + return mesh_obj.Shape + else: + return None + # TODO: the Attributes should be named with the same name + # should it be Shape or Part? + # IMHO Part since the Attributes references the document object and not a Shape + + def getBoundBoxOfAllDocumentShapes(doc): overalboundbox = None for o in doc.Objects: