Salome HOME
0023591: [EDF] Add test to check meshing plug-ins to SMESH module
[modules/smesh.git] / doc / salome / examples / modifying_meshes_ex23.py
index a789b76f02a275de18425c824b75d2660d4c71d8..ac8556262d0f21cf97065a290c274e701dc88e93 100644 (file)
@@ -1,10 +1,16 @@
 # Extrusion along a Path
 
 import math
+
 import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
 
-# Geometry
-import geompy
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh =  smeshBuilder.New()
 
 # 1. Create points
 points = [[0, 0], [50, 30], [50, 110], [0, 150], [-80, 150], [-130, 70], [-130, -20]]
@@ -13,7 +19,7 @@ iv = 1
 vertices = []
 for point in points:
     vert = geompy.MakeVertex(point[0], point[1], 0)
-    geompy.addToStudy(vert, "Vertex_" + `iv`)
+    geompy.addToStudy(vert, "Vertex_" + repr(iv))
     vertices.append(vert)
     iv += 1
     pass
@@ -32,11 +38,10 @@ geompy.addToStudy(Edge_Circle  , "Edge_Circle")
 # 3. Explode wire on edges, as they will be used for mesh extrusion
 Wire_polyline_edges = geompy.SubShapeAll(Wire_polyline, geompy.ShapeType["EDGE"])
 for ii in range(len(Wire_polyline_edges)):
-    geompy.addToStudyInFather(Wire_polyline, Wire_polyline_edges[ii], "Edge_" + `ii + 1`)
+    geompy.addToStudyInFather(Wire_polyline, Wire_polyline_edges[ii], "Edge_" + repr(ii + 1))
     pass
 
 # Mesh
-import smesh
 
 # Mesh the given shape with the given 1d hypothesis
 def Mesh1D(shape1d, nbSeg, name):
@@ -44,7 +49,7 @@ def Mesh1D(shape1d, nbSeg, name):
   algo = mesh1d_tool.Segment()
   hyp  = algo.NumberOfSegments(nbSeg)
   isDone = mesh1d_tool.Compute()
-  if not isDone: print 'Mesh ', name, ': computation failed'
+  if not isDone: print('Mesh ', name, ': computation failed')
   return mesh1d_tool
 
 # Create a mesh with six nodes, seven edges and two quadrangle faces
@@ -91,7 +96,7 @@ Edge_Circle_mesh   = Mesh1D(Edge_Circle  , 8, "Edge_Circle")
 # ExtrusionAlongPath
 # IDsOfElements, PathMesh, PathShape, NodeStart,
 # HasAngles, Angles, HasRefPoint, RefPoint
-refPoint = smesh.PointStruct(0, 0, 0)
+refPoint = SMESH.PointStruct(0, 0, 0)
 a10 = 10.0*math.pi/180.0
 a45 = 45.0*math.pi/180.0
 
@@ -123,4 +128,4 @@ error = quad_6.ExtrusionAlongPath(ff_6 , Edge_Circle_mesh, Edge_Circle, 1,
 error = quad_7.ExtrusionAlongPath(ff_7, Edge_Circle_mesh, Edge_Circle, 1,
                                   1, [a45, -a45, a45, -a45, a45, -a45, a45, -a45], 0, refPoint)
 
-salome.sg.updateObjBrowser(1)
+salome.sg.updateObjBrowser()