X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_SWIG%2FsmeshBuilder.py;h=2c7211828d54774216d8c8a6fbdb613a0d35b386;hp=9d32e76fa0e25e18e9f345725f6a16e54c747428;hb=HEAD;hpb=f4c4faf3d9c1879d69e2c98cd2c78a31bfde7aff diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index 9d32e76fa..ce1bfdc13 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -741,6 +741,19 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ): if error.comment: print("*** CreateMeshesFromGMF() errors:\n", error.comment) return Mesh(self, self.geompyD, aSmeshMesh), error + def CreateMeshesFromMESHIO(self, theFileName): + """ + Create a Mesh object(s) importing data from from any file supported by meshio library. + + Returns: + a tuple ( list of class :class:`Mesh` instances, + :class:`SMESH.DriverMED_ReadStatus` ) + """ + + aSmeshMeshes, aStatus = SMESH._objref_SMESH_Gen.CreateMeshesFromMESHIO(self, theFileName) + aMeshes = [ Mesh(self, self.geompyD, m) for m in aSmeshMeshes ] + return aMeshes, aStatus + def Concatenate( self, meshes, uniteIdenticalGroups, mergeNodesAndElements = False, mergeTolerance = 1e-5, allGroups = False, name = "", meshToAppendTo = None): @@ -1203,6 +1216,8 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ): functor = aFilterMgr.CreateAspectRatio3D() elif theCriterion == FT_Warping: functor = aFilterMgr.CreateWarping() + elif theCriterion == FT_Warping3D: + functor = aFilterMgr.CreateWarping3D() elif theCriterion == FT_MinimumAngle: functor = aFilterMgr.CreateMinimumAngle() elif theCriterion == FT_Taper: @@ -1999,6 +2014,13 @@ class Mesh(metaclass = MeshMeta): return ok + def CheckCompute(self): + """ + Check if the mesh was properly compute + """ + if not self.mesh.IsComputedOK(): + raise Exception("Could not compute {}".format(self.GetName())) + def GetComputeErrors(self, shape=0 ): """ Return a list of error messages (:class:`SMESH.ComputeError`) of the last :meth:`Compute` @@ -2587,6 +2609,47 @@ class Mesh(metaclass = MeshMeta): meshPart = self.mesh self.mesh.ExportGMF(meshPart, f, True) + def ExportMESHIO( + self, + fileName, + selectedFilter, + meshPart + ): + """ + Exports a part of mesh to a file with meshio library + through an intermediate MED file. + + Parametrs described below are the same as for ExportMED() method. + However, we know that _pyMesh::Process(const Handle(_pyCommand)& theCommand) method + change a position of meshPart argument when dump to a Python script for whatever reason + this way: + - to 5th place for ExportMED command + - to last place for the rest commands + + So, for this method meshPart moved to the end of the args. + Look at src/SMESH_I/SMESH_2smeshpy.cxx for related source code. + + The same note is for the name of the method that was dumped as ExportPartToMESHIO(), + but then processing just removes PartTo from the middle of the name as it was done + for all export methods. + + Parameters: + fileName: is the file name + selectedFilter: filter string selected by user in a file dialog + meshPart: a part of mesh (:class:`sub-mesh, group or filter `) + to export instead of the mesh + """ + + if isinstance(meshPart, Mesh): + meshPart = meshPart.GetMesh() + + self.mesh.ExportPartToMESHIO( + meshPart, + fileName, + selectedFilter + ) + + def ExportToMED(self, *args, **kwargs): """ Deprecated, used only for compatibility! Please, use :meth:`ExportMED` method instead. @@ -7460,6 +7523,19 @@ class Mesh(metaclass = MeshMeta): return self.FunctorValue(SMESH.FT_Warping, elemId) + def GetWarping3D(self, elemId): + """ + Get warping angle of faces element of 3D elements. + + Parameters: + elemId: mesh element ID + + Returns: + element's warping angle value + """ + + return self.FunctorValue(SMESH.FT_Warping3D, elemId) + def GetMinimumAngle(self, elemId): """ Get minimum angle of 2D element.