Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/geom.git] / doc / salome / gui / GEOM / input / tui_complex_objs.doc
1 /*!
2
3 \page tui_complex_objs_page Complex Objects
4
5 \anchor tui_creation_prism
6 <br><h2>Creation of a Prism</h2>
7
8 \code
9 import geompy
10 import salome
11 gg = salome.ImportComponentGUI("GEOM")
12
13 # create a vertex and a vector
14 p1 = geompy.MakeVertex(   0.,   0.,   0.)
15 p2 = geompy.MakeVertex( 100.,   0.,   0.)
16 p3 = geompy.MakeVertex( 100., 100.,   0.)
17 p4 = geompy.MakeVertex(   0., 100.,   0.)
18 p5 = geompy.MakeVertex(   0.,   0.,  60.)
19 p6 = geompy.MakeVertex(-100.,   0.,   0.)
20 p7 = geompy.MakeVertex(-100.,-100.,   0.)
21 p8 = geompy.MakeVertex(   0.,-100.,   0.)
22
23 # create a vector from the given components
24 vector = geompy.MakeVectorDXDYDZ(50., 50., 50.)
25
26 #create vectors from two points
27 vector1_arc1 = geompy.MakeVector(p1, p2)
28 vector2_arc1 = geompy.MakeVector(p1, p4)
29 vector1_arc2 = geompy.MakeVector(p1, p6)
30 vector2_arc2 = geompy.MakeVector(p1, p8)
31
32 # create arcs from three points
33 arc1 = geompy.MakeArc(p2, p3, p4)
34 arc2 = geompy.MakeArc(p6, p7, p8)
35
36 # create wires
37 wire1 = geompy.MakeWire([vector1_arc1, arc1, vector2_arc1])
38 wire2 = geompy.MakeWire([vector1_arc2, arc2, vector2_arc2])
39
40 # create faces
41 isPlanarWanted = 1
42 face1 = geompy.MakeFace(wire1, isPlanarWanted)
43 face2 = geompy.MakeFace(wire2, isPlanarWanted)
44
45 # create prisms
46 prism1 = geompy.MakePrism(face2, p1, p5)
47 prism2 = geompy.MakePrismVecH(face1, vector, 50)
48
49 # add objects in the study
50 id_face1   = geompy.addToStudy(face1,"Face1")
51 id_face2   = geompy.addToStudy(face2,"Face2")
52 id_prism1 = geompy.addToStudy(prism1,"Prism1")
53 id_prism2 = geompy.addToStudy(prism2,"Prism2")
54
55 # display cylinders
56 gg.createAndDisplayGO(id_face1)
57 gg.setDisplayMode(id_face1,1)
58 gg.createAndDisplayGO(id_face2)
59 gg.setDisplayMode(id_face2,1)
60 gg.createAndDisplayGO(id_prism1)
61 gg.setDisplayMode(id_prism1,1)
62 gg.createAndDisplayGO(id_prism2)
63 gg.setDisplayMode(id_prism2,1) 
64 \endcode
65
66 \anchor tui_creation_revolution
67 <br><h2>Creation of a Revolution</h2>
68
69 \code
70 import geompy
71 import salome
72 gg = salome.ImportComponentGUI("GEOM")
73
74 # create a vertex and a vector
75 p1 = geompy.MakeVertex(  10.,  10.,  10.)
76 p2 = geompy.MakeVertex(  15.,  15.,  50.)
77 p3 = geompy.MakeVertex(  40.,  40.,   0.)
78
79 #create vectors from two points
80 vector1 = geompy.MakeVector(p1, p2)
81 vector2 = geompy.MakeVector(p1, p3)
82
83 # create a vector from the given components
84 vector3 = geompy.MakeVectorDXDYDZ(-20., -20., 100.)
85
86 # create a wire
87 wire = geompy.MakeWire([vector1, vector2])
88
89 # create a revolution
90 revolution = geompy.MakeRevolution(wire, vector3, 2.3)
91
92 # add objects in the study
93 id_vector3    = geompy.addToStudy(vector3,"Axis")
94 id_wire       = geompy.addToStudy(wire,"Wire")
95 id_revolution = geompy.addToStudy(revolution,"Revolution")
96
97 # display the vector, the wire and the revolution
98 gg.createAndDisplayGO(id_vector3)
99 gg.createAndDisplayGO(id_wire)
100 gg.createAndDisplayGO(id_revolution)
101 gg.setDisplayMode(id_revolution,1) 
102 \endcode
103
104 \anchor tui_creation_filling
105 <br><h2>Creation of a Filling</h2>
106
107 \code
108 import geompy
109 import salome
110 gg = salome.ImportComponentGUI("GEOM")
111
112 mindeg = 2
113 maxdeg = 5
114 tol3d  = 0.0001
115 tol2d  = 0.0001
116 nbiter = 5
117
118 # create a vertex and a vector
119 p1 = geompy.MakeVertex(  -30.,  -30.,  50.)
120 p2 = geompy.MakeVertex(  -60.,  -60.,  30.)
121 p3 = geompy.MakeVertex(  -30.,  -30.,  10.)
122
123 # create an arc from three points
124 arc = geompy.MakeArc(p1, p2, p3)
125 ShapeListCompound = []
126 i = 0
127 while i <= 3 :
128     S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
129     ShapeListCompound.append(S)
130     i = i + 1
131
132 compound = geompy.MakeCompound(ShapeListCompound)
133
134 # create a filling
135 filling = geompy.MakeFilling(compound, mindeg, maxdeg, tol3d, tol2d, nbiter)
136
137 # add objects in the study
138 id_compound = geompy.addToStudy(compound,"Compound")
139 id_filling = geompy.addToStudy(filling,"Filling")
140
141 # display the compound and the filling
142 gg.createAndDisplayGO(id_compound)
143 gg.createAndDisplayGO(id_filling)
144 gg.setDisplayMode(id_filling,1) 
145 \endcode
146  
147 \anchor tui_creation_pipe
148 <br><h2>Creation of a Pipe</h2>
149
150 \code
151 import geompy
152 import salome
153 gg = salome.ImportComponentGUI("GEOM")
154
155 # create vertices
156 p0   = geompy.MakeVertex(0.  , 0.  , 0.  )
157 px   = geompy.MakeVertex(100., 0.  , 0.  )
158 py   = geompy.MakeVertex(0.  , 100., 0.  )
159 pz   = geompy.MakeVertex(0.  , 0.  , 100.)
160 pxyz = geompy.MakeVertex(100., 100., 100.)
161
162 # create a vector from two points
163 vxy = geompy.MakeVector(px, py)
164
165 # create an arc from three points
166 arc = geompy.MakeArc(py, pz, px)
167
168 # create a wire
169 wire = geompy.MakeWire([vxy, arc])
170
171 # create an edge
172 edge = geompy.MakeEdge(p0, pxyz)
173
174 # create a pipe
175 pipe = geompy.MakePipe(wire, edge)
176
177 # add objects in the study
178 id_wire = geompy.addToStudy(wire,"Wire")
179 id_edge = geompy.addToStudy(edge,"Edge")
180 id_pipe = geompy.addToStudy(pipe,"Pipe")
181
182 # display the wire, the edge (path) and the pipe
183 gg.createAndDisplayGO(id_wire)
184 gg.createAndDisplayGO(id_edge)
185 gg.createAndDisplayGO(id_pipe)
186 gg.setDisplayMode(id_pipe,1) 
187 \endcode
188
189 */