mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-15 04:40:33 +05:00
Move EnumToLong method from SMESHBuilder class into global module namespace.
This commit is contained in:
parent
4646393f6c
commit
78be86e48b
@ -375,6 +375,10 @@ def FirstVertexOnCurve(mesh, edge):
|
|||||||
else:
|
else:
|
||||||
return vv[1]
|
return vv[1]
|
||||||
|
|
||||||
|
## Return a long value from enumeration
|
||||||
|
def EnumToLong(theItem):
|
||||||
|
return theItem._v
|
||||||
|
|
||||||
# end of l1_auxiliary
|
# end of l1_auxiliary
|
||||||
## @}
|
## @}
|
||||||
|
|
||||||
@ -491,11 +495,6 @@ class smeshBuilder(SMESH._objref_SMESH_Gen):
|
|||||||
obj,name = name,obj
|
obj,name = name,obj
|
||||||
return Mesh(self,self.geompyD,obj,name)
|
return Mesh(self,self.geompyD,obj,name)
|
||||||
|
|
||||||
## Return a long value from enumeration
|
|
||||||
# @ingroup l1_auxiliary
|
|
||||||
def EnumToLong(self,theItem):
|
|
||||||
return theItem._v
|
|
||||||
|
|
||||||
## Return a string representation of the color.
|
## Return a string representation of the color.
|
||||||
# To be used with filters.
|
# To be used with filters.
|
||||||
# @param c color value (SALOMEDS.Color)
|
# @param c color value (SALOMEDS.Color)
|
||||||
@ -749,13 +748,13 @@ class smeshBuilder(SMESH._objref_SMESH_Gen):
|
|||||||
# @return SMESH.Filter.Criterion
|
# @return SMESH.Filter.Criterion
|
||||||
# @ingroup l1_controls
|
# @ingroup l1_controls
|
||||||
def GetEmptyCriterion(self):
|
def GetEmptyCriterion(self):
|
||||||
Type = self.EnumToLong(FT_Undefined)
|
Type = EnumToLong(FT_Undefined)
|
||||||
Compare = self.EnumToLong(FT_Undefined)
|
Compare = EnumToLong(FT_Undefined)
|
||||||
Threshold = 0
|
Threshold = 0
|
||||||
ThresholdStr = ""
|
ThresholdStr = ""
|
||||||
ThresholdID = ""
|
ThresholdID = ""
|
||||||
UnaryOp = self.EnumToLong(FT_Undefined)
|
UnaryOp = EnumToLong(FT_Undefined)
|
||||||
BinaryOp = self.EnumToLong(FT_Undefined)
|
BinaryOp = EnumToLong(FT_Undefined)
|
||||||
Tolerance = 1e-07
|
Tolerance = 1e-07
|
||||||
TypeOfElement = ALL
|
TypeOfElement = ALL
|
||||||
Precision = -1 ##@1e-07
|
Precision = -1 ##@1e-07
|
||||||
@ -790,21 +789,21 @@ class smeshBuilder(SMESH._objref_SMESH_Gen):
|
|||||||
raise TypeError("CritType should be of SMESH.FunctorType")
|
raise TypeError("CritType should be of SMESH.FunctorType")
|
||||||
aCriterion = self.GetEmptyCriterion()
|
aCriterion = self.GetEmptyCriterion()
|
||||||
aCriterion.TypeOfElement = elementType
|
aCriterion.TypeOfElement = elementType
|
||||||
aCriterion.Type = self.EnumToLong(CritType)
|
aCriterion.Type = EnumToLong(CritType)
|
||||||
aCriterion.Tolerance = Tolerance
|
aCriterion.Tolerance = Tolerance
|
||||||
|
|
||||||
aThreshold = Threshold
|
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 = EnumToLong(Compare)
|
||||||
elif Compare == "=" or Compare == "==":
|
elif Compare == "=" or Compare == "==":
|
||||||
aCriterion.Compare = self.EnumToLong(FT_EqualTo)
|
aCriterion.Compare = EnumToLong(FT_EqualTo)
|
||||||
elif Compare == "<":
|
elif Compare == "<":
|
||||||
aCriterion.Compare = self.EnumToLong(FT_LessThan)
|
aCriterion.Compare = EnumToLong(FT_LessThan)
|
||||||
elif Compare == ">":
|
elif Compare == ">":
|
||||||
aCriterion.Compare = self.EnumToLong(FT_MoreThan)
|
aCriterion.Compare = EnumToLong(FT_MoreThan)
|
||||||
elif Compare != FT_Undefined:
|
elif Compare != FT_Undefined:
|
||||||
aCriterion.Compare = self.EnumToLong(FT_EqualTo)
|
aCriterion.Compare = EnumToLong(FT_EqualTo)
|
||||||
aThreshold = Compare
|
aThreshold = Compare
|
||||||
|
|
||||||
if CritType in [FT_BelongToGeom, FT_BelongToPlane, FT_BelongToGenSurface,
|
if CritType in [FT_BelongToGeom, FT_BelongToPlane, FT_BelongToGenSurface,
|
||||||
@ -886,7 +885,7 @@ class smeshBuilder(SMESH._objref_SMESH_Gen):
|
|||||||
elif CritType == FT_ElemGeomType:
|
elif CritType == FT_ElemGeomType:
|
||||||
# Check the Threshold
|
# Check the Threshold
|
||||||
try:
|
try:
|
||||||
aCriterion.Threshold = self.EnumToLong(aThreshold)
|
aCriterion.Threshold = EnumToLong(aThreshold)
|
||||||
assert( aThreshold in SMESH.GeometryType._items )
|
assert( aThreshold in SMESH.GeometryType._items )
|
||||||
except:
|
except:
|
||||||
if isinstance(aThreshold, int):
|
if isinstance(aThreshold, int):
|
||||||
@ -898,7 +897,7 @@ class smeshBuilder(SMESH._objref_SMESH_Gen):
|
|||||||
elif CritType == FT_EntityType:
|
elif CritType == FT_EntityType:
|
||||||
# Check the Threshold
|
# Check the Threshold
|
||||||
try:
|
try:
|
||||||
aCriterion.Threshold = self.EnumToLong(aThreshold)
|
aCriterion.Threshold = EnumToLong(aThreshold)
|
||||||
assert( aThreshold in SMESH.EntityType._items )
|
assert( aThreshold in SMESH.EntityType._items )
|
||||||
except:
|
except:
|
||||||
if isinstance(aThreshold, int):
|
if isinstance(aThreshold, int):
|
||||||
@ -922,7 +921,7 @@ class smeshBuilder(SMESH._objref_SMESH_Gen):
|
|||||||
FT_EqualNodes,FT_EqualEdges,FT_EqualFaces,FT_EqualVolumes ]:
|
FT_EqualNodes,FT_EqualEdges,FT_EqualFaces,FT_EqualVolumes ]:
|
||||||
# At this point the Threshold is unnecessary
|
# At this point the Threshold is unnecessary
|
||||||
if aThreshold == FT_LogicalNOT:
|
if aThreshold == FT_LogicalNOT:
|
||||||
aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)
|
aCriterion.UnaryOp = EnumToLong(FT_LogicalNOT)
|
||||||
elif aThreshold in [FT_LogicalAND, FT_LogicalOR]:
|
elif aThreshold in [FT_LogicalAND, FT_LogicalOR]:
|
||||||
aCriterion.BinaryOp = aThreshold
|
aCriterion.BinaryOp = aThreshold
|
||||||
else:
|
else:
|
||||||
@ -935,16 +934,16 @@ class smeshBuilder(SMESH._objref_SMESH_Gen):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
if Threshold == FT_LogicalNOT or UnaryOp == FT_LogicalNOT:
|
if Threshold == FT_LogicalNOT or UnaryOp == FT_LogicalNOT:
|
||||||
aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)
|
aCriterion.UnaryOp = EnumToLong(FT_LogicalNOT)
|
||||||
|
|
||||||
if Threshold in [FT_LogicalAND, FT_LogicalOR]:
|
if Threshold in [FT_LogicalAND, FT_LogicalOR]:
|
||||||
aCriterion.BinaryOp = self.EnumToLong(Threshold)
|
aCriterion.BinaryOp = EnumToLong(Threshold)
|
||||||
|
|
||||||
if UnaryOp in [FT_LogicalAND, FT_LogicalOR]:
|
if UnaryOp in [FT_LogicalAND, FT_LogicalOR]:
|
||||||
aCriterion.BinaryOp = self.EnumToLong(UnaryOp)
|
aCriterion.BinaryOp = EnumToLong(UnaryOp)
|
||||||
|
|
||||||
if BinaryOp in [FT_LogicalAND, FT_LogicalOR]:
|
if BinaryOp in [FT_LogicalAND, FT_LogicalOR]:
|
||||||
aCriterion.BinaryOp = self.EnumToLong(BinaryOp)
|
aCriterion.BinaryOp = EnumToLong(BinaryOp)
|
||||||
|
|
||||||
return aCriterion
|
return aCriterion
|
||||||
|
|
||||||
@ -991,8 +990,8 @@ class smeshBuilder(SMESH._objref_SMESH_Gen):
|
|||||||
# @ingroup l1_controls
|
# @ingroup l1_controls
|
||||||
def GetFilterFromCriteria(self,criteria, binOp=SMESH.FT_LogicalAND):
|
def GetFilterFromCriteria(self,criteria, binOp=SMESH.FT_LogicalAND):
|
||||||
for i in range( len( criteria ) - 1 ):
|
for i in range( len( criteria ) - 1 ):
|
||||||
if criteria[i].BinaryOp == self.EnumToLong( SMESH.FT_Undefined ):
|
if criteria[i].BinaryOp == EnumToLong( SMESH.FT_Undefined ):
|
||||||
criteria[i].BinaryOp = self.EnumToLong( binOp )
|
criteria[i].BinaryOp = EnumToLong( binOp )
|
||||||
aFilterMgr = self.CreateFilterManager()
|
aFilterMgr = self.CreateFilterManager()
|
||||||
aFilter = aFilterMgr.CreateFilter()
|
aFilter = aFilterMgr.CreateFilter()
|
||||||
aFilter.SetCriteria(criteria)
|
aFilter.SetCriteria(criteria)
|
||||||
@ -1077,7 +1076,7 @@ class smeshBuilder(SMESH._objref_SMESH_Gen):
|
|||||||
d = {}
|
d = {}
|
||||||
if hasattr(obj, "GetMeshInfo"):
|
if hasattr(obj, "GetMeshInfo"):
|
||||||
values = obj.GetMeshInfo()
|
values = obj.GetMeshInfo()
|
||||||
for i in range(self.EnumToLong(SMESH.Entity_Last)):
|
for i in range(EnumToLong(SMESH.Entity_Last)):
|
||||||
if i < len(values): d[SMESH.EntityType._item(i)]=values[i]
|
if i < len(values): d[SMESH.EntityType._item(i)]=values[i]
|
||||||
pass
|
pass
|
||||||
return d
|
return d
|
||||||
@ -1333,7 +1332,7 @@ class Mesh(metaclass=MeshMeta):
|
|||||||
self.geom = self.mesh.GetShapeToMesh()
|
self.geom = self.mesh.GetShapeToMesh()
|
||||||
|
|
||||||
self.editor = self.mesh.GetMeshEditor()
|
self.editor = self.mesh.GetMeshEditor()
|
||||||
self.functors = [None] * self.smeshpyD.EnumToLong(SMESH.FT_Undefined)
|
self.functors = [None] * EnumToLong(SMESH.FT_Undefined)
|
||||||
|
|
||||||
# set self to algoCreator's
|
# set self to algoCreator's
|
||||||
for attrName in dir(self):
|
for attrName in dir(self):
|
||||||
@ -1672,7 +1671,7 @@ class Mesh(metaclass=MeshMeta):
|
|||||||
groups = []
|
groups = []
|
||||||
for algoName, shapes in list(algo2shapes.items()):
|
for algoName, shapes in list(algo2shapes.items()):
|
||||||
while shapes:
|
while shapes:
|
||||||
groupType = self.smeshpyD.EnumToLong( shapes[0].GetShapeType() )
|
groupType = EnumToLong( shapes[0].GetShapeType() )
|
||||||
otherTypeShapes = []
|
otherTypeShapes = []
|
||||||
sameTypeShapes = []
|
sameTypeShapes = []
|
||||||
group = self.geompyD.CreateGroup( self.geom, groupType )
|
group = self.geompyD.CreateGroup( self.geom, groupType )
|
||||||
@ -4982,11 +4981,11 @@ class Mesh(metaclass=MeshMeta):
|
|||||||
return self.editor.CreateHoleSkin( radius, theShape, groupName, theNodesCoords )
|
return self.editor.CreateHoleSkin( radius, theShape, groupName, theNodesCoords )
|
||||||
|
|
||||||
def _getFunctor(self, funcType ):
|
def _getFunctor(self, funcType ):
|
||||||
fn = self.functors[ self.smeshpyD.EnumToLong(funcType) ]
|
fn = self.functors[ EnumToLong(funcType) ]
|
||||||
if not fn:
|
if not fn:
|
||||||
fn = self.smeshpyD.GetFunctor(funcType)
|
fn = self.smeshpyD.GetFunctor(funcType)
|
||||||
fn.SetMesh(self.mesh)
|
fn.SetMesh(self.mesh)
|
||||||
self.functors[ self.smeshpyD.EnumToLong(funcType) ] = fn
|
self.functors[ EnumToLong(funcType) ] = fn
|
||||||
return fn
|
return fn
|
||||||
|
|
||||||
## Return value of a functor for a given element
|
## Return value of a functor for a given element
|
||||||
|
Loading…
Reference in New Issue
Block a user