Salome HOME
Merge remote branch 'origin/hydro/imps_2015'
[modules/geom.git] / doc / salome / examples / complex_objs_ex05.py
1 # Creation of a PipeWithDifferentSections
2
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8 gg = salome.ImportComponentGUI("GEOM")
9
10 Wire_1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 100 0:R 0:C 100 90:T 0 200", [0, 0, 0, 0, 0, 1, 1, 0, -0])
11 edges = geompy.SubShapeAll(Wire_1, geompy.ShapeType["EDGE"])
12 vertices = geompy.SubShapeAll(Wire_1, geompy.ShapeType["VERTEX"])
13
14 # create sections
15 circles=[]
16 circles.append(geompy.MakeCircle(vertices[0], edges[0], 20))
17 circles.append(geompy.MakeCircle(vertices[1], edges[0], 40))
18 circles.append(geompy.MakeCircle(vertices[2], edges[2], 30))
19 circles.append(geompy.MakeCircle(vertices[3], edges[2], 20))
20
21 # create pipes
22 Pipe1 = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0)
23 Pipe2 = geompy.MakePipeWithDifferentSectionsBySteps(circles, vertices, Wire_1)
24
25 # add objects in the study
26 geompy.addToStudy(circles[0], "circles1")
27 geompy.addToStudy(circles[1], "circles2")
28 geompy.addToStudy(circles[2], "circles3")
29 geompy.addToStudy(circles[3], "circles4")
30 id_wire  = geompy.addToStudy(Wire_1, "Path")
31 id_pipe1 = geompy.addToStudy(Pipe1, "Pipe1")
32 id_pipe2 = geompy.addToStudy(Pipe2, "Pipe2")
33
34 # display the wire(path) and the pipe
35 gg.createAndDisplayGO(id_wire)
36 gg.createAndDisplayGO(id_pipe1)
37 gg.createAndDisplayGO(id_pipe2)
38 gg.setDisplayMode(id_pipe1,1)
39 gg.setDisplayMode(id_pipe2,1)