3 \page tui_basic_geom_objs_page Basic Geometrical Objects
5 \anchor tui_creation_point
6 <br><h2>Creation of a Point</h2>
11 gg = salome.ImportComponentGUI("GEOM")
14 p0 = geompy.MakeVertex(0., 0., 0.)
15 p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.)
16 px = geompy.MakeVertex(100., 0., 0.)
17 py = geompy.MakeVertex(0., 100., 0.)
18 pz = geompy.MakeVertex(0., 0., 100.)
20 # create a curve and a vertex on it
21 Arc = geompy.MakeArc(py, pz, px)
22 p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
24 # add objects in the study
25 id_p0 = geompy.addToStudy(p0, "Vertex 0")
26 id_p100 = geompy.addToStudy(p100, "Vertex 100")
27 id_px = geompy.addToStudy(px, "Vertex X")
28 id_py = geompy.addToStudy(py, "Vertex Y")
29 id_pz = geompy.addToStudy(pz, "Vertex Z")
30 id_Arc = geompy.addToStudy(Arc, "Arc")
31 id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc")
34 gg.createAndDisplayGO(id_p0)
35 gg.createAndDisplayGO(id_p100)
36 gg.createAndDisplayGO(id_Arc)
37 gg.createAndDisplayGO(id_p_on_arc)
40 \anchor tui_creation_line
41 <br><h2>Creation of a Line</h2>
46 gg = salome.ImportComponentGUI("GEOM")
49 p0 = geompy.MakeVertex(0., 0., 0.)
50 p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.)
51 px = geompy.MakeVertex(100., 0. , 0. )
52 py = geompy.MakeVertex(0. , 100., 0. )
53 pz = geompy.MakeVertex(0. , 0. , 100.)
55 # create a vector from two points
56 vxy = geompy.MakeVector(px, py)
58 # create a line from a point and a vector
59 line1 = geompy.MakeLine(pz, vxy)
61 #create a line from two points
62 line2 = geompy.MakeLineTwoPnt(p0, p100)
64 # add objects in the study
65 id_vxy = geompy.addToStudy(vxy, "Vector")
66 id_line1 = geompy.addToStudy(line1,"Line1")
67 id_line2 = geompy.addToStudy(line2,"Line2")
70 gg.createAndDisplayGO(id_vxy)
71 gg.createAndDisplayGO(id_line1)
72 gg.createAndDisplayGO(id_line2)
75 \anchor tui_creation_circle
76 <br><h2>Creation of a Circle</h2>
81 gg = salome.ImportComponentGUI("GEOM")
84 p0 = geompy.MakeVertex(0., 0., 0.)
85 px = geompy.MakeVertex(100., 0. , 0. )
86 py = geompy.MakeVertex(0. , 100., 0. )
87 pz = geompy.MakeVertex(0. , 0. , 100.)
89 # create a vector on two points
90 vxy = geompy.MakeVector(px, py)
92 # create a circle from a point, a vector and a radius
93 circle1 = geompy.MakeCircle(pz, vxy, 30)
95 #create a circle from three points
96 circle2 = geompy.MakeCircleThreePnt(p0, px, py)
98 # add objects in the study
99 id_vxy = geompy.addToStudy(vxy, "Vector")
100 id_circle1 = geompy.addToStudy(circle1,"Circle1")
101 id_circle2 = geompy.addToStudy(circle2,"Circle2")
104 gg.createAndDisplayGO(id_vxy)
105 gg.createAndDisplayGO(id_circle1)
106 gg.createAndDisplayGO(id_circle2)
109 \anchor tui_creation_ellipse
110 <br><h2>Creation of an Ellipse</h2>
115 gg = salome.ImportComponentGUI("GEOM")
118 p0 = geompy.MakeVertex(0., 0., 0.)
119 p1 = geompy.MakeVertex(50., 50., 50.)
120 p2 = geompy.MakeVertex(0., 50., 0.)
122 # create a normal vector from two points
123 normal = geompy.MakeVector(p0, p1)
125 # create a major axis vector from two points
126 major = geompy.MakeVector(p0, p2)
128 # create an ellipse from a point, a vector and radiuses
129 ellipse1 = geompy.MakeEllipse(p1, normal, 50, 25)
131 # create an ellipse from a point, a normal vector, radiuses and a major axis vector
132 ellipse2 = geompy.MakeEllipse(p1, normal, 50, 25, major)
134 # add objects in the study
135 id_normal = geompy.addToStudy(normal, "Normal")
136 id_major = geompy.addToStudy(major, "Major Axis")
137 id_ellipse1 = geompy.addToStudy(ellipse1, "Ellipse 1")
138 id_ellipse2 = geompy.addToStudy(ellipse2, "Ellipse 2")
140 # display the ellipse and its normal vector
141 gg.createAndDisplayGO(id_normal)
142 gg.createAndDisplayGO(id_major)
143 gg.createAndDisplayGO(id_ellipse1)
144 gg.createAndDisplayGO(id_ellipse2)
147 \anchor tui_creation_arc
148 <br><h2>Creation of an Arc</h2>
153 gg = salome.ImportComponentGUI("GEOM")
156 p0 = geompy.MakeVertex(0., 0., 0.)
157 p1 = geompy.MakeVertex(100., 0., 0.)
158 p2 = geompy.MakeVertex(50., 0., 50.)
160 # create an arc from a three points
161 arc1 = geompy.MakeArc(p0, p1, p2)
163 # create an arc from a center point, a start point and end point
164 arc2 = geompy.MakeArcCenter(p0, p1, p2, 1)
166 # create an arc from a center point, a major point and minor point
167 arc3 = geompy.MakeArcOfEllipse(p0, p1, p2)
169 # add objects in the study
170 id_arc1 = geompy.addToStudy(arc1, "Arc 1")
171 id_arc2 = geompy.addToStudy(arc2, "Arc 2")
172 id_arc3 = geompy.addToStudy(arc3, "Arc 3")
175 gg.createAndDisplayGO(id_arc1)
176 gg.createAndDisplayGO(id_arc2)
177 gg.createAndDisplayGO(id_arc3)
180 \anchor tui_creation_curve
181 <br><h2>Creation of a Curve</h2>
186 gg = salome.ImportComponentGUI("GEOM")
189 p0 = geompy.MakeVertex(0. , 0. , 0. )
190 p1 = geompy.MakeVertex(50. , 100., 200.)
191 p2 = geompy.MakeVertex(150., 50., 100.)
192 p3 = geompy.MakeVertex(100., 150., 170.)
193 p4 = geompy.MakeVertex(200., 200., 150.)
195 # create a polyline from a list of points
196 polyline = geompy.MakePolyline([p0, p1, p2, p3, p4])
198 # create a bezier curve from a list of points
199 bezier = geompy.MakeBezier([p0, p1, p2, p3, p4])
201 #create a b-spline curve from a list of points
202 interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4])
204 # add objects in the study
205 id_p0 = geompy.addToStudy(p0, "Point1")
206 id_p1 = geompy.addToStudy(p1, "Point2")
207 id_p2 = geompy.addToStudy(p2, "Point3")
208 id_p3 = geompy.addToStudy(p3, "Point4")
209 id_p4 = geompy.addToStudy(p4, "Point5")
210 id_polyline = geompy.addToStudy(polyline, "Polyline")
211 id_bezier = geompy.addToStudy(bezier, "Bezier")
212 id_interpol = geompy.addToStudy(interpol, "Interpol")
214 # display the points and the curves
215 gg.createAndDisplayGO(id_p0)
216 gg.createAndDisplayGO(id_p1)
217 gg.createAndDisplayGO(id_p2)
218 gg.createAndDisplayGO(id_p3)
219 gg.createAndDisplayGO(id_p4)
220 gg.createAndDisplayGO(id_polyline)
221 gg.createAndDisplayGO(id_bezier)
222 gg.createAndDisplayGO(id_interpol)
225 \anchor tui_creation_vector
226 <br><h2>Creation of a Vector</h2>
231 gg = salome.ImportComponentGUI("GEOM")
234 p1 = geompy.MakeVertex(10., 50., 20.)
235 p2 = geompy.MakeVertex(70., 70., 70.)
237 # create a vector from two points
238 vector1 = geompy.MakeVector(p1, p2)
240 # create a vector from the given components
241 vector2 = geompy.MakeVectorDXDYDZ(30, 30, 100)
243 # add objects in the study
244 id_p1 = geompy.addToStudy(p1, "Point1")
245 id_p2 = geompy.addToStudy(p2, "Point2")
246 id_vector1 = geompy.addToStudy(vector1,"Vector1")
247 id_vector2 = geompy.addToStudy(vector2,"Vector2")
249 # display the points and the vectors
250 gg.createAndDisplayGO(id_p1)
251 gg.createAndDisplayGO(id_p2)
252 gg.createAndDisplayGO(id_vector1)
253 gg.createAndDisplayGO(id_vector2)
256 \anchor tui_creation_plane
257 <br><h2>Creation of a Plane</h2>
262 gg = salome.ImportComponentGUI("GEOM")
265 p1 = geompy.MakeVertex( 0., 0., 100.)
266 p2 = geompy.MakeVertex(100., 0., 0.)
267 p3 = geompy.MakeVertex(200., 200., 200.)
268 p4 = geompy.MakeVertex(100., 100., 0.)
269 p5 = geompy.MakeVertex(0. , 100., 0.)
271 # create a vectors from the given components
272 vector1 = geompy.MakeVectorDXDYDZ(100., 100., 100.)
273 vector2 = geompy.MakeVectorDXDYDZ(-100., 0., 100.)
275 # create a vector from two points
276 vector_arc = geompy.MakeVector(p2, p5)
278 # create an arc from three points
279 arc = geompy.MakeArc(p2, p4, p5)
282 wire = geompy.MakeWire([vector_arc, arc])
286 face = geompy.MakeFace(wire, isPlanarWanted)
289 # create a Local Coordinate System
291 LCS = geompy.MakeMarker(100., 100., 101., 1, 0, 0, 0, 1, 0)
293 # create a plane from a point, a vector and a trimsize
294 plane1 = geompy.MakePlane(p1, vector1, trimsize)
296 # create a plane from three points and a trimsize
297 plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize)
299 # create a plane from the given face
300 plane3 = geompy.MakePlaneFace(face, trimsize)
302 # create a plane from two vectors and a trimsize
303 plane4 = geompy.MakePlane2Vec(vector1, vector2, trimsize)
305 # create a plane with the Local Coordinate System and a trimsize
306 plane5 = geompy.MakePlaneLCS(LCS, trimsize, 1)
308 # add objects in the study
309 id_face = geompy.addToStudy(face, "Face")
310 id_plane1 = geompy.addToStudy(plane1,"Plane1")
311 id_plane2 = geompy.addToStudy(plane2,"Plane2")
312 id_plane3 = geompy.addToStudy(plane3,"Plane3")
313 id_plane4 = geompy.addToStudy(plane4,"Plane4")
314 id_plane5 = geompy.addToStudy(plane5,"Plane5")
316 # display the points and the vectors
317 gg.createAndDisplayGO(id_face)
318 gg.createAndDisplayGO(id_plane1)
319 gg.createAndDisplayGO(id_plane2)
320 gg.createAndDisplayGO(id_plane3)
321 gg.createAndDisplayGO(id_plane4)
322 gg.createAndDisplayGO(id_plane5)
323 gg.setDisplayMode(id_plane1,1)
324 gg.setTransparency(id_plane1,0.5)
325 gg.setDisplayMode(id_plane2,1)
326 gg.setTransparency(id_plane2,0.5)
327 gg.setDisplayMode(id_plane3,1)
328 gg.setTransparency(id_plane3,0.5)
329 gg.setDisplayMode(id_plane4,1)
330 gg.setTransparency(id_plane4,0.5)
331 gg.setDisplayMode(id_plane5,1)
332 gg.setTransparency(id_plane5,0.5)