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