X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_SWIG%2FSMESH_demo_hexa2_upd.py;h=68558d27ce1002edd90dd6447d04531a1c033d4b;hp=8414aa21a68ce596061ddcb8da97850a266197a1;hb=2aed859fcd4a79ddeaf25370c39b2ee713fc873c;hpb=6bac08c1a81f34d3f21c550bd92f83654b2546a5 diff --git a/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py b/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py index 8414aa21a..68558d27c 100755 --- a/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py +++ b/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -36,11 +36,11 @@ import salome salome.salome_init() import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() import SMESH, SALOMEDS from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() import math @@ -103,14 +103,14 @@ tol3d = 1.e-3 vol = geompy.MakeGlueFaces(volComp,tol3d) idVol = geompy.addToStudy(vol,"volume") -print "Analysis of the final volume:" +print("Analysis of the final volume:") subShellList = geompy.SubShapeAllSorted(vol,ShapeTypeShell) subFaceList = geompy.SubShapeAllSorted(vol,ShapeTypeFace) subEdgeList = geompy.SubShapeAllSorted(vol,ShapeTypeEdge) -print "number of Shells in the volume : ",len(subShellList) -print "number of Faces in the volume : ",len(subFaceList) -print "number of Edges in the volume : ",len(subEdgeList) +print("number of Shells in the volume : ",len(subShellList)) +print("number of Faces in the volume : ",len(subFaceList)) +print("number of Edges in the volume : ",len(subEdgeList)) idSubEdge = [] for k in range(len(subEdgeList)): @@ -131,7 +131,7 @@ for i in range(8): idEdgeZ.append(geompy.addToStudyInFather(vol,edgeZ[i],"EdgeZ"+str(i+1))) ### ---------------------------- SMESH -------------------------------------- -smesh.SetCurrentStudy(salome.myStudy) +smesh.UpdateStudy() # ---- init a Mesh with the volume @@ -139,36 +139,36 @@ mesh = smesh.Mesh(vol, "meshVolume") # ---- set Hypothesis and Algorithm to main shape -print "-------------------------- NumberOfSegments the global one" +print("-------------------------- NumberOfSegments the global one") numberOfSegments = 10 regular1D = mesh.Segment() regular1D.SetName("Wire Discretisation") hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) -print hypNbSeg.GetName() -print hypNbSeg.GetId() -print hypNbSeg.GetNumberOfSegments() +print(hypNbSeg.GetName()) +print(hypNbSeg.GetId()) +print(hypNbSeg.GetNumberOfSegments()) smesh.SetName(hypNbSeg, "NumberOfSegments") -print "-------------------------- Quadrangle_2D" +print("-------------------------- Quadrangle_2D") quad2D=mesh.Quadrangle() quad2D.SetName("Quadrangle_2D") -print "-------------------------- Hexa_3D" +print("-------------------------- Hexa_3D") hexa3D=mesh.Hexahedron() hexa3D.SetName("Hexa_3D") -print "-------------------------- NumberOfSegments in the Z direction" +print("-------------------------- NumberOfSegments in the Z direction") numberOfSegmentsZ = 40 for i in range(8): - print "-------------------------- add hypothesis to edge in the Z directions", (i+1) + print("-------------------------- add hypothesis to edge in the Z directions", (i+1)) algo = mesh.Segment(edgeZ[i]) hyp = algo.NumberOfSegments(numberOfSegmentsZ) @@ -176,25 +176,25 @@ for i in range(8): smesh.SetName(algo.GetSubMesh(), "SubMeshEdgeZ_"+str(i+1)) -salome.sg.updateObjBrowser(1) +salome.sg.updateObjBrowser() -print "-------------------------- compute the mesh of the volume" +print("-------------------------- compute the mesh of the volume") ret=mesh.Compute() -print ret +print(ret) if ret != 0: ## log=mesh.GetLog(0) # no erase trace ## for linelog in log: ## print linelog - print "Information about the MeshBox :" - print "Number of nodes : ", mesh.NbNodes() - print "Number of edges : ", mesh.NbEdges() - print "Number of faces : ", mesh.NbFaces() - print "Number of triangles : ", mesh.NbTriangles() - print "Number of volumes : ", mesh.NbVolumes() - print "Number of tetrahedrons: ", mesh.NbTetras() + print("Information about the MeshBox :") + print("Number of nodes : ", mesh.NbNodes()) + print("Number of edges : ", mesh.NbEdges()) + print("Number of faces : ", mesh.NbFaces()) + print("Number of triangles : ", mesh.NbTriangles()) + print("Number of volumes : ", mesh.NbVolumes()) + print("Number of tetrahedrons: ", mesh.NbTetras()) else: - print "problem when Computing the mesh" + print("problem when Computing the mesh") -salome.sg.updateObjBrowser(1) +salome.sg.updateObjBrowser()