X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_SWIG%2FStdMeshersBuilder.py;h=a81853eb31dd328c8f35d298be7f1ab91e6b390b;hb=10191484fe88a27e962b8e4b57e09d390d8705c7;hp=beea2de8dd50cf27c54944cf9c8f66ad5e1736f2;hpb=90e0893c89027a434e832eb72eeac85391b909e9;p=modules%2Fsmesh.git diff --git a/src/SMESH_SWIG/StdMeshersBuilder.py b/src/SMESH_SWIG/StdMeshersBuilder.py index beea2de8d..a81853eb3 100644 --- a/src/SMESH_SWIG/StdMeshersBuilder.py +++ b/src/SMESH_SWIG/StdMeshersBuilder.py @@ -369,7 +369,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm): def LengthNearVertex(self, length, vertex=0, UseExisting=0): import types store_geom = self.geom - if type(vertex) is types.IntType: + if isinstance(vertex, int): if vertex == 0 or vertex == 1: from salome.geom import geomBuilder vertex = self.mesh.geompyD.ExtractShapes(self.geom, geomBuilder.geomBuilder.ShapeType["VERTEX"],True)[vertex] @@ -382,7 +382,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm): # 0D algorithm if self.geom is None: self.geom = store_geom - raise RuntimeError, "Attempt to create SegmentAroundVertex_0D algorithm on None shape" + raise RuntimeError("Attempt to create SegmentAroundVertex_0D algorithm on None shape") from salome.smesh.smeshBuilder import AssureGeomPublished, GetName, TreatHypoStatus AssureGeomPublished( self.mesh, self.geom ) name = GetName(self.geom) @@ -983,7 +983,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): ## Return 3D hypothesis holding the 1D one def Get3DHypothesis(self): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None return self.distribHyp @@ -991,15 +991,14 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # hypothesis. Returns the created hypothesis def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None if not self.nbLayers is None: self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers ) self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp ) - study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis - self.mesh.smeshpyD.SetCurrentStudy( None ) + self.mesh.smeshpyD.SetEnablePublish( False ) # prevents publishing own 1D hypothesis hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so) - self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing + self.mesh.smeshpyD.SetEnablePublish( True ) # enables publishing if not self.distribHyp: self.distribHyp = self.Hypothesis("LayerDistribution", UseExisting=0) self.distribHyp.SetLayerDistribution( hyp ) @@ -1012,7 +1011,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # the same parameters, else (default) - creates a new one def NumberOfLayers(self, n, UseExisting=0): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None self.mesh.RemoveHypothesis( self.distribHyp, self.geom ) from salome.smesh.smeshBuilder import IsEqual @@ -1028,7 +1027,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # @param p the precision of rounding def LocalLength(self, l, p=1e-07): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None hyp = self.OwnHypothesis("LocalLength", [l,p]) hyp.SetLength(l) @@ -1041,7 +1040,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # @param s the scale factor (optional) def NumberOfSegments(self, n, s=[]): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None if not s: hyp = self.OwnHypothesis("NumberOfSegments", [n]) @@ -1058,7 +1057,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # @param end the length of the last segment def Arithmetic1D(self, start, end ): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None hyp = self.OwnHypothesis("Arithmetic1D", [start, end]) hyp.SetLength(start, 1) @@ -1072,7 +1071,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # @param ratio the common ratio of the geometric progression def GeometricProgression(self, start, ratio ): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None hyp = self.OwnHypothesis("GeometricProgression", [start, ratio]) hyp.SetStartLength( start ) @@ -1085,7 +1084,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # @param end for the length of the last segment def StartEndLength(self, start, end): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None hyp = self.OwnHypothesis("StartEndLength", [start, end]) hyp.SetLength(start, 1) @@ -1097,7 +1096,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # @param fineness defines the quality of the mesh within the range [0-1] def AutomaticLength(self, fineness=0): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None hyp = self.OwnHypothesis("AutomaticLength") hyp.SetFineness( fineness ) @@ -1163,10 +1162,9 @@ class StdMeshersBuilder_RadialAlgorithm(Mesh_Algorithm): self.distribHyp = self.Hypothesis("LayerDistribution2D", UseExisting=0) else: self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp ) - study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis - self.mesh.smeshpyD.SetCurrentStudy( None ) + self.mesh.smeshpyD.SetEnablePublish( False ) hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so) - self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing + self.mesh.smeshpyD.SetEnablePublish( True ) self.distribHyp.SetLayerDistribution( hyp ) return hyp @@ -1493,7 +1491,7 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm): self.mesh.AddHypothesis( self.hyp, self.geom ) for axis, gridDef in enumerate( [xGridDef, yGridDef, zGridDef] ): - if not gridDef: raise ValueError, "Empty grid definition" + if not gridDef: raise ValueError("Empty grid definition") if isinstance( gridDef, str ): self.hyp.SetGridSpacing( [gridDef], [], axis ) elif isinstance( gridDef[0], str ):