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., 0)
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 # add objects in the study
233 id_p0 = geompy.addToStudy(p0, "Point1")
234 id_p1 = geompy.addToStudy(p1, "Point2")
235 id_p2 = geompy.addToStudy(p2, "Point3")
236 id_p3 = geompy.addToStudy(p3, "Point4")
237 id_p4 = geompy.addToStudy(p4, "Point5")
238 id_polyline = geompy.addToStudy(polyline, "Polyline")
239 id_bezier = geompy.addToStudy(bezier, "Bezier")
240 id_interpol = geompy.addToStudy(interpol, "Interpol")
242 # display the points and the curves
243 gg.createAndDisplayGO(id_p0)
244 gg.createAndDisplayGO(id_p1)
245 gg.createAndDisplayGO(id_p2)
246 gg.createAndDisplayGO(id_p3)
247 gg.createAndDisplayGO(id_p4)
248 gg.createAndDisplayGO(id_polyline)
249 gg.createAndDisplayGO(id_bezier)
250 gg.createAndDisplayGO(id_interpol)
253 \anchor tui_creation_vector
254 <br><h2>Creation of a Vector</h2>
259 gg = salome.ImportComponentGUI("GEOM")
262 p1 = geompy.MakeVertex(10., 50., 20.)
263 p2 = geompy.MakeVertex(70., 70., 70.)
265 # create a vector from two points
266 vector1 = geompy.MakeVector(p1, p2)
268 # create a vector from the given components
269 vector2 = geompy.MakeVectorDXDYDZ(30, 30, 100)
271 # add objects in the study
272 id_p1 = geompy.addToStudy(p1, "Point1")
273 id_p2 = geompy.addToStudy(p2, "Point2")
274 id_vector1 = geompy.addToStudy(vector1,"Vector1")
275 id_vector2 = geompy.addToStudy(vector2,"Vector2")
277 # display the points and the vectors
278 gg.createAndDisplayGO(id_p1)
279 gg.createAndDisplayGO(id_p2)
280 gg.createAndDisplayGO(id_vector1)
281 gg.createAndDisplayGO(id_vector2)
284 \anchor tui_creation_plane
285 <br><h2>Creation of a Plane</h2>
290 gg = salome.ImportComponentGUI("GEOM")
293 p1 = geompy.MakeVertex( 0., 0., 100.)
294 p2 = geompy.MakeVertex(100., 0., 0.)
295 p3 = geompy.MakeVertex(200., 200., 200.)
296 p4 = geompy.MakeVertex(100., 100., 0.)
297 p5 = geompy.MakeVertex(0. , 100., 0.)
299 # create a vectors from the given components
300 vector1 = geompy.MakeVectorDXDYDZ(100., 100., 100.)
301 vector2 = geompy.MakeVectorDXDYDZ(-100., 0., 100.)
303 # create a vector from two points
304 vector_arc = geompy.MakeVector(p2, p5)
306 # create an arc from three points
307 arc = geompy.MakeArc(p2, p4, p5)
310 wire = geompy.MakeWire([vector_arc, arc])
314 face = geompy.MakeFace(wire, isPlanarWanted)
317 # create a Local Coordinate System
319 LCS = geompy.MakeMarker(100., 100., 101., 1, 0, 0, 0, 1, 0)
321 # create a plane from a point, a vector and a trimsize
322 plane1 = geompy.MakePlane(p1, vector1, trimsize)
324 # create a plane from three points and a trimsize
325 plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize)
327 # create a plane from the given face
328 plane3 = geompy.MakePlaneFace(face, trimsize)
330 # create a plane from two vectors and a trimsize
331 plane4 = geompy.MakePlane2Vec(vector1, vector2, trimsize)
333 # create a plane with the Local Coordinate System and a trimsize
334 plane5 = geompy.MakePlaneLCS(LCS, trimsize, 1)
336 # add objects in the study
337 id_face = geompy.addToStudy(face, "Face")
338 id_plane1 = geompy.addToStudy(plane1,"Plane1")
339 id_plane2 = geompy.addToStudy(plane2,"Plane2")
340 id_plane3 = geompy.addToStudy(plane3,"Plane3")
341 id_plane4 = geompy.addToStudy(plane4,"Plane4")
342 id_plane5 = geompy.addToStudy(plane5,"Plane5")
344 # display the points and the vectors
345 gg.createAndDisplayGO(id_face)
346 gg.createAndDisplayGO(id_plane1)
347 gg.createAndDisplayGO(id_plane2)
348 gg.createAndDisplayGO(id_plane3)
349 gg.createAndDisplayGO(id_plane4)
350 gg.createAndDisplayGO(id_plane5)
351 gg.setDisplayMode(id_plane1,1)
352 gg.setTransparency(id_plane1,0.5)
353 gg.setDisplayMode(id_plane2,1)
354 gg.setTransparency(id_plane2,0.5)
355 gg.setDisplayMode(id_plane3,1)
356 gg.setTransparency(id_plane3,0.5)
357 gg.setDisplayMode(id_plane4,1)
358 gg.setTransparency(id_plane4,0.5)
359 gg.setDisplayMode(id_plane5,1)
360 gg.setTransparency(id_plane5,0.5)
363 \anchor tui_creation_lcs
364 <br><h2>Creation of a Local Coordinate System</h2>
371 #Create vertexes, vectors and shapes to construct local CS
372 Vertex_1 = geompy.MakeVertex(50, 50, 50)
373 Vertex_2 = geompy.MakeVertex(70, 70, 70)
374 Vertex_3 = geompy.MakeVertex(0, 0, 0)
375 Vector_X = geompy.MakeVectorDXDYDZ(50, 0, 0)
376 Vector_Y = geompy.MakeVectorDXDYDZ(0, 50, 0)
377 Face_1 = geompy.MakeFaceHW(100, 100, 1)
378 Box_1 = geompy.MakeBoxTwoPnt(Vertex_1, Vertex_2)
380 #Construct local CS by manual definition
381 LocalCS_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
383 #Construct local CS by center point and two vectors (X and Y directions)
384 LocalCS_2 = geompy.MakeMarkerPntTwoVec(Vertex_3, Vector_X, Vector_Y)
386 #Construct local CS from shape orientation
387 LocalCS_FACE = geompy.MakeMarkerFromShape(Face_1)
388 LocalCS_BOX = geompy.MakeMarkerFromShape(Box_1)
390 #Add created object to study
391 geompy.addToStudy( Face_1, "Face_1" )
392 geompy.addToStudy( Vertex_1, "Vertex_1" )
393 geompy.addToStudy( Vertex_2, "Vertex_2" )
394 geompy.addToStudy( Box_1, "Box_1" )
395 geompy.addToStudy( Vertex_3, "Vertex_3" )
396 geompy.addToStudy( Vector_X, "Vector_X" )
397 geompy.addToStudy( Vector_Y, "Vector_Y" )
398 geompy.addToStudy( LocalCS_1, "LocalCS_1" )
399 geompy.addToStudy( LocalCS_2, "LocalCS_3" )
400 geompy.addToStudy( LocalCS_FACE, "LocalCS_FACE" )
401 geompy.addToStudy( LocalCS_BOX, "LocalCS_BOX" )