From a1666fb119f79c77cb4141ec1707520e6a6581fc Mon Sep 17 00:00:00 2001 From: skl Date: Wed, 20 Jun 2007 07:42:13 +0000 Subject: [PATCH] Corrected for bug N7PAL16198. --- src/SMESH_SWIG/smesh.py | 308 +++++++++++++++++++++++++++++----------- 1 file changed, 226 insertions(+), 82 deletions(-) diff --git a/src/SMESH_SWIG/smesh.py b/src/SMESH_SWIG/smesh.py index 3e070a596..843979b5c 100644 --- a/src/SMESH_SWIG/smesh.py +++ b/src/SMESH_SWIG/smesh.py @@ -402,6 +402,13 @@ class Mesh_Algorithm: geom = 0 subm = 0 algo = 0 + hypos = {} + + def FindHypothesis(self,hypname, args): + key = "%s %s %s" % (self.__class__.__name__, hypname, args) + if Mesh_Algorithm.hypos.has_key( key ): + return Mesh_Algorithm.hypos[ key ] + return None ## If the algorithm is global, return 0; \n # else return the submesh associated to this algorithm. @@ -433,41 +440,57 @@ class Mesh_Algorithm: ## Private method. def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"): + if geom is None: + raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape" + algo = smesh.CreateHypothesis(hypo, so) + self.Assign(algo, mesh, geom) + return self.algo + + ## Private method + def Assign(self, algo, mesh, geom): if geom is None: raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape" self.mesh = mesh piece = mesh.geom - if geom==0: + if not geom: self.geom = piece - name = GetName(piece) else: self.geom = geom name = GetName(geom) if name==NO_NAME: name = geompy.SubShapeName(geom, piece) geompy.addToStudyInFather(piece, geom, name) - self.subm = mesh.mesh.GetSubMesh(geom, hypo) + self.subm = mesh.mesh.GetSubMesh(geom, algo.GetName()) - self.algo = smesh.CreateHypothesis(hypo, so) - SetName(self.algo, name + "/" + hypo) + self.algo = algo status = mesh.mesh.AddHypothesis(self.geom, self.algo) - TreatHypoStatus( status, hypo, name, 1 ) - + TreatHypoStatus( status, algo.GetName(), GetName(algo), True ) + ## Private method - def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so"): - hypo = smesh.CreateHypothesis(hyp, so) - a = "" - s = "=" - i = 0 - n = len(args) - while i