Salome HOME
4f07701efe3d68685687d700135134e48db7eb97
[modules/geom.git] / doc / salome / examples / primitives_ex03.py
1 # Creation of a Sphere
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 # create a vertex
11 p = geompy.MakeVertex(55, 45, 25)
12
13 # create spheres
14 radius1 = 20
15 sphere1 = geompy.MakeSpherePntR(p, radius1)
16 radius2 = 15
17 sphere2 = geompy.MakeSphere(0, 0, 45, radius2)
18 radius3 = 30
19 sphere3 = geompy.MakeSphereR(radius3)
20
21 # add objects in the study
22 id_sphere1 = geompy.addToStudy(sphere1,"Sphere1")
23 id_sphere2 = geompy.addToStudy(sphere2,"Sphere2")
24 id_sphere3 = geompy.addToStudy(sphere3,"Sphere3")
25
26 # display spheres
27 gg.createAndDisplayGO(id_sphere1)
28 gg.setDisplayMode(id_sphere1,1)
29 gg.createAndDisplayGO(id_sphere2)
30 gg.setDisplayMode(id_sphere2,1)
31 gg.createAndDisplayGO(id_sphere3)
32 gg.setDisplayMode(id_sphere3,1)