Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/geom.git] / doc / salome / gui / GEOM / input / tui_primitives.doc
1 /*!
2
3 \page tui_primitives_page Primitives
4
5 \anchor tui_creation_box
6 <br><h2>Creation of a Box</h2>
7
8 \code
9 import geompy
10 import salome
11 gg = salome.ImportComponentGUI("GEOM")
12
13 # create vertices
14 p0 = geompy.MakeVertex(15, 25, 35)
15 p70 = geompy.MakeVertex(70, 70, 70)
16
17 # create boxes
18 box1 = geompy.MakeBoxDXDYDZ(10, 20, 30)
19 box2 = geompy.MakeBox(10,20,30, 15,25,35)
20 box3 = geompy.MakeBoxTwoPnt(p0, p70)
21
22 # add objects in the study
23 id_box1 = geompy.addToStudy(box1,"Box1")
24 id_box2 = geompy.addToStudy(box2,"Box2")
25 id_box3 = geompy.addToStudy(box3,"Box3")
26
27 # display the boxes
28 gg.createAndDisplayGO(id_box1)
29 gg.setDisplayMode(id_box1,1)
30 gg.createAndDisplayGO(id_box2)
31 gg.setDisplayMode(id_box2,1)
32 gg.createAndDisplayGO(id_box3)
33 gg.setDisplayMode(id_box3,1)
34 \endcode
35
36 \anchor tui_creation_cylinder
37 <br><h2>Creation of a Cylinder</h2>
38
39 \code
40 import geompy
41 import salome
42
43 gg = salome.ImportComponentGUI("GEOM")
44
45 # create a vertex and a vector
46 p1 = geompy.MakeVertex(25, 35, 45)
47 p2 = geompy.MakeVertex(70, 70, 70)
48 v = geompy.MakeVector(p1, p2)
49
50 # create cylinders
51 height = 40
52
53 radius1 = 15
54 cylinder1 = geompy.MakeCylinder(p1, v, radius1, height)
55
56 radius2 = 30
57 cylinder2 = geompy.MakeCylinderRH(radius2, height)
58
59 # add objects in the study
60 id_cylinder1 = geompy.addToStudy(cylinder1,"Cylinder1")
61 id_cylinder2 = geompy.addToStudy(cylinder2,"Cylinder2")
62
63 # display the cylinders
64 gg.createAndDisplayGO(id_cylinder1)
65 gg.setDisplayMode(id_cylinder1,1)
66 gg.createAndDisplayGO(id_cylinder2)
67 gg.setDisplayMode(id_cylinder2,1) 
68 \endcode
69
70 \anchor tui_creation_sphere
71 <br><h2>Creation of a Sphere</h2>
72
73 \code
74 import geompy
75 import salome
76 gg = salome.ImportComponentGUI("GEOM")
77
78 # create a vertex
79 p = geompy.MakeVertex(55, 45, 25)
80
81 # create spheres
82 radius1 = 20
83 sphere1 = geompy.MakeSpherePntR(p, radius1)
84 radius2 = 15
85 sphere2 = geompy.MakeSphere(0, 0, 45, radius2)
86 radius3 = 30
87 sphere3 = geompy.MakeSphereR(radius3)
88
89 # add objects in the study
90 id_sphere1 = geompy.addToStudy(sphere1,"Sphere1")
91 id_sphere2 = geompy.addToStudy(sphere2,"Sphere2")
92 id_sphere3 = geompy.addToStudy(sphere3,"Sphere3")
93
94 # display spheres
95 gg.createAndDisplayGO(id_sphere1)
96 gg.setDisplayMode(id_sphere1,1)
97 gg.createAndDisplayGO(id_sphere2)
98 gg.setDisplayMode(id_sphere2,1)
99 gg.createAndDisplayGO(id_sphere3)
100 gg.setDisplayMode(id_sphere3,1) 
101 \endcode
102
103 \anchor tui_creation_torus 
104 <br><h2>Creation of a Torus</h2>
105
106 \code
107 import geompy
108 import salome
109 gg = salome.ImportComponentGUI("GEOM")
110
111 # create a vertex and a vector
112 p1 = geompy.MakeVertex(35, 40, 45)
113 p2 = geompy.MakeVertex(35, 45, 70)
114 v = geompy.MakeVector(p1, p2)
115
116 # create toruses
117 torus1 = geompy.MakeTorus(p1, v, 20, 10)
118 torus2 = geompy.MakeTorusRR(30, 15)
119
120 # add objects in the study
121 id_torus1 = geompy.addToStudy(torus1,"Torus1")
122 id_torus2 = geompy.addToStudy(torus2,"Torus2")
123
124 # display toruses
125 gg.createAndDisplayGO(id_torus1)
126 gg.setDisplayMode(id_torus1,1)
127 gg.createAndDisplayGO(id_torus2)
128 gg.setDisplayMode(id_torus2,1) 
129 \endcode
130
131 \anchor tui_creation_cone
132 <br><h2>Creation of a Cone</h2>
133
134 \code
135 import geompy
136 import salome
137 gg = salome.ImportComponentGUI("GEOM")
138
139 # create a vertex and a vector
140 p1 = geompy.MakeVertex(35, 35, 0)
141 p2 = geompy.MakeVertex(35, 35, 70)
142 v = geompy.MakeVector(p1, p2)
143
144 # create cones
145 cone1 = geompy.MakeCone(p1, v, 17, 1, 20)
146 cone2 = geompy.MakeConeR1R2H(30, 10, 30)
147
148 # add objects in the study
149 id_cone1 = geompy.addToStudy(cone1,"Cone1")
150 id_cone2 = geompy.addToStudy(cone2,"Cone2")
151
152 # display cones
153 gg.createAndDisplayGO(id_cone1)
154 gg.setDisplayMode(id_cone1,1)
155 gg.createAndDisplayGO(id_cone2)
156 gg.setDisplayMode(id_cone2,1) 
157 \endcode
158
159 */