0021014: EDF 1583 SMESH: Improvement of the Python Dump for the creation of groups

+    def GetFilterFromCriteria(self,criteria):
+    def GroupOnFilter(self, typ, name, filter):
This commit is contained in:
eap 2011-06-23 12:38:38 +00:00
parent 00d6e38575
commit d0b3f328a8

View File

@ -781,7 +781,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
aCriterion.Compare = self.EnumToLong(FT_LessThan) aCriterion.Compare = self.EnumToLong(FT_LessThan)
elif Compare == ">": elif Compare == ">":
aCriterion.Compare = self.EnumToLong(FT_MoreThan) aCriterion.Compare = self.EnumToLong(FT_MoreThan)
else: elif Compare != FT_Undefined:
aCriterion.Compare = self.EnumToLong(FT_EqualTo) aCriterion.Compare = self.EnumToLong(FT_EqualTo)
aTreshold = Compare aTreshold = Compare
@ -896,6 +896,19 @@ class smeshDC(SMESH._objref_SMESH_Gen):
aFilterMgr.UnRegister() aFilterMgr.UnRegister()
return aFilter return aFilter
## Creates a filter from criteria
# @param criteria a list of criteria
# @return SMESH_Filter
#
# <a href="../tui_filters_page.html#tui_filters">Example of Filters usage</a>
# @ingroup l1_controls
def GetFilterFromCriteria(self,criteria):
aFilterMgr = self.CreateFilterManager()
aFilter = aFilterMgr.CreateFilter()
aFilter.SetCriteria(criteria)
aFilterMgr.UnRegister()
return aFilter
## Creates a numerical functor by its type ## Creates a numerical functor by its type
# @param theCriterion FT_...; functor type # @param theCriterion FT_...; functor type
# @return SMESH_NumericalFunctor # @return SMESH_NumericalFunctor
@ -940,14 +953,14 @@ class smeshDC(SMESH._objref_SMESH_Gen):
def CreateHypothesis(self, theHType, theLibName="libStdMeshersEngine.so"): def CreateHypothesis(self, theHType, theLibName="libStdMeshersEngine.so"):
return SMESH._objref_SMESH_Gen.CreateHypothesis(self, theHType, theLibName ) return SMESH._objref_SMESH_Gen.CreateHypothesis(self, theHType, theLibName )
## Gets the mesh stattistic ## Gets the mesh statistic
# @return dictionary type element - count of elements # @return dictionary <element type> - <count of elements>
# @ingroup l1_meshinfo # @ingroup l1_meshinfo
def GetMeshInfo(self, obj): def GetMeshInfo(self, obj):
if isinstance( obj, Mesh ): if isinstance( obj, Mesh ):
obj = obj.GetMesh() obj = obj.GetMesh()
d = {} d = {}
if hasattr(obj, "_narrow") and obj._narrow(SMESH.SMESH_IDSource): if hasattr(obj, "GetMeshInfo"):
values = obj.GetMeshInfo() values = obj.GetMeshInfo()
for i in range(SMESH.Entity_Last._v): for i in range(SMESH.Entity_Last._v):
if i < len(values): d[SMESH.EntityType._item(i)]=values[i] if i < len(values): d[SMESH.EntityType._item(i)]=values[i]
@ -1654,17 +1667,6 @@ class Mesh:
pass pass
pass pass
## Creates a mesh group based on the geometric object \a grp
# and gives a \a name, \n if this parameter is not defined
# the name is the same as the geometric group name \n
# Note: Works like GroupOnGeom().
# @param grp a geometric group, a vertex, an edge, a face or a solid
# @param name the name of the mesh group
# @return SMESH_GroupOnGeom
# @ingroup l2_grps_create
def Group(self, grp, name=""):
return self.GroupOnGeom(grp, name)
## Deprecated, used only for compatibility! Please, use ExportMED() method instead. ## Deprecated, used only for compatibility! Please, use ExportMED() method instead.
## Exports the mesh in a file in MED format and chooses the \a version of MED format ## 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 ## allowing to overwrite the file if it exists or add the exported data to its contents
@ -1744,6 +1746,17 @@ class Mesh:
def CreateEmptyGroup(self, elementType, name): def CreateEmptyGroup(self, elementType, name):
return self.mesh.CreateGroup(elementType, name) return self.mesh.CreateGroup(elementType, name)
## Creates a mesh group based on the geometric object \a grp
# and gives a \a name, \n if this parameter is not defined
# the name is the same as the geometric group name \n
# Note: Works like GroupOnGeom().
# @param grp a geometric group, a vertex, an edge, a face or a solid
# @param name the name of the mesh group
# @return SMESH_GroupOnGeom
# @ingroup l2_grps_create
def Group(self, grp, name=""):
return self.GroupOnGeom(grp, name)
## Creates a mesh group based on the geometrical object \a grp ## Creates a mesh group based on the geometrical object \a grp
# and gives a \a name, \n if this parameter is not defined # and gives a \a name, \n if this parameter is not defined
# the name is the same as the geometrical group name # the name is the same as the geometrical group name
@ -1807,6 +1820,17 @@ class Mesh:
else: else:
return self.mesh.CreateGroupFromGEOM(typ, name, grp) return self.mesh.CreateGroupFromGEOM(typ, name, grp)
## Creates a mesh group with given \a name based on the \a filter which
## is a special type of group dynamically updating it's contents during
## mesh modification
# @param typ the type of elements in the group
# @param name the name of the mesh group
# @param filter the filter defining group contents
# @return SMESH_GroupOnFilter
# @ingroup l2_grps_create
def GroupOnFilter(self, typ, name, filter):
return self.mesh.CreateGroupFromFilter(typ, name, filter)
## Creates a mesh group by the given ids of elements ## Creates a mesh group by the given ids of elements
# @param groupName the name of the mesh group # @param groupName the name of the mesh group
# @param elementType the type of elements in the group # @param elementType the type of elements in the group