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):
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:
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`
meshPart = self.mesh
self.mesh.ExportCGNS(meshPart, f, overwrite, groupElemsByType)
+ def ExportStructuredCGNS(self, f, overwrite=1, meshPart=None ):
+ """
+ Export the mesh in a file in Structured CGNS format
+
+ Parameters:
+ f: is the file name
+ overwrite: boolean parameter for overwriting/not overwriting the file
+ meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh
+ """
+
+ unRegister = genObjUnRegister()
+ if isinstance( meshPart, list ):
+ meshPart = self.GetIDSource( meshPart, SMESH.ALL )
+ unRegister.set( meshPart )
+ if isinstance( meshPart, Mesh ):
+ meshPart = meshPart.mesh
+ elif not meshPart:
+ meshPart = self.mesh
+ self.mesh.ExportStructuredCGNS(meshPart, f, overwrite)
+
def ExportGMF(self, f, meshPart=None):
"""
Export the mesh in a file in GMF format.
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 <SMESH.SMESH_IDSource>`)
+ 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.
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.
# If we have a shaper object converting it into geom (temporary solution)
if isinstance(geom, shaper_object):
- geom_obj = _shaperstudy2geom(geompyD, geom)
+ self._geom_obj = _shaperstudy2geom(geompyD, geom)
elif isinstance(geom, geomBuilder.GEOM._objref_GEOM_Object):
- geom_obj = geom
+ self._geom_obj = geom
else:
msg= ""
if not has_shaper: