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 vertices on it
21 Arc = geompy.MakeArc(py, pz, px)
22 # create vertex by parameter
23 p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
24 #create vertex by point projection
25 p_on_arc2 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
27 # create a face and vertices on it
28 Add_line = geompy.MakeLineTwoPnt(px, py)
29 arc_face = geompy.MakeFaceWires([Arc, Add_line], 1)
30 p_on_face1 = geompy.MakeVertexOnSurface(arc_face, 0.5, 0.5)
31 p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face_1, 35, 35, 35)
34 # add objects in the study
35 id_p0 = geompy.addToStudy(p0, "Vertex 0")
36 id_p100 = geompy.addToStudy(p100, "Vertex 100")
37 id_px = geompy.addToStudy(px, "Vertex X")
38 id_py = geompy.addToStudy(py, "Vertex Y")
39 id_pz = geompy.addToStudy(pz, "Vertex Z")
40 id_Arc = geompy.addToStudy(Arc, "Arc")
41 id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc by parameter")
42 id_p_on_arc2 = geompy.addToStudy(p_on_arc, "Vertex on Arc by point projection")
43 id_p_on_face1 = geompy.addToStudy(p_on_face1, "Vertex on face by parameter")
44 id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on face by point projection")
47 gg.createAndDisplayGO(id_p0)
48 gg.createAndDisplayGO(id_p100)
49 gg.createAndDisplayGO(id_Arc)
50 gg.createAndDisplayGO(id_p_on_arc)
53 \anchor tui_creation_line
54 <br><h2>Creation of a Line</h2>
59 gg = salome.ImportComponentGUI("GEOM")
62 p0 = geompy.MakeVertex(0., 0., 0.)
63 p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.)
64 px = geompy.MakeVertex(100., 0. , 0. )
65 py = geompy.MakeVertex(0. , 100., 0. )
66 pz = geompy.MakeVertex(0. , 0. , 100.)
68 # create a vector from two points
69 vxy = geompy.MakeVector(px, py)
71 # create a line from a point and a vector
72 line1 = geompy.MakeLine(pz, vxy)
74 #create a line from two points
75 line2 = geompy.MakeLineTwoPnt(p0, p100)
77 # add objects in the study
78 id_vxy = geompy.addToStudy(vxy, "Vector")
79 id_line1 = geompy.addToStudy(line1,"Line1")
80 id_line2 = geompy.addToStudy(line2,"Line2")
83 gg.createAndDisplayGO(id_vxy)
84 gg.createAndDisplayGO(id_line1)
85 gg.createAndDisplayGO(id_line2)
88 \anchor tui_creation_circle
89 <br><h2>Creation of a Circle</h2>
94 gg = salome.ImportComponentGUI("GEOM")
97 p0 = geompy.MakeVertex(0., 0., 0.)
98 px = geompy.MakeVertex(100., 0. , 0. )
99 py = geompy.MakeVertex(0. , 100., 0. )
100 pz = geompy.MakeVertex(0. , 0. , 100.)
102 # create a vector on two points
103 vxy = geompy.MakeVector(px, py)
105 # create a circle from a point, a vector and a radius
106 circle1 = geompy.MakeCircle(pz, vxy, 30)
108 #create a circle from three points
109 circle2 = geompy.MakeCircleThreePnt(p0, px, py)
111 # add objects in the study
112 id_vxy = geompy.addToStudy(vxy, "Vector")
113 id_circle1 = geompy.addToStudy(circle1,"Circle1")
114 id_circle2 = geompy.addToStudy(circle2,"Circle2")
117 gg.createAndDisplayGO(id_vxy)
118 gg.createAndDisplayGO(id_circle1)
119 gg.createAndDisplayGO(id_circle2)
122 \anchor tui_creation_ellipse
123 <br><h2>Creation of an Ellipse</h2>
128 gg = salome.ImportComponentGUI("GEOM")
131 p0 = geompy.MakeVertex(0., 0., 0.)
132 p1 = geompy.MakeVertex(50., 50., 50.)
133 p2 = geompy.MakeVertex(0., 50., 0.)
135 # create a normal vector from two points
136 normal = geompy.MakeVector(p0, p1)
138 # create a major axis vector from two points
139 major = geompy.MakeVector(p0, p2)
141 # create an ellipse from a point, a vector and radiuses
142 ellipse1 = geompy.MakeEllipse(p1, normal, 50, 25)
144 # create an ellipse from a point, a normal vector, radiuses and a major axis vector
145 ellipse2 = geompy.MakeEllipse(p1, normal, 50, 25, major)
147 # add objects in the study
148 id_normal = geompy.addToStudy(normal, "Normal")
149 id_major = geompy.addToStudy(major, "Major Axis")
150 id_ellipse1 = geompy.addToStudy(ellipse1, "Ellipse 1")
151 id_ellipse2 = geompy.addToStudy(ellipse2, "Ellipse 2")
153 # display the ellipse and its normal vector
154 gg.createAndDisplayGO(id_normal)
155 gg.createAndDisplayGO(id_major)
156 gg.createAndDisplayGO(id_ellipse1)
157 gg.createAndDisplayGO(id_ellipse2)
160 \anchor tui_creation_arc
161 <br><h2>Creation of an Arc</h2>
166 gg = salome.ImportComponentGUI("GEOM")
169 p0 = geompy.MakeVertex(0., 0., 0.)
170 p1 = geompy.MakeVertex(100., 0., 0.)
171 p2 = geompy.MakeVertex(50., 0., 50.)
173 # create an arc from a three points
174 arc1 = geompy.MakeArc(p0, p1, p2)
176 # create an arc from a center point, a start point and end point
177 arc2 = geompy.MakeArcCenter(p0, p1, p2, 1)
179 # create an arc from a center point, a major point and minor point
180 arc3 = geompy.MakeArcOfEllipse(p0, p1, p2)
182 # add objects in the study
183 id_arc1 = geompy.addToStudy(arc1, "Arc 1")
184 id_arc2 = geompy.addToStudy(arc2, "Arc 2")
185 id_arc3 = geompy.addToStudy(arc3, "Arc 3")
188 gg.createAndDisplayGO(id_arc1)
189 gg.createAndDisplayGO(id_arc2)
190 gg.createAndDisplayGO(id_arc3)
193 \anchor tui_creation_curve
194 <br><h2>Creation of a Curve</h2>
199 gg = salome.ImportComponentGUI("GEOM")
202 p0 = geompy.MakeVertex(0. , 0. , 0. )
203 p1 = geompy.MakeVertex(50. , 100., 200.)
204 p2 = geompy.MakeVertex(150., 50., 100.)
205 p3 = geompy.MakeVertex(100., 150., 170.)
206 p4 = geompy.MakeVertex(200., 200., 150.)
208 # create a polyline from a list of points
209 polyline = geompy.MakePolyline([p0, p1, p2, p3, p4])
211 # create a bezier curve from a list of points
212 bezier = geompy.MakeBezier([p0, p1, p2, p3, p4])
214 #create a b-spline curve from a list of points
215 interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4], False)
217 # add objects in the study
218 id_p0 = geompy.addToStudy(p0, "Point1")
219 id_p1 = geompy.addToStudy(p1, "Point2")
220 id_p2 = geompy.addToStudy(p2, "Point3")
221 id_p3 = geompy.addToStudy(p3, "Point4")
222 id_p4 = geompy.addToStudy(p4, "Point5")
223 id_polyline = geompy.addToStudy(polyline, "Polyline")
224 id_bezier = geompy.addToStudy(bezier, "Bezier")
225 id_interpol = geompy.addToStudy(interpol, "Interpol")
227 # display the points and the curves
228 gg.createAndDisplayGO(id_p0)
229 gg.createAndDisplayGO(id_p1)
230 gg.createAndDisplayGO(id_p2)
231 gg.createAndDisplayGO(id_p3)
232 gg.createAndDisplayGO(id_p4)
233 gg.createAndDisplayGO(id_polyline)
234 gg.createAndDisplayGO(id_bezier)
235 gg.createAndDisplayGO(id_interpol)
238 \anchor tui_creation_vector
239 <br><h2>Creation of a Vector</h2>
244 gg = salome.ImportComponentGUI("GEOM")
247 p1 = geompy.MakeVertex(10., 50., 20.)
248 p2 = geompy.MakeVertex(70., 70., 70.)
250 # create a vector from two points
251 vector1 = geompy.MakeVector(p1, p2)
253 # create a vector from the given components
254 vector2 = geompy.MakeVectorDXDYDZ(30, 30, 100)
256 # add objects in the study
257 id_p1 = geompy.addToStudy(p1, "Point1")
258 id_p2 = geompy.addToStudy(p2, "Point2")
259 id_vector1 = geompy.addToStudy(vector1,"Vector1")
260 id_vector2 = geompy.addToStudy(vector2,"Vector2")
262 # display the points and the vectors
263 gg.createAndDisplayGO(id_p1)
264 gg.createAndDisplayGO(id_p2)
265 gg.createAndDisplayGO(id_vector1)
266 gg.createAndDisplayGO(id_vector2)
269 \anchor tui_creation_plane
270 <br><h2>Creation of a Plane</h2>
275 gg = salome.ImportComponentGUI("GEOM")
278 p1 = geompy.MakeVertex( 0., 0., 100.)
279 p2 = geompy.MakeVertex(100., 0., 0.)
280 p3 = geompy.MakeVertex(200., 200., 200.)
281 p4 = geompy.MakeVertex(100., 100., 0.)
282 p5 = geompy.MakeVertex(0. , 100., 0.)
284 # create a vectors from the given components
285 vector1 = geompy.MakeVectorDXDYDZ(100., 100., 100.)
286 vector2 = geompy.MakeVectorDXDYDZ(-100., 0., 100.)
288 # create a vector from two points
289 vector_arc = geompy.MakeVector(p2, p5)
291 # create an arc from three points
292 arc = geompy.MakeArc(p2, p4, p5)
295 wire = geompy.MakeWire([vector_arc, arc])
299 face = geompy.MakeFace(wire, isPlanarWanted)
302 # create a Local Coordinate System
304 LCS = geompy.MakeMarker(100., 100., 101., 1, 0, 0, 0, 1, 0)
306 # create a plane from a point, a vector and a trimsize
307 plane1 = geompy.MakePlane(p1, vector1, trimsize)
309 # create a plane from three points and a trimsize
310 plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize)
312 # create a plane from the given face
313 plane3 = geompy.MakePlaneFace(face, trimsize)
315 # create a plane from two vectors and a trimsize
316 plane4 = geompy.MakePlane2Vec(vector1, vector2, trimsize)
318 # create a plane with the Local Coordinate System and a trimsize
319 plane5 = geompy.MakePlaneLCS(LCS, trimsize, 1)
321 # add objects in the study
322 id_face = geompy.addToStudy(face, "Face")
323 id_plane1 = geompy.addToStudy(plane1,"Plane1")
324 id_plane2 = geompy.addToStudy(plane2,"Plane2")
325 id_plane3 = geompy.addToStudy(plane3,"Plane3")
326 id_plane4 = geompy.addToStudy(plane4,"Plane4")
327 id_plane5 = geompy.addToStudy(plane5,"Plane5")
329 # display the points and the vectors
330 gg.createAndDisplayGO(id_face)
331 gg.createAndDisplayGO(id_plane1)
332 gg.createAndDisplayGO(id_plane2)
333 gg.createAndDisplayGO(id_plane3)
334 gg.createAndDisplayGO(id_plane4)
335 gg.createAndDisplayGO(id_plane5)
336 gg.setDisplayMode(id_plane1,1)
337 gg.setTransparency(id_plane1,0.5)
338 gg.setDisplayMode(id_plane2,1)
339 gg.setTransparency(id_plane2,0.5)
340 gg.setDisplayMode(id_plane3,1)
341 gg.setTransparency(id_plane3,0.5)
342 gg.setDisplayMode(id_plane4,1)
343 gg.setTransparency(id_plane4,0.5)
344 gg.setDisplayMode(id_plane5,1)
345 gg.setTransparency(id_plane5,0.5)
348 \anchor tui_creation_lcs
349 <br><h2>Creation of a Local Coordinate System</h2>
356 #Create vertexes, vectors and shapes to construct local CS
357 Vertex_1 = geompy.MakeVertex(50, 50, 50)
358 Vertex_2 = geompy.MakeVertex(70, 70, 70)
359 Vertex_3 = geompy.MakeVertex(0, 0, 0)
360 Vector_X = geompy.MakeVectorDXDYDZ(50, 0, 0)
361 Vector_Y = geompy.MakeVectorDXDYDZ(0, 50, 0)
362 Face_1 = geompy.MakeFaceHW(100, 100, 1)
363 Box_1 = geompy.MakeBoxTwoPnt(Vertex_1, Vertex_2)
365 #Construct local CS by manual definition
366 LocalCS_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
368 #Construct local CS by center point and two vectors (X and Y directions)
369 LocalCS_2 = geompy.MakeMarkerPntTwoVec(Vertex_3, Vector_X, Vector_Y)
371 #Construct local CS from shape orientation
372 LocalCS_FACE = geompy.MakeMarkerFromShape(Face_1)
373 LocalCS_BOX = geompy.MakeMarkerFromShape(Box_1)
375 #Add created object to study
376 geompy.addToStudy( Face_1, "Face_1" )
377 geompy.addToStudy( Vertex_1, "Vertex_1" )
378 geompy.addToStudy( Vertex_2, "Vertex_2" )
379 geompy.addToStudy( Box_1, "Box_1" )
380 geompy.addToStudy( Vertex_3, "Vertex_3" )
381 geompy.addToStudy( Vector_X, "Vector_X" )
382 geompy.addToStudy( Vector_Y, "Vector_Y" )
383 geompy.addToStudy( LocalCS_1, "LocalCS_1" )
384 geompy.addToStudy( LocalCS_2, "LocalCS_3" )
385 geompy.addToStudy( LocalCS_FACE, "LocalCS_FACE" )
386 geompy.addToStudy( LocalCS_BOX, "LocalCS_BOX" )