From: eap Date: Mon, 24 Sep 2012 11:32:03 +0000 (+0000) Subject: 021382: EDF 1985 SMESH: Read/write of .mesh files (GMF format) X-Git-Tag: V6_6_0a1~81 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0bea71e6711f03d72bad40f727c26cba8673ab06;p=modules%2Fsmesh.git 021382: EDF 1985 SMESH: Read/write of .mesh files (GMF format) + def ExportGMF(self, f, meshPart=None): + def CreateMeshesFromGMF( self, theFileName ): --- diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index 568c7c9ef..e224ade4c 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -505,6 +505,14 @@ class smeshDC(SMESH._objref_SMESH_Gen): aMeshes.append(aMesh) return aMeshes, aStatus + ## Creates a Mesh object importing data from the given GMF file + # @return [ an instance of Mesh class, SMESH::ComputeError ] + # @ingroup l2_impexp + def CreateMeshesFromGMF( self, theFileName ): + aSmeshMesh, error = SMESH._objref_SMESH_Gen.CreateMeshesFromGMF(self,theFileName) + if error.comment: print "*** CreateMeshesFromGMF() errors:\n", error.comment + return Mesh(self, self.geompyD, aSmeshMesh), error + ## Concatenate the given meshes into one mesh. # @return an instance of Mesh class # @param meshes the meshes to combine into one mesh @@ -1457,6 +1465,19 @@ class Mesh: meshPart = self.mesh self.mesh.ExportCGNS(meshPart, f, overwrite) + ## Exports the mesh in a file in GMF format + # @param f is the file name + # @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh + # @ingroup l2_impexp + def ExportGMF(self, f, meshPart=None): + if isinstance( meshPart, list ): + meshPart = self.GetIDSource( meshPart, SMESH.ALL ) + if isinstance( meshPart, Mesh ): + meshPart = meshPart.mesh + elif not meshPart: + meshPart = self.mesh + self.mesh.ExportGMF(meshPart, f) + ## Deprecated, used only for compatibility! Please, use ExportToMEDX() method instead. # Exports the mesh in a file in MED format and chooses the \a version of MED format ## allowing to overwrite the file if it exists or add the exported data to its contents