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.)
19 p1 = geompy.MakeVertex(50., 50., 30.)
21 # create a curve and vertices on it
22 Arc = geompy.MakeArc(py, pz, px)
23 # create a vertex by parameter
24 p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
25 # create a vertex by length
26 p_on_arc2 = geompy.MakeVertexOnCurveByLength(Arc, 50., None)
27 #create a vertex by point projection
28 p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
30 # create 2 lines and make a point on its intersection
31 line_1 = geompy.MakeLineTwoPnt(p0, p100)
32 line_2 = geompy.MakeLineTwoPnt(p1, pz)
33 p_inter = geompy.MakeVertexOnLinesIntersection(line_1, line_2)
35 # create a face and vertices on it
36 Add_line = geompy.MakeLineTwoPnt(px, py)
37 arc_face = geompy.MakeFaceWires([Arc, Add_line], 1)
38 p_on_face1 = geompy.MakeVertexOnSurface(arc_face, 0.5, 0.5)
39 p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(arc_face, 35, 35, 35)
42 # add objects in the study
43 id_p0 = geompy.addToStudy(p0, "Vertex 0")
44 id_p100 = geompy.addToStudy(p100, "Vertex 100")
45 id_px = geompy.addToStudy(px, "Vertex X")
46 id_py = geompy.addToStudy(py, "Vertex Y")
47 id_pz = geompy.addToStudy(pz, "Vertex Z")
48 id_Arc = geompy.addToStudy(Arc, "Arc")
49 id_line_1 = geompy.addToStudy(line_1, "Line 1")
50 id_line_2 = geompy.addToStudy(line_2, "Line 2")
51 id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc by parameter")
52 id_p_on_arc2 = geompy.addToStudy(p_on_arc2, "Vertex on Arc by length")
53 id_p_on_arc3 = geompy.addToStudy(p_on_arc3, "Vertex on Arc by point projection")
54 id_p_inter = geompy.addToStudy(p_inter, "Vertex on Lines Intersection")
55 id_p_on_face1 = geompy.addToStudy(p_on_face1, "Vertex on face by parameter")
56 id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on face by point projection")
59 gg.createAndDisplayGO(id_p0)
60 gg.createAndDisplayGO(id_p100)
61 gg.createAndDisplayGO(id_Arc)
62 gg.createAndDisplayGO(id_p_inter)
63 gg.createAndDisplayGO(id_p_on_arc)
64 gg.createAndDisplayGO(id_p_on_arc2)
65 gg.createAndDisplayGO(id_p_on_arc3)
68 \anchor tui_creation_line
69 <br><h2>Creation of a Line</h2>
74 gg = salome.ImportComponentGUI("GEOM")
77 p0 = geompy.MakeVertex(0., 0., 0.)
78 p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.)
79 px = geompy.MakeVertex(100., 0. , 0. )
80 py = geompy.MakeVertex(0. , 100., 0. )
81 pz = geompy.MakeVertex(0. , 0. , 100.)
83 # create a vector from two points
84 vxy = geompy.MakeVector(px, py)
86 # create a line from a point and a vector
87 line1 = geompy.MakeLine(pz, vxy)
89 #create a line from two points
90 line2 = geompy.MakeLineTwoPnt(p0, p100)
92 # add objects in the study
93 id_vxy = geompy.addToStudy(vxy, "Vector")
94 id_line1 = geompy.addToStudy(line1,"Line1")
95 id_line2 = geompy.addToStudy(line2,"Line2")
98 gg.createAndDisplayGO(id_vxy)
99 gg.createAndDisplayGO(id_line1)
100 gg.createAndDisplayGO(id_line2)
103 \anchor tui_creation_circle
104 <br><h2>Creation of a Circle</h2>
109 gg = salome.ImportComponentGUI("GEOM")
112 p0 = geompy.MakeVertex(0., 0., 0.)
113 px = geompy.MakeVertex(100., 0. , 0. )
114 py = geompy.MakeVertex(0. , 100., 0. )
115 pz = geompy.MakeVertex(0. , 0. , 100.)
117 # create a vector on two points
118 vxy = geompy.MakeVector(px, py)
120 # create a circle from a point, a vector and a radius
121 circle1 = geompy.MakeCircle(pz, vxy, 30)
123 #create a circle from three points
124 circle2 = geompy.MakeCircleThreePnt(p0, px, py)
126 # add objects in the study
127 id_vxy = geompy.addToStudy(vxy, "Vector")
128 id_circle1 = geompy.addToStudy(circle1,"Circle1")
129 id_circle2 = geompy.addToStudy(circle2,"Circle2")
132 gg.createAndDisplayGO(id_vxy)
133 gg.createAndDisplayGO(id_circle1)
134 gg.createAndDisplayGO(id_circle2)
137 \anchor tui_creation_ellipse
138 <br><h2>Creation of an Ellipse</h2>
143 gg = salome.ImportComponentGUI("GEOM")
146 p0 = geompy.MakeVertex(0., 0., 0.)
147 p1 = geompy.MakeVertex(50., 50., 50.)
148 p2 = geompy.MakeVertex(0., 50., 0.)
150 # create a normal vector from two points
151 normal = geompy.MakeVector(p0, p1)
153 # create a major axis vector from two points
154 major = geompy.MakeVector(p0, p2)
156 # create an ellipse from a point, a vector and radiuses
157 ellipse1 = geompy.MakeEllipse(p1, normal, 50, 25)
159 # create an ellipse from a point, a normal vector, radiuses and a major axis vector
160 ellipse2 = geompy.MakeEllipse(p1, normal, 50, 25, major)
162 # add objects in the study
163 id_normal = geompy.addToStudy(normal, "Normal")
164 id_major = geompy.addToStudy(major, "Major Axis")
165 id_ellipse1 = geompy.addToStudy(ellipse1, "Ellipse 1")
166 id_ellipse2 = geompy.addToStudy(ellipse2, "Ellipse 2")
168 # display the ellipse and its normal vector
169 gg.createAndDisplayGO(id_normal)
170 gg.createAndDisplayGO(id_major)
171 gg.createAndDisplayGO(id_ellipse1)
172 gg.createAndDisplayGO(id_ellipse2)
175 \anchor tui_creation_arc
176 <br><h2>Creation of an Arc</h2>
181 gg = salome.ImportComponentGUI("GEOM")
184 p0 = geompy.MakeVertex(0., 0., 0.)
185 p1 = geompy.MakeVertex(100., 0., 0.)
186 p2 = geompy.MakeVertex(50., 0., 50.)
188 # create an arc from a three points
189 arc1 = geompy.MakeArc(p0, p1, p2)
191 # create an arc from a center point, a start point and end point
192 arc2 = geompy.MakeArcCenter(p0, p1, p2, 1)
194 # create an arc from a center point, a major point and minor point
195 arc3 = geompy.MakeArcOfEllipse(p0, p1, p2)
197 # add objects in the study
198 id_arc1 = geompy.addToStudy(arc1, "Arc 1")
199 id_arc2 = geompy.addToStudy(arc2, "Arc 2")
200 id_arc3 = geompy.addToStudy(arc3, "Arc 3")
203 gg.createAndDisplayGO(id_arc1)
204 gg.createAndDisplayGO(id_arc2)
205 gg.createAndDisplayGO(id_arc3)
208 \anchor tui_creation_curve
209 <br><h2>Creation of a Curve</h2>
214 gg = salome.ImportComponentGUI("GEOM")
217 p0 = geompy.MakeVertex(0. , 0. , 0. )
218 p1 = geompy.MakeVertex(50. , 100., 200.)
219 p2 = geompy.MakeVertex(150., 50., 100.)
220 p3 = geompy.MakeVertex(100., 150., 170.)
221 p4 = geompy.MakeVertex(200., 200., 150.)
223 # create a polyline from a list of points
224 polyline = geompy.MakePolyline([p0, p1, p2, p3, p4])
226 # create a bezier curve from a list of points
227 bezier = geompy.MakeBezier([p0, p1, p2, p3, p4])
229 #create a b-spline curve from a list of points
230 interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4], False)
232 #create a polyline using parametric definition of the basic points
233 param_polyline = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 5., geompy.GEOM.Polyline)
235 # create a bezier curve using parametric definition of the basic points
236 param_bezier = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 5., geompy.GEOM.Bezier)
238 #create a b-spline curve using parametric definition of the basic points
239 param_interpol = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 5., geompy.GEOM.Interpolation)
243 # add objects in the study
244 id_p0 = geompy.addToStudy(p0, "Point1")
245 id_p1 = geompy.addToStudy(p1, "Point2")
246 id_p2 = geompy.addToStudy(p2, "Point3")
247 id_p3 = geompy.addToStudy(p3, "Point4")
248 id_p4 = geompy.addToStudy(p4, "Point5")
249 id_polyline = geompy.addToStudy(polyline, "Polyline")
250 id_bezier = geompy.addToStudy(bezier, "Bezier")
251 id_interpol = geompy.addToStudy(interpol, "Interpol")
252 id_param_polyline = geompy.addToStudy(param_polyline, "Polyline Parametric")
253 id_param_bezier = geompy.addToStudy(param_bezier, "Bezier Parametric")
254 id_param_interpol = geompy.addToStudy(param_interpol, "Interpol Parametric")
258 # display the points and the curves
259 gg.createAndDisplayGO(id_p0)
260 gg.createAndDisplayGO(id_p1)
261 gg.createAndDisplayGO(id_p2)
262 gg.createAndDisplayGO(id_p3)
263 gg.createAndDisplayGO(id_p4)
264 gg.createAndDisplayGO(id_polyline)
265 gg.createAndDisplayGO(id_bezier)
266 gg.createAndDisplayGO(id_interpol)
267 gg.createAndDisplayGO(id_param_polyline)
268 gg.createAndDisplayGO(id_param_bezier)
269 gg.createAndDisplayGO(id_param_interpol)
273 \anchor tui_creation_vector
274 <br><h2>Creation of a Vector</h2>
279 gg = salome.ImportComponentGUI("GEOM")
282 p1 = geompy.MakeVertex(10., 50., 20.)
283 p2 = geompy.MakeVertex(70., 70., 70.)
285 # create a vector from two points
286 vector1 = geompy.MakeVector(p1, p2)
288 # create a vector from the given components
289 vector2 = geompy.MakeVectorDXDYDZ(30, 30, 100)
291 # add objects in the study
292 id_p1 = geompy.addToStudy(p1, "Point1")
293 id_p2 = geompy.addToStudy(p2, "Point2")
294 id_vector1 = geompy.addToStudy(vector1,"Vector1")
295 id_vector2 = geompy.addToStudy(vector2,"Vector2")
297 # display the points and the vectors
298 gg.createAndDisplayGO(id_p1)
299 gg.createAndDisplayGO(id_p2)
300 gg.createAndDisplayGO(id_vector1)
301 gg.createAndDisplayGO(id_vector2)
304 \anchor tui_creation_plane
305 <br><h2>Creation of a Plane</h2>
310 gg = salome.ImportComponentGUI("GEOM")
313 p1 = geompy.MakeVertex( 0., 0., 100.)
314 p2 = geompy.MakeVertex(100., 0., 0.)
315 p3 = geompy.MakeVertex(200., 200., 200.)
316 p4 = geompy.MakeVertex(100., 100., 0.)
317 p5 = geompy.MakeVertex(0. , 100., 0.)
319 # create a vectors from the given components
320 vector1 = geompy.MakeVectorDXDYDZ(100., 100., 100.)
321 vector2 = geompy.MakeVectorDXDYDZ(-100., 0., 100.)
323 # create a vector from two points
324 vector_arc = geompy.MakeVector(p2, p5)
326 # create an arc from three points
327 arc = geompy.MakeArc(p2, p4, p5)
330 wire = geompy.MakeWire([vector_arc, arc])
334 face = geompy.MakeFace(wire, isPlanarWanted)
337 # create a Local Coordinate System
339 LCS = geompy.MakeMarker(100., 100., 101., 1, 0, 0, 0, 1, 0)
341 # create a plane from a point, a vector and a trimsize
342 plane1 = geompy.MakePlane(p1, vector1, trimsize)
344 # create a plane from three points and a trimsize
345 plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize)
347 # create a plane from the given face
348 plane3 = geompy.MakePlaneFace(face, trimsize)
350 # create a plane from two vectors and a trimsize
351 plane4 = geompy.MakePlane2Vec(vector1, vector2, trimsize)
353 # create a plane with the Local Coordinate System and a trimsize
354 plane5 = geompy.MakePlaneLCS(LCS, trimsize, 1)
356 # add objects in the study
357 id_face = geompy.addToStudy(face, "Face")
358 id_plane1 = geompy.addToStudy(plane1,"Plane1")
359 id_plane2 = geompy.addToStudy(plane2,"Plane2")
360 id_plane3 = geompy.addToStudy(plane3,"Plane3")
361 id_plane4 = geompy.addToStudy(plane4,"Plane4")
362 id_plane5 = geompy.addToStudy(plane5,"Plane5")
364 # display the points and the vectors
365 gg.createAndDisplayGO(id_face)
366 gg.createAndDisplayGO(id_plane1)
367 gg.createAndDisplayGO(id_plane2)
368 gg.createAndDisplayGO(id_plane3)
369 gg.createAndDisplayGO(id_plane4)
370 gg.createAndDisplayGO(id_plane5)
371 gg.setDisplayMode(id_plane1,1)
372 gg.setTransparency(id_plane1,0.5)
373 gg.setDisplayMode(id_plane2,1)
374 gg.setTransparency(id_plane2,0.5)
375 gg.setDisplayMode(id_plane3,1)
376 gg.setTransparency(id_plane3,0.5)
377 gg.setDisplayMode(id_plane4,1)
378 gg.setTransparency(id_plane4,0.5)
379 gg.setDisplayMode(id_plane5,1)
380 gg.setTransparency(id_plane5,0.5)
383 \anchor tui_creation_lcs
384 <br><h2>Creation of a Local Coordinate System</h2>
391 #Create vertexes, vectors and shapes to construct local CS
392 Vertex_1 = geompy.MakeVertex(50, 50, 50)
393 Vertex_2 = geompy.MakeVertex(70, 70, 70)
394 Vertex_3 = geompy.MakeVertex(0, 0, 0)
395 Vector_X = geompy.MakeVectorDXDYDZ(50, 0, 0)
396 Vector_Y = geompy.MakeVectorDXDYDZ(0, 50, 0)
397 Face_1 = geompy.MakeFaceHW(100, 100, 1)
398 Box_1 = geompy.MakeBoxTwoPnt(Vertex_1, Vertex_2)
400 #Construct local CS by manual definition
401 LocalCS_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
403 #Construct local CS by center point and two vectors (X and Y directions)
404 LocalCS_2 = geompy.MakeMarkerPntTwoVec(Vertex_3, Vector_X, Vector_Y)
406 #Construct local CS from shape orientation
407 LocalCS_FACE = geompy.MakeMarkerFromShape(Face_1)
408 LocalCS_BOX = geompy.MakeMarkerFromShape(Box_1)
410 #Add created object to study
411 geompy.addToStudy( Face_1, "Face_1" )
412 geompy.addToStudy( Vertex_1, "Vertex_1" )
413 geompy.addToStudy( Vertex_2, "Vertex_2" )
414 geompy.addToStudy( Box_1, "Box_1" )
415 geompy.addToStudy( Vertex_3, "Vertex_3" )
416 geompy.addToStudy( Vector_X, "Vector_X" )
417 geompy.addToStudy( Vector_Y, "Vector_Y" )
418 geompy.addToStudy( LocalCS_1, "LocalCS_1" )
419 geompy.addToStudy( LocalCS_2, "LocalCS_3" )
420 geompy.addToStudy( LocalCS_FACE, "LocalCS_FACE" )
421 geompy.addToStudy( LocalCS_BOX, "LocalCS_BOX" )