[PY3] more Swig fix + integer division

This commit is contained in:
Gilles DAVID 2017-03-29 16:58:59 +02:00
parent 5637345b9a
commit 1fe8f96116
4 changed files with 12 additions and 12 deletions

View File

@ -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)

View File

@ -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

View File

@ -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 )

View File

@ -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