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 p50 = geompy.MakeVertex(50., 50., 50.)
121 # create a vector from two points
122 vector = geompy.MakeVector(p0, p50)
124 # create an ellipse from a point, a vector and radiuses
125 ellipse = geompy.MakeEllipse(p50, vector, 50, 25)
127 # add objects in the study
128 id_vector = geompy.addToStudy(vector, "Vector")
129 id_ellipse = geompy.addToStudy(ellipse,"Ellipse")
131 # display the ellipse and its normal vector
132 gg.createAndDisplayGO(id_vector)
133 gg.createAndDisplayGO(id_ellipse)
136 \anchor tui_creation_arc
137 <br><h2>Creation of an Arc</h2>
142 gg = salome.ImportComponentGUI("GEOM")
145 p0 = geompy.MakeVertex(0., 0., 0.)
146 p1 = geompy.MakeVertex(100., 0., 0.)
147 p2 = geompy.MakeVertex(50., 0., 50.)
149 # create an arc from a three points
150 arc1 = geompy.MakeArc(p0, p1, p2)
152 # create an arc from a center point, a start point and end point
153 arc2 = geompy.MakeArcCenter(p0, p1, p2, 1)
155 # create an arc from a center point, a major point and minor point
156 arc3 = geompy.MakeArcOfEllipse(p0, p1, p2)
158 # add objects in the study
159 id_arc1 = geompy.addToStudy(arc1, "Arc 1")
160 id_arc2 = geompy.addToStudy(arc2, "Arc 2")
161 id_arc3 = geompy.addToStudy(arc3, "Arc 3")
164 gg.createAndDisplayGO(id_arc1)
165 gg.createAndDisplayGO(id_arc2)
166 gg.createAndDisplayGO(id_arc3)
169 \anchor tui_creation_curve
170 <br><h2>Creation of a Curve</h2>
175 gg = salome.ImportComponentGUI("GEOM")
178 p0 = geompy.MakeVertex(0. , 0. , 0. )
179 p1 = geompy.MakeVertex(50. , 100., 200.)
180 p2 = geompy.MakeVertex(150., 50., 100.)
181 p3 = geompy.MakeVertex(100., 150., 170.)
182 p4 = geompy.MakeVertex(200., 200., 150.)
184 # create a polyline from a list of points
185 polyline = geompy.MakePolyline([p0, p1, p2, p3, p4])
187 # create a bezier curve from a list of points
188 bezier = geompy.MakeBezier([p0, p1, p2, p3, p4])
190 #create a b-spline curve from a list of points
191 interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4])
193 # add objects in the study
194 id_p0 = geompy.addToStudy(p0, "Point1")
195 id_p1 = geompy.addToStudy(p1, "Point2")
196 id_p2 = geompy.addToStudy(p2, "Point3")
197 id_p3 = geompy.addToStudy(p3, "Point4")
198 id_p4 = geompy.addToStudy(p4, "Point5")
199 id_polyline = geompy.addToStudy(polyline, "Polyline")
200 id_bezier = geompy.addToStudy(bezier, "Bezier")
201 id_interpol = geompy.addToStudy(interpol, "Interpol")
203 # display the points and the curves
204 gg.createAndDisplayGO(id_p0)
205 gg.createAndDisplayGO(id_p1)
206 gg.createAndDisplayGO(id_p2)
207 gg.createAndDisplayGO(id_p3)
208 gg.createAndDisplayGO(id_p4)
209 gg.createAndDisplayGO(id_polyline)
210 gg.createAndDisplayGO(id_bezier)
211 gg.createAndDisplayGO(id_interpol)
214 \anchor tui_creation_vector
215 <br><h2>Creation of a Vector</h2>
220 gg = salome.ImportComponentGUI("GEOM")
223 p1 = geompy.MakeVertex(10., 50., 20.)
224 p2 = geompy.MakeVertex(70., 70., 70.)
226 # create a vector from two points
227 vector1 = geompy.MakeVector(p1, p2)
229 # create a vector from the given components
230 vector2 = geompy.MakeVectorDXDYDZ(30, 30, 100)
232 # add objects in the study
233 id_p1 = geompy.addToStudy(p1, "Point1")
234 id_p2 = geompy.addToStudy(p2, "Point2")
235 id_vector1 = geompy.addToStudy(vector1,"Vector1")
236 id_vector2 = geompy.addToStudy(vector2,"Vector2")
238 # display the points and the vectors
239 gg.createAndDisplayGO(id_p1)
240 gg.createAndDisplayGO(id_p2)
241 gg.createAndDisplayGO(id_vector1)
242 gg.createAndDisplayGO(id_vector2)
245 \anchor tui_creation_plane
246 <br><h2>Creation of a Plane</h2>
251 gg = salome.ImportComponentGUI("GEOM")
254 p1 = geompy.MakeVertex( 0., 0., 100.)
255 p2 = geompy.MakeVertex(100., 0., 0.)
256 p3 = geompy.MakeVertex(200., 200., 200.)
257 p4 = geompy.MakeVertex(100., 100., 0.)
258 p5 = geompy.MakeVertex(0. , 100., 0.)
260 # create a vector from the given components
261 vector = geompy.MakeVectorDXDYDZ(100., 100., 100.)
263 # create a vector from two points
264 vector_arc = geompy.MakeVector(p2, p5)
266 # create an arc from three points
267 arc = geompy.MakeArc(p2, p4, p5)
270 wire = geompy.MakeWire([vector_arc, arc])
274 face = geompy.MakeFace(wire, isPlanarWanted)
277 # create a plane from a point, a vector and a trimsize
278 plane1 = geompy.MakePlane(p1, vector, trimsize)
280 # create a plane from three points and a trimsize
281 plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize)
283 # create a plane from the given face
284 plane3 = geompy.MakePlaneFace(face, trimsize)
286 # add objects in the study
287 id_face = geompy.addToStudy(face, "Face")
288 id_plane1 = geompy.addToStudy(plane1,"Plane1")
289 id_plane2 = geompy.addToStudy(plane2,"Plane2")
290 id_plane3 = geompy.addToStudy(plane3,"Plane3")
292 # display the points and the vectors
293 gg.createAndDisplayGO(id_face)
294 gg.createAndDisplayGO(id_plane1)
295 gg.createAndDisplayGO(id_plane2)
296 gg.createAndDisplayGO(id_plane3)
297 gg.setDisplayMode(id_plane1,1)
298 gg.setTransparency(id_plane1,0.5)
299 gg.setDisplayMode(id_plane2,1)
300 gg.setTransparency(id_plane2,0.5)
301 gg.setDisplayMode(id_plane3,1)
302 gg.setTransparency(id_plane3,0.5)