From 1fe8f961164b5356aaabf85e2bc03257d3c494ea Mon Sep 17 00:00:00 2001 From: Gilles DAVID Date: Wed, 29 Mar 2017 16:58:59 +0200 Subject: [PATCH] [PY3] more Swig fix + integer division --- doc/salome/examples/filters_ex34.py | 2 +- doc/salome/examples/quality_controls_ex08.py | 2 +- doc/salome/examples/transforming_meshes_ex12.py | 4 ++-- src/SMESH_SWIG/smeshBuilder.py | 16 ++++++++-------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/salome/examples/filters_ex34.py b/doc/salome/examples/filters_ex34.py index 7234f16ac..4f20b299d 100644 --- a/doc/salome/examples/filters_ex34.py +++ b/doc/salome/examples/filters_ex34.py @@ -4,7 +4,7 @@ from SMESH_mechanic import * # create group of edges all_edges = mesh.GetElementsByType(SMESH.EDGE) -grp = mesh.MakeGroupByIds("edges group", SMESH.EDGE, all_edges[:len(all_edges)/4]) +grp = mesh.MakeGroupByIds("edges group", SMESH.EDGE, all_edges[:len(all_edges) // 4]) import SALOMEDS c = SALOMEDS.Color(0.1, 0.5, 1.0) grp.SetColor(c) diff --git a/doc/salome/examples/quality_controls_ex08.py b/doc/salome/examples/quality_controls_ex08.py index 541af64a3..54ed1bfbc 100644 --- a/doc/salome/examples/quality_controls_ex08.py +++ b/doc/salome/examples/quality_controls_ex08.py @@ -25,7 +25,7 @@ mesh.AutomaticHexahedralization(); # remove half of mesh faces from the smallest face faceFaces = mesh.GetSubMeshElementsId(face) -faceToRemove = faceFaces[: len(faceFaces)/2] +faceToRemove = faceFaces[: len(faceFaces) // 2] mesh.RemoveElements( faceToRemove ) # make a group of volumes missing the removed faces diff --git a/doc/salome/examples/transforming_meshes_ex12.py b/doc/salome/examples/transforming_meshes_ex12.py index e1d850ec6..93c06f998 100644 --- a/doc/salome/examples/transforming_meshes_ex12.py +++ b/doc/salome/examples/transforming_meshes_ex12.py @@ -35,7 +35,7 @@ init_mesh.AutomaticHexahedralization() # it makes 3 x 3 x 3 hexahedrons # remove some faces faces = init_mesh.GetElementsByType( SMESH.FACE ) nb_faces = len( faces ) -rm_face = faces[ : nb_faces/2] +rm_face = faces[ : nb_faces // 2] init_mesh.RemoveElements( rm_face ) # restore boundary in this mesh @@ -65,7 +65,7 @@ init_mesh.AutomaticHexahedralization() # remove some edges edges = init_mesh.GetElementsByType( SMESH.EDGE ) nb_edges = len( edges ) -rm_edge = edges[ : nb_edges/2] +rm_edge = edges[ : nb_edges // 2] init_mesh.RemoveElements( rm_edge ) diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index b1fa7e7f4..775faa89a 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -1223,8 +1223,8 @@ class Mesh(metaclass=MeshMeta): # @param name Study name of the mesh # @ingroup l2_construct def __init__(self, smeshpyD, geompyD, obj=0, name=0): - self.smeshpyD=smeshpyD - self.geompyD=geompyD + self.smeshpyD = smeshpyD + self.geompyD = geompyD if obj is None: obj = 0 objHasName = False @@ -5048,8 +5048,8 @@ class Mesh(metaclass=MeshMeta): # with old dump scripts which call SMESH_Mesh directly and not via smeshBuilder.Mesh # class meshProxy(SMESH._objref_SMESH_Mesh): - def __init__(self): - SMESH._objref_SMESH_Mesh.__init__(self) + def __init__(self, *args): + SMESH._objref_SMESH_Mesh.__init__(self, *args) def __deepcopy__(self, memo=None): new = self.__class__() return new @@ -5064,8 +5064,8 @@ omniORB.registerObjref(SMESH._objref_SMESH_Mesh._NP_RepositoryId, meshProxy) ## Private class wrapping SMESH.SMESH_SubMesh in order to add Compute() # class submeshProxy(SMESH._objref_SMESH_subMesh): - def __init__(self): - SMESH._objref_SMESH_subMesh.__init__(self) + def __init__(self, *args): + SMESH._objref_SMESH_subMesh.__init__(self, *args) self.mesh = None def __deepcopy__(self, memo=None): new = self.__class__() @@ -5101,8 +5101,8 @@ omniORB.registerObjref(SMESH._objref_SMESH_subMesh._NP_RepositoryId, submeshProx # smeshBuilder.Mesh # class meshEditor(SMESH._objref_SMESH_MeshEditor): - def __init__(self): - SMESH._objref_SMESH_MeshEditor.__init__(self) + def __init__(self, *args): + SMESH._objref_SMESH_MeshEditor.__init__(self, *args) self.mesh = None def __getattr__(self, name ): # method called if an attribute not found if not self.mesh: # look for name() method in Mesh class -- 2.39.2