if Compare in [FT_LessThan, FT_MoreThan, FT_EqualTo]:
aCriterion.Compare = EnumToLong(Compare)
+ elif Compare == "=" or Compare == "==":
+ aCriterion.Compare = EnumToLong(FT_EqualTo)
+ elif Compare == "<":
+ aCriterion.Compare = EnumToLong(FT_LessThan)
+ elif Compare == ">":
+ aCriterion.Compare = EnumToLong(FT_MoreThan)
else:
aCriterion.Compare = EnumToLong(FT_EqualTo)
aTreshold = Compare
- if CritType in [FT_BelongToGeom, FT_BelongToPlane,
+ if CritType in [FT_BelongToGeom, FT_BelongToPlane, FT_BelongToGenSurface,
FT_BelongToCylinder, FT_LyingOnGeom]:
# Check treshold
if isinstance(aTreshold, geompy.GEOM._objref_GEOM_Object):
print "Error: given parameter is not numerucal functor type."
+## Private method. Print error message if a hypothesis was not assigned.
+def TreatHypoStatus(status, hypName, geomName, isAlgo):
+ if isAlgo:
+ hypType = "algorithm"
+ else:
+ hypType = "hypothesis"
+ pass
+ if status == HYP_UNKNOWN_FATAL :
+ reason = "for unknown reason"
+ elif status == HYP_INCOMPATIBLE :
+ reason = "this hypothesis mismatches algorithm"
+ elif status == HYP_NOTCONFORM :
+ reason = "not conform mesh would be built"
+ elif status == HYP_ALREADY_EXIST :
+ reason = hypType + " of the same dimension already assigned to this shape"
+ elif status == HYP_BAD_DIM :
+ reason = hypType + " mismatches shape"
+ elif status == HYP_CONCURENT :
+ reason = "there are concurrent hypotheses on sub-shapes"
+ elif status == HYP_BAD_SUBSHAPE :
+ reason = "shape is neither the main one, nor its subshape, nor a valid group"
+ elif status == HYP_BAD_GEOMETRY:
+ reason = "geometry mismatches algorithm's expectation"
+ elif status == HYP_HIDDEN_ALGO:
+ reason = "it is hidden by an algorithm of upper dimension generating all-dimensions elements"
+ elif status == HYP_HIDING_ALGO:
+ reason = "it hides algorithm(s) of lower dimension by generating all-dimensions elements"
+ else:
+ return
+ hypName = '"' + hypName + '"'
+ geomName= '"' + geomName+ '"'
+ if status < HYP_UNKNOWN_FATAL:
+ print hypName, "was assigned to", geomName,"but", reason
+ else:
+ print hypName, "was not assigned to",geomName,":", reason
+ pass
+
## Mother class to define algorithm, recommended to don't use directly.
def GetId(self):
return self.algo.GetId()
- ## Private method. Print error message if a hypothesis was not assigned.
- def TreatHypoStatus(self, status, hypName, geomName, isAlgo):
- if isAlgo:
- hypType = "algorithm"
- else:
- hypType = "hypothesis"
- if status == HYP_UNKNOWN_FATAL :
- reason = "for unknown reason"
- elif status == HYP_INCOMPATIBLE :
- reason = "this hypothesis mismatches algorithm"
- elif status == HYP_NOTCONFORM :
- reason = "not conform mesh would be built"
- elif status == HYP_ALREADY_EXIST :
- reason = hypType + " of the same dimension already assigned to this shape"
- elif status == HYP_BAD_DIM :
- reason = hypType + " mismatches shape"
- elif status == HYP_CONCURENT :
- reason = "there are concurrent hypotheses on sub-shapes"
- elif status == HYP_BAD_SUBSHAPE :
- reason = "shape is neither the main one, nor its subshape, nor a valid group"
- elif status == HYP_BAD_GEOMETRY:
- reason = "geometry mismatches algorithm's expectation"
- else:
- return
- hypName = '"' + hypName + '"'
- geomName= '"' + geomName+ '"'
- if status < HYP_UNKNOWN_FATAL:
- print hypName, "was assigned to", geomName,"but", reason
- else:
- print hypName, "was not assigned to",geomName,":", reason
- pass
-
## Private method.
def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
if geom is None:
self.algo = smesh.CreateHypothesis(hypo, so)
SetName(self.algo, name + "/" + hypo)
status = mesh.mesh.AddHypothesis(self.geom, self.algo)
- self.TreatHypoStatus( status, hypo, name, 1 )
+ TreatHypoStatus( status, hypo, name, 1 )
## Private method
def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so"):
name = GetName(self.geom)
SetName(hypo, name + "/" + hyp + a)
status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
- self.TreatHypoStatus( status, hyp, name, 0 )
+ TreatHypoStatus( status, hyp, name, 0 )
return hypo
def __init__(self, mesh, geom=0):
self.Create(mesh, geom, "RadialPrism_3D")
self.distribHyp = self.Hypothesis( "LayerDistribution" )
+ self.nbLayers = None
## Return 3D hypothesis holding the 1D one
def Get3DHypothesis(self):
## Private method creating 1D hypothes and storing it in the LayerDistribution
# hypothes. Returns the created hypothes
def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"):
+ if not self.nbLayers is None:
+ self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers )
+ self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp )
study = GetCurrentStudy() # prevent publishing of own 1D hypothesis
hyp = smesh.CreateHypothesis(hypType, so)
SetCurrentStudy( study ) # anable publishing
## Define "NumberOfLayers" hypothesis, specifying a number of layers of
# prisms to build between the inner and outer shells
def NumberOfLayers(self, n ):
- hyp = self.Hypothesis("NumberOfLayers")
- hyp.SetNumberOfLayers( n )
- return hyp
+ self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp )
+ self.nbLayers = self.Hypothesis("NumberOfLayers")
+ self.nbLayers.SetNumberOfLayers( n )
+ return self.nbLayers
## Define "LocalLength" hypothesis, specifying segment length
# to build between the inner and outer shells
# @param obj Shape to be meshed or SMESH_Mesh object
# @param name Study name of the mesh
def __init__(self, obj=0, name=0):
+ if obj is None:
+ obj = 0
if obj != 0:
if isinstance(obj, geompy.GEOM._objref_GEOM_Object):
self.geom = obj