rename treshold -> threshold

This commit is contained in:
eap 2012-02-24 10:42:57 +00:00
parent feb9a2ff2e
commit 6c858efd41

View File

@ -820,7 +820,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
# @param elementType the type of elements(NODE, EDGE, FACE, VOLUME) # @param elementType the type of elements(NODE, EDGE, FACE, VOLUME)
# @param CritType the type of criterion (FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc.) # @param CritType the type of criterion (FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc.)
# @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo} # @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo}
# @param Treshold the threshold value (range of ids as string, shape, numeric) # @param Threshold the threshold value (range of ids as string, shape, numeric)
# @param UnaryOp FT_LogicalNOT or FT_Undefined # @param UnaryOp FT_LogicalNOT or FT_Undefined
# @param BinaryOp a binary logical operation FT_LogicalAND, FT_LogicalOR or # @param BinaryOp a binary logical operation FT_LogicalAND, FT_LogicalOR or
# FT_Undefined (must be for the last criterion of all criteria) # FT_Undefined (must be for the last criterion of all criteria)
@ -833,7 +833,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
def GetCriterion(self,elementType, def GetCriterion(self,elementType,
CritType, CritType,
Compare = FT_EqualTo, Compare = FT_EqualTo,
Treshold="", Threshold="",
UnaryOp=FT_Undefined, UnaryOp=FT_Undefined,
BinaryOp=FT_Undefined, BinaryOp=FT_Undefined,
Tolerance=1e-07): Tolerance=1e-07):
@ -844,7 +844,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
aCriterion.Type = self.EnumToLong(CritType) aCriterion.Type = self.EnumToLong(CritType)
aCriterion.Tolerance = Tolerance aCriterion.Tolerance = Tolerance
aTreshold = Treshold aThreshold = Threshold
if Compare in [FT_LessThan, FT_MoreThan, FT_EqualTo]: if Compare in [FT_LessThan, FT_MoreThan, FT_EqualTo]:
aCriterion.Compare = self.EnumToLong(Compare) aCriterion.Compare = self.EnumToLong(Compare)
@ -856,57 +856,57 @@ class smeshDC(SMESH._objref_SMESH_Gen):
aCriterion.Compare = self.EnumToLong(FT_MoreThan) aCriterion.Compare = self.EnumToLong(FT_MoreThan)
elif Compare != FT_Undefined: elif Compare != FT_Undefined:
aCriterion.Compare = self.EnumToLong(FT_EqualTo) aCriterion.Compare = self.EnumToLong(FT_EqualTo)
aTreshold = Compare aThreshold = Compare
if CritType in [FT_BelongToGeom, FT_BelongToPlane, FT_BelongToGenSurface, if CritType in [FT_BelongToGeom, FT_BelongToPlane, FT_BelongToGenSurface,
FT_BelongToCylinder, FT_LyingOnGeom]: FT_BelongToCylinder, FT_LyingOnGeom]:
# Checks the treshold # Checks the Threshold
if isinstance(aTreshold, geompyDC.GEOM._objref_GEOM_Object): if isinstance(aThreshold, geompyDC.GEOM._objref_GEOM_Object):
aCriterion.ThresholdStr = GetName(aTreshold) aCriterion.ThresholdStr = GetName(aThreshold)
aCriterion.ThresholdID = salome.ObjectToID(aTreshold) aCriterion.ThresholdID = salome.ObjectToID(aThreshold)
else: else:
print "Error: The treshold should be a shape." print "Error: The Threshold should be a shape."
return None return None
if isinstance(UnaryOp,float): if isinstance(UnaryOp,float):
aCriterion.Tolerance = UnaryOp aCriterion.Tolerance = UnaryOp
UnaryOp = FT_Undefined UnaryOp = FT_Undefined
pass pass
elif CritType == FT_RangeOfIds: elif CritType == FT_RangeOfIds:
# Checks the treshold # Checks the Threshold
if isinstance(aTreshold, str): if isinstance(aThreshold, str):
aCriterion.ThresholdStr = aTreshold aCriterion.ThresholdStr = aThreshold
else: else:
print "Error: The treshold should be a string." print "Error: The Threshold should be a string."
return None return None
elif CritType == FT_CoplanarFaces: elif CritType == FT_CoplanarFaces:
# Checks the treshold # Checks the Threshold
if isinstance(aTreshold, int): if isinstance(aThreshold, int):
aCriterion.ThresholdID = "%s"%aTreshold aCriterion.ThresholdID = "%s"%aThreshold
elif isinstance(aTreshold, str): elif isinstance(aThreshold, str):
ID = int(aTreshold) ID = int(aThreshold)
if ID < 1: if ID < 1:
raise ValueError, "Invalid ID of mesh face: '%s'"%aTreshold raise ValueError, "Invalid ID of mesh face: '%s'"%aThreshold
aCriterion.ThresholdID = aTreshold aCriterion.ThresholdID = aThreshold
else: else:
raise ValueError,\ raise ValueError,\
"The treshold should be an ID of mesh face and not '%s'"%aTreshold "The Threshold should be an ID of mesh face and not '%s'"%aThreshold
elif CritType == FT_ElemGeomType: elif CritType == FT_ElemGeomType:
# Checks the treshold # Checks the Threshold
try: try:
aCriterion.Threshold = self.EnumToLong(aTreshold) aCriterion.Threshold = self.EnumToLong(aThreshold)
assert( aTreshold in SMESH.GeometryType._items ) assert( aThreshold in SMESH.GeometryType._items )
except: except:
if isinstance(aTreshold, int): if isinstance(aThreshold, int):
aCriterion.Threshold = aTreshold aCriterion.Threshold = aThreshold
else: else:
print "Error: The treshold should be an integer or SMESH.GeometryType." print "Error: The Threshold should be an integer or SMESH.GeometryType."
return None return None
pass pass
pass pass
elif CritType == FT_GroupColor: elif CritType == FT_GroupColor:
# Checks the treshold # Checks the Threshold
try: try:
aCriterion.ThresholdStr = self.ColorToString(aTreshold) aCriterion.ThresholdStr = self.ColorToString(aThreshold)
except: except:
print "Error: The threshold value should be of SALOMEDS.Color type" print "Error: The threshold value should be of SALOMEDS.Color type"
return None return None
@ -916,25 +916,25 @@ class smeshDC(SMESH._objref_SMESH_Gen):
FT_BareBorderFace, FT_BareBorderVolume, FT_BareBorderFace, FT_BareBorderVolume,
FT_OverConstrainedFace, FT_OverConstrainedVolume, FT_OverConstrainedFace, FT_OverConstrainedVolume,
FT_EqualNodes,FT_EqualEdges,FT_EqualFaces,FT_EqualVolumes ]: FT_EqualNodes,FT_EqualEdges,FT_EqualFaces,FT_EqualVolumes ]:
# At this point the treshold is unnecessary # At this point the Threshold is unnecessary
if aTreshold == FT_LogicalNOT: if aThreshold == FT_LogicalNOT:
aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT) aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)
elif aTreshold in [FT_LogicalAND, FT_LogicalOR]: elif aThreshold in [FT_LogicalAND, FT_LogicalOR]:
aCriterion.BinaryOp = aTreshold aCriterion.BinaryOp = aThreshold
else: else:
# Check treshold # Check Threshold
try: try:
aTreshold = float(aTreshold) aThreshold = float(aThreshold)
aCriterion.Threshold = aTreshold aCriterion.Threshold = aThreshold
except: except:
print "Error: The treshold should be a number." print "Error: The Threshold should be a number."
return None return None
if Treshold == FT_LogicalNOT or UnaryOp == FT_LogicalNOT: if Threshold == FT_LogicalNOT or UnaryOp == FT_LogicalNOT:
aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT) aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)
if Treshold in [FT_LogicalAND, FT_LogicalOR]: if Threshold in [FT_LogicalAND, FT_LogicalOR]:
aCriterion.BinaryOp = self.EnumToLong(Treshold) aCriterion.BinaryOp = self.EnumToLong(Threshold)
if UnaryOp in [FT_LogicalAND, FT_LogicalOR]: if UnaryOp in [FT_LogicalAND, FT_LogicalOR]:
aCriterion.BinaryOp = self.EnumToLong(UnaryOp) aCriterion.BinaryOp = self.EnumToLong(UnaryOp)
@ -948,7 +948,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
# @param elementType the type of elements in the group # @param elementType the type of elements in the group
# @param CritType the type of criterion ( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. ) # @param CritType the type of criterion ( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
# @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo} # @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo}
# @param Treshold the threshold value (range of id ids as string, shape, numeric) # @param Threshold the threshold value (range of id ids as string, shape, numeric)
# @param UnaryOp FT_LogicalNOT or FT_Undefined # @param UnaryOp FT_LogicalNOT or FT_Undefined
# @param Tolerance the tolerance used by FT_BelongToGeom, FT_BelongToSurface, # @param Tolerance the tolerance used by FT_BelongToGeom, FT_BelongToSurface,
# FT_LyingOnGeom, FT_CoplanarFaces and FT_EqualNodes criteria # FT_LyingOnGeom, FT_CoplanarFaces and FT_EqualNodes criteria
@ -959,10 +959,10 @@ class smeshDC(SMESH._objref_SMESH_Gen):
def GetFilter(self,elementType, def GetFilter(self,elementType,
CritType=FT_Undefined, CritType=FT_Undefined,
Compare=FT_EqualTo, Compare=FT_EqualTo,
Treshold="", Threshold="",
UnaryOp=FT_Undefined, UnaryOp=FT_Undefined,
Tolerance=1e-07): Tolerance=1e-07):
aCriterion = self.GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined,Tolerance) aCriterion = self.GetCriterion(elementType, CritType, Compare, Threshold, UnaryOp, FT_Undefined,Tolerance)
aFilterMgr = self.CreateFilterManager() aFilterMgr = self.CreateFilterManager()
aFilter = aFilterMgr.CreateFilter() aFilter = aFilterMgr.CreateFilter()
aCriteria = [] aCriteria = []
@ -1948,7 +1948,7 @@ class Mesh:
# @param elementType the type of elements in the group # @param elementType the type of elements in the group
# @param CritType the type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. ) # @param CritType the type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
# @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo} # @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo}
# @param Treshold the threshold value (range of id ids as string, shape, numeric) # @param Threshold the threshold value (range of id ids as string, shape, numeric)
# @param UnaryOp FT_LogicalNOT or FT_Undefined # @param UnaryOp FT_LogicalNOT or FT_Undefined
# @param Tolerance the tolerance used by FT_BelongToGeom, FT_BelongToSurface, # @param Tolerance the tolerance used by FT_BelongToGeom, FT_BelongToSurface,
# FT_LyingOnGeom, FT_CoplanarFaces criteria # FT_LyingOnGeom, FT_CoplanarFaces criteria
@ -1959,10 +1959,10 @@ class Mesh:
elementType, elementType,
CritType=FT_Undefined, CritType=FT_Undefined,
Compare=FT_EqualTo, Compare=FT_EqualTo,
Treshold="", Threshold="",
UnaryOp=FT_Undefined, UnaryOp=FT_Undefined,
Tolerance=1e-07): Tolerance=1e-07):
aCriterion = self.smeshpyD.GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined,Tolerance) aCriterion = self.smeshpyD.GetCriterion(elementType, CritType, Compare, Threshold, UnaryOp, FT_Undefined,Tolerance)
group = self.MakeGroupByCriterion(groupName, aCriterion) group = self.MakeGroupByCriterion(groupName, aCriterion)
return group return group