Salome HOME
Merge from V5_1_main branch 24/11/2010
[modules/geom.git] / doc / salome / gui / GEOM / input / tui_advanced_geom_objs.doc
1 /*!
2
3 \page tui_advanced_geom_objs_page Advanced Geometrical Objects
4
5 \anchor tui_creation_edge
6 <br><h2>Creation of an Edge</h2>
7
8 \code
9 import geompy
10 import salome
11 gg = salome.ImportComponentGUI("GEOM")
12
13 #
14 # create edge by two points
15 #
16
17 # create vertices
18 p0   = geompy.MakeVertex(0.  , 0.  , 0.  )
19 pxyz = geompy.MakeVertex(100., 100., 100.)
20
21 # create an edge
22 edge = geompy.MakeEdge(p0, pxyz)
23
24 # add object in the study
25 id_edge = geompy.addToStudy(edge,"Edge_1")
26
27 # display an edge
28 gg.createAndDisplayGO(id_edge) 
29
30 #
31 # create edge from wire
32 #
33
34 # create a circle
35 c = geompy.MakeCircle(None, None, 100)
36
37 # create a wire
38 w = geompy.MakeWire([c], 1e-07)
39
40 # create an edge from wire
41 edge = geompy.MakeEdgeWire(w)
42
43 # add object in the study
44 id_edge = geompy.addToStudy(edge,"Edge_2")
45
46 # display an edge
47 gg.createAndDisplayGO(id_edge) 
48
49 \endcode
50  
51 \anchor tui_creation_wire
52 <br><h2>Creation of a Wire</h2>
53
54 \code
55 import geompy
56 import salome
57 gg = salome.ImportComponentGUI("GEOM")
58
59 # create vertices
60 px   = geompy.MakeVertex(100., 0.  , 0.  )
61 py   = geompy.MakeVertex(0.  , 100., 0.  )
62 pz   = geompy.MakeVertex(0.  , 0.  , 100.)
63
64 # create a vector from two points
65 vxy = geompy.MakeVector(px, py)
66
67 # create an arc from three points
68 arc = geompy.MakeArc(py, pz, px)
69
70 # create a wire
71 wire = geompy.MakeWire([vxy, arc])
72
73 # add an object in the study
74 id_wire = geompy.addToStudy(wire,"Wire")
75
76 # display the wire
77 gg.createAndDisplayGO(id_wire) 
78 \endcode
79  
80 \anchor tui_creation_face
81 <br><h2>Creation of a Face</h2>
82
83 \code
84 import geompy
85 import salome
86 gg = salome.ImportComponentGUI("GEOM")
87
88 # create vertices
89 p0   = geompy.MakeVertex(0.  , 0.  , 0.  )
90 px   = geompy.MakeVertex(100., 0.  , 0.  )
91 py   = geompy.MakeVertex(0.  , 100., 0.  )
92 pz   = geompy.MakeVertex(0.  , 0.  , 100.)
93 pxyz = geompy.MakeVertex(100., 100., 100.)
94
95 # create a vector from two points
96 vxy = geompy.MakeVector(px, py)
97
98 # create an arc from three points
99 arc = geompy.MakeArc(py, pz, px)
100
101 # create a wire
102 wire = geompy.MakeWire([vxy, arc])
103
104 # create sketchers
105 sketcher1 = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW",
106                                 [100,0,0, 1,1,1, -1,1,0])
107 sketcher2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
108 sketcher3 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
109 isPlanarFace = 1
110
111 # create a face from the wire
112 face1 = geompy.MakeFace(wire, isPlanarFace)
113
114 # create faces from two wires
115 face2 = geompy.MakeFaceWires([wire, sketcher1],isPlanarFace)
116 face3 = geompy.MakeFaces([sketcher2, sketcher3],isPlanarFace)
117
118 # add objects in the study
119 id_face1 = geompy.addToStudy(face1,"Face1")
120 id_face2 = geompy.addToStudy(face2,"Face2")
121 id_face3 = geompy.addToStudy(face3,"Face3")
122
123 # display the faces
124 gg.createAndDisplayGO(id_face1)
125 gg.setDisplayMode(id_face1,1)
126 gg.setTransparency(id_face1,0.2)
127 gg.createAndDisplayGO(id_face2)
128 gg.setDisplayMode(id_face2,1)
129 gg.setTransparency(id_face2,0.2)
130 gg.createAndDisplayGO(id_face3)
131 gg.setDisplayMode(id_face3,1)
132 gg.setTransparency(id_face3,0.2) 
133 \endcode
134  
135 \anchor tui_creation_shell
136 <br><h2>Creation of a Shell</h2>
137
138 \code
139 import geompy
140 import salome
141 gg = salome.ImportComponentGUI("GEOM")
142
143 #create vertices
144 p0   = geompy.MakeVertex( 0.,  0.,  0.)
145 pxyz = geompy.MakeVertex( 5.,  5., 40.)
146
147 # create sketchers
148 sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
149 sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
150 isPlanarFace = 1
151
152 # create a face from two wires
153 face = geompy.MakeFaces([sketcher1, sketcher2],isPlanarFace)
154
155 # create a prism
156 prism = geompy.MakePrism(face, p0, pxyz)
157
158 # explode the prism into faces
159 prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
160
161 # create a shell from a set of faces
162 shell = geompy.MakeShell([prism_faces[0], prism_faces[2], prism_faces[3],
163                           prism_faces[7], prism_faces[9]])
164
165 # add objects in the study
166 id_shell = geompy.addToStudy(shell,"Shell")
167
168 # display the shell
169 gg.createAndDisplayGO(id_shell)
170 gg.setDisplayMode(id_shell,1) 
171 \endcode
172  
173 \anchor tui_creation_solid
174 <br><h2>Creation of a Solid</h2>
175
176 \code
177 import geompy
178 import salome
179 gg = salome.ImportComponentGUI("GEOM")
180
181 #create vertices
182 p0 = geompy.MakeVertex( 0.,  0.,  0.)
183 pz = geompy.MakeVertex( 0.,  0., 40.)
184
185 # create sketchers
186 sketcher = geompy.MakeSketcher("Sketcher:F -50 -50:TT 100 -50:R 0:C 50 70:R 0:L 100:WW")
187
188 # create faces from two wires
189 face = geompy.MakeFace(sketcher,1)
190
191 # create a prism
192 prism = geompy.MakePrism(face, p0, pz)
193
194 # explode the prism into faces
195 prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
196
197 # create a shell from a set of faces
198 shell = geompy.MakeShell([prism_faces[0], prism_faces[1],
199                           prism_faces[3], prism_faces[4],
200                           prism_faces[5], prism_faces[2]])
201
202 # create a solid, bounded by the given shells
203 solid = geompy.MakeSolid([shell])
204
205 # add objects in the study
206 id_solid = geompy.addToStudy(solid,"Solid")
207
208 # display the solid
209 gg.createAndDisplayGO(id_solid)
210 gg.setDisplayMode(id_solid,1) 
211 \endcode
212  
213 \anchor tui_creation_compound
214 <br><h2>Creation of a Compound</h2>
215
216 \code
217 import geompy
218 import salome
219 gg = salome.ImportComponentGUI("GEOM")
220
221 # create a vertex and a vector
222 p1 = geompy.MakeVertex(  -30.,  -30.,  50.)
223 p2 = geompy.MakeVertex(  -60.,  -60.,  30.)
224 p3 = geompy.MakeVertex(  -30.,  -30.,  10.)
225
226 # create an arc from three points
227 arc = geompy.MakeArc(p1, p2, p3)
228 ShapeListCompound = []
229 i = 0
230 while i <= 3 :
231     S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
232     ShapeListCompound.append(S)
233     i = i + 1
234
235 # create a compund of the given shapes
236 compound = geompy.MakeCompound(ShapeListCompound)
237
238 # add object in the study
239 id_compound = geompy.addToStudy(compound,"Compound")
240
241 # display the compound
242 gg.createAndDisplayGO(id_compound) 
243 \endcode
244
245 \anchor tui_creation_pipetshape
246 <br><h2>Creation of PipeTShape</h2>
247
248 \code
249 import geompy
250 import salome
251 gg = salome.ImportComponentGUI("GEOM")
252
253 # create PipeTShape object
254 pipetshape = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0)
255
256 # add object in the study
257 id_pipetshape = geompy.addToStudy(pipetshape[0],"PipeTShape")
258 # add groups in the study
259 for g in pipetshape[1:]:
260     geompy.addToStudyInFather(pipetshape[0], g, g.GetName())
261     
262 # Create junction vertices
263 P1 = geompy.MakeVertex(0.0, 0.0, 0.0)
264 P2 = geompy.MakeVertex(400.0, 0.0, 0.0)
265 P3 = geompy.MakeVertex(200.0, 0.0, 200.0)
266
267 # create PipeTShape object with position
268 pipetshape_position = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, True, P1, P2, P3)
269
270 # add object in the study
271 id_pipetshape_position = geompy.addToStudy(pipetshape_position[0],"PipeTShape_position")
272 # add groups in the study
273 for g in pipetshape_position[1:]:
274     geompy.addToStudyInFather(pipetshape_position[0], g, g.GetName())
275
276 # create PipeTShape with chamfer object
277 pipetshapechamfer = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0)
278
279 # add object in the study
280 id_pipetshapechamfer = geompy.addToStudy(pipetshapechamfer[0],"PipeTShapeChamfer")
281 # add groups in the study
282 for g in pipetshapechamfer[1:]:
283     geompy.addToStudyInFather(pipetshapechamfer[0], g, g.GetName())
284
285 # create PipeTShape with chamfer object with position
286 pipetshapechamfer_position = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0, True, P1, P2, P3)
287
288 # add object in the study
289 id_pipetshapechamfer_position = geompy.addToStudy(pipetshapechamfer_position[0],"PipeTShapeChamfer_position")
290 # add groups in the study
291 for g in pipetshapechamfer_position[1:]:
292     geompy.addToStudyInFather(pipetshapechamfer_position[0], g, g.GetName())
293
294 # create PipeTShape with fillet object
295 pipetshapefillet = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0)
296
297 # add object in the study
298 id_pipetshapefillet = geompy.addToStudy(pipetshapefillet[0],"PipeTShapeFillet")
299 # add groups in the study
300 for g in pipetshapefillet[1:]:
301     geompy.addToStudyInFather(pipetshapefillet[0], g, g.GetName())
302
303 # create PipeTShape with fillet object with position
304 pipetshapefillet_position = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0, True, P1, P2, P3)
305
306 # add object in the study
307 id_pipetshapefillet_position = geompy.addToStudy(pipetshapefillet_position[0],"PipeTShapeFillet_position")
308 # add groups in the study
309 for g in pipetshapefillet_position[1:]:
310     geompy.addToStudyInFather(pipetshapefillet_position[0], g, g.GetName())
311     
312
313 # display pipetshapes
314 gg.createAndDisplayGO(id_pipetshape)
315 gg.createAndDisplayGO(id_pipetshape_position)
316 gg.createAndDisplayGO(id_pipetshapechamfer)
317 gg.createAndDisplayGO(id_pipetshapechamfer_position)
318 gg.createAndDisplayGO(id_pipetshapefillet)
319 gg.createAndDisplayGO(id_pipetshapefillet_position)
320
321 \endcode
322
323 <!--@@ insert new functions before this line @@ do not remove this line @@-->
324 */