]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOM_SWIG/GEOM_all.py
Salome HOME
e0da9b6a6bf74c2d5f56035a8bcc43692d2a8b74
[modules/geom.git] / src / GEOM_SWIG / GEOM_all.py
1 from batchmode_salome import *
2 import GEOM
3 import math
4
5 geom = lcc.FindOrLoadComponent("FactoryServer", "GEOM")
6 myBuilder = myStudy.NewBuilder()
7
8 id = myStudy._get_StudyId()
9
10 #######################################################
11 ### Basic Operations
12 #######################################################
13 ###
14 BasicOp = geom.GetIBasicOperations(id)
15 print "\n --- Basic Operations --- \n"
16
17 #######################################################
18 point1 = BasicOp.MakePointXYZ(0, 0, 0)
19 if BasicOp.IsDone() == 0:
20     print "MakePointXYZ(0, 0, 0) NOT DONE : ", BasicOp.GetErrorCode()
21 else:
22     if point1 is None:
23         print "MakePointXYZ(0, 0, 0) returned null : ", BasicOp.GetErrorCode()
24     else:
25         point1.SetName("Point1: MakePointXYZ(0, 0, 0)")
26         print point1.GetName(), " : ", BasicOp.GetErrorCode()
27
28 #######################################################
29 point2 = BasicOp.MakePointWithReference(point1, 40, 40, 52)
30 if BasicOp.IsDone() == 0:
31     print "MakePointWithReference(point1, 40, 40, 52) NOT DONE : ", BasicOp.GetErrorCode()
32 else:
33     if point2 is None:
34         print "MakePointWithReference(point1, 40, 40, 52) returned null : ", BasicOp.GetErrorCode()
35     else:
36         point2.SetName("Point2: MakePointWithReference(point1, 40, 40, 52)")
37         print point2.GetName(), " : ", BasicOp.GetErrorCode()
38
39 #######################################################
40 point3 = BasicOp.MakePointWithReference(point2, -20, -20, 0)
41 if BasicOp.IsDone() == 0:
42     print "MakePointWithReference(point2, -20, -20, 0) NOT DONE : ", BasicOp.GetErrorCode()
43 else:
44     if point3 is None:
45         print "MakePointWithReference(point2, -20, -20, 0) returned null : ", BasicOp.GetErrorCode()
46     else:
47         point3.SetName("Point3: MakePointWithReference(point2, -20, -20, 0)")
48         print point3.GetName(), " : ", BasicOp.GetErrorCode()
49
50 #######################################################
51 point5 = BasicOp.MakePointWithReference(point3, 40, 0, -3.5)
52 if BasicOp.IsDone() == 0:
53     print "MakePointWithReference(point3, 40, 0, -3.5) NOT DONE : ", BasicOp.GetErrorCode()
54 else:
55     if point5 is None:
56         print "MakePointWithReference(point3, 40, 0, -3.5) returned null : ", BasicOp.GetErrorCode()
57     else:
58         point5.SetName("Point5: MakePointWithReference(point3, 40, 0, -3.5)")
59         print point5.GetName(), " : ", BasicOp.GetErrorCode()
60
61 #######################################################
62 point6 = BasicOp.MakePointWithReference(point5, 0, 0, -9)
63 if BasicOp.IsDone() == 0:
64     print "MakePointWithReference(point5, 0, 0, -9) NOT DONE : ", BasicOp.GetErrorCode()
65 else:
66     if point6 is None:
67         print "MakePointWithReference(point5, 0, 0, -9) returned null : ", BasicOp.GetErrorCode()
68     else:
69         point6.SetName("Point6: MakePointWithReference(point5, 0, 0, -9)")
70         print point6.GetName(), " : ", BasicOp.GetErrorCode()
71
72 #######################################################
73 point7 = BasicOp.MakePointWithReference(point2, 0, 0, -52)
74 if BasicOp.IsDone() == 0:
75     print "MakePointWithReference(point2, 0, 0, -52) NOT DONE : ", BasicOp.GetErrorCode()
76 else:
77     if point7 is None:
78         print "MakePointWithReference(point2, 0, 0, -52) returned null : ", BasicOp.GetErrorCode()
79     else:
80         point7.SetName("Point7: MakePointWithReference(point2, 0, 0, -52)")
81         print point7.GetName(), " : ", BasicOp.GetErrorCode()
82
83 #######################################################
84 vector1 = BasicOp.MakeVectorDXDYDZ(0,0,1)
85 if BasicOp.IsDone() == 0:
86     print "MakeVectorDXDYDZ(0,0,1) NOT DONE : ", BasicOp.GetErrorCode()
87 else:
88     if vector1 is None:
89         print "MakeVectorDXDYDZ(0,0,1) returned null : ", BasicOp.GetErrorCode()
90     else:
91         vector1.SetName("Vector1: MakeVectorDXDYDZ(0,0,1)")
92         print vector1.GetName(), " : ", BasicOp.GetErrorCode()
93
94 #######################################################
95 vector2 = BasicOp.MakeVectorTwoPnt(point2, point3)
96 if BasicOp.IsDone() == 0:
97     print "MakeVectorTwoPnt(point2, point3) NOT DONE : ", BasicOp.GetErrorCode()
98 else:
99     if vector2 is None:
100         print "MakeVectorTwoPnt(point2, point3) returned null : ", BasicOp.GetErrorCode()
101     else:
102         vector2.SetName("Vector2: MakeVectorTwoPnt(point2, point3)")
103         print vector2.GetName(), " : ", BasicOp.GetErrorCode()
104
105 #######################################################
106 vector3 = BasicOp.MakeVectorTwoPnt(point2, point6)
107 if BasicOp.IsDone() == 0:
108     print "MakeVectorTwoPnt(point2, point6) NOT DONE : ", BasicOp.GetErrorCode()
109 else:
110     if vector3 is None:
111         print "MakeVectorTwoPnt(point2, point6) returned null : ", BasicOp.GetErrorCode()
112     else:
113         vector3.SetName("Vector3: MakeVectorTwoPnt(point2, point6)")
114         print vector3.GetName(), " : ", BasicOp.GetErrorCode()
115
116 #######################################################
117 line1 = BasicOp.MakeLine(point7, point3)
118 if BasicOp.IsDone() == 0:
119     print "MakeLine(point7, point3) NOT DONE : ", BasicOp.GetErrorCode()
120 else:
121     if line1 is None:
122         print "MakeLine(point7, point3) returned null : ", BasicOp.GetErrorCode()
123     else:
124         line1.SetName("Line1: MakeLine(point7, point3)")
125         print line1.GetName(), " : ", BasicOp.GetErrorCode()
126
127 #######################################################
128 plane1 = BasicOp.MakePlanePntVec(point3, vector1, 20.0 * math.sqrt(2.0))
129 if BasicOp.IsDone() == 0:
130     print "MakePlanePntVec(point3, vector1, 20.0 * math.sqrt(2.0)) NOT DONE : ", BasicOp.GetErrorCode()
131 else:
132     if plane1 is None:
133         print "MakePlanePntVec(point3, vector1, 20.0 * math.sqrt(2.0)) returned null : ", BasicOp.GetErrorCode()
134     else:
135         plane1.SetName("Plane1: MakePlanePntVec(point3, vector1, 20.0 * math.sqrt(2.0))")
136         print plane1.GetName(), " : ", BasicOp.GetErrorCode()
137
138 #######################################################
139 plane2 = BasicOp.MakePlaneThreePnt(point1, point2, point3, 50)
140 if BasicOp.IsDone() == 0:
141     print "MakePlaneThreePnt(point1, point2, point3, 50) NOT DONE : ", BasicOp.GetErrorCode()
142 else:
143     if plane2 is None:
144         print "MakePlaneThreePnt(point1, point2, point3, 50) returned null : ", BasicOp.GetErrorCode()
145     else:
146         plane2.SetName("Plane2: MakePlaneThreePnt(point1, point2, point3, 50)")
147         print plane2.GetName(), " : ", BasicOp.GetErrorCode()
148
149 #######################################################
150 plane3 = BasicOp.MakePlaneFace(plane2, 70)
151 if BasicOp.IsDone() == 0:
152     print "MakePlaneFace(plane2, 70) NOT DONE : ", BasicOp.GetErrorCode()
153 else:
154     if plane3 is None:
155         print "MakePlaneFace(plane2, 70) returned null : ", BasicOp.GetErrorCode()
156     else:
157         plane3.SetName("Plane3: MakePlaneFace(plane2, 70)")
158         print plane3.GetName(), " : ", BasicOp.GetErrorCode()
159
160 #######################################################
161 ### Insert Operations
162 #######################################################
163 ###
164 #InsertOp = geom.GetIInsertOperations(id)
165 #print "\n --- Insert Operations --- \n"
166 #
167 #######################################################
168 #obj3 = InsertOp.MakeCopy(obj2)
169
170 #######################################################
171 ### Curves Creation
172 #######################################################
173 ###
174 CurvesOp = geom.GetICurvesOperations(id)
175 print "\n --- Curves Creation --- \n"
176
177 #######################################################
178 circle1 = CurvesOp.MakeCirclePntVecR(point2, vector2, 13)
179 if CurvesOp.IsDone() == 0:
180     print "MakeCirclePntVecR(point2, vector2, 13) NOT DONE : ", CurvesOp.GetErrorCode()
181 else:
182     if circle1 is None:
183         print "MakeCirclePntVecR(point2, vector2, 13) returned null : ", CurvesOp.GetErrorCode()
184     else:
185         circle1.SetName("Circle1: MakeCirclePntVecR(point2, vector2, 13)")
186         print circle1.GetName(), " : ", CurvesOp.GetErrorCode()
187
188 #######################################################
189 circle2 = CurvesOp.MakeCircleThreePnt(point1, point2, point3)
190 if CurvesOp.IsDone() == 0:
191     print "MakeCircleThreePnt(point1, point2, point3) NOT DONE : ", CurvesOp.GetErrorCode()
192 else:
193     if circle2 is None:
194         print "MakeCircleThreePnt(point1, point2, point3) returned null : ", CurvesOp.GetErrorCode()
195     else:
196         circle2.SetName("Circle2: MakeCircleThreePnt(point1, point2, point3)")
197         print circle2.GetName(), " : ", CurvesOp.GetErrorCode()
198
199 #######################################################
200 ellipse1 = CurvesOp.MakeEllipse(point2, vector2, 21, 13)
201 if CurvesOp.IsDone() == 0:
202     print "MakeEllipse(point2, vector2, 21, 13) NOT DONE : ", CurvesOp.GetErrorCode()
203 else:
204     if ellipse1 is None:
205         print "MakeEllipse(point2, vector2, 21, 13) returned null : ", CurvesOp.GetErrorCode()
206     else:
207         ellipse1.SetName("Ellipse1: MakeEllipse(point2, vector2, 21, 13)")
208         print ellipse1.GetName(), " : ", CurvesOp.GetErrorCode()
209
210 #######################################################
211 arc1 = CurvesOp.MakeArc(point1, point2, point3)
212 if CurvesOp.IsDone() == 0:
213     print "MakeArc(point1, point2, point3) NOT DONE : ", CurvesOp.GetErrorCode()
214 else:
215     if arc1 is None:
216         print "MakeArc(point1, point2, point3) returned null : ", CurvesOp.GetErrorCode()
217     else:
218         arc1.SetName("Arc1: MakeArc(point1, point2, point3)")
219         print arc1.GetName(), " : ", CurvesOp.GetErrorCode()
220
221 #######################################################
222 poly1 = CurvesOp.MakePolyline([point1, point3, point2, point7])
223 if CurvesOp.IsDone() == 0:
224     print "MakePolyline([point1, point3, point2, point7]) NOT DONE : ", CurvesOp.GetErrorCode()
225 else:
226     if poly1 is None:
227         print "MakePolyline([point1, point3, point2, point7]) returned null : ", CurvesOp.GetErrorCode()
228     else:
229         poly1.SetName("Polyline1: MakePolyline([point1, point3, point2, point7])")
230         print poly1.GetName(), " : ", CurvesOp.GetErrorCode()
231
232 #######################################################
233 bezier1 = CurvesOp.MakeSplineBezier([point2, point3, point7, point1])
234 if CurvesOp.IsDone() == 0:
235     print "MakeSplineBezier([point2, point3, point7, point1]) NOT DONE : ", CurvesOp.GetErrorCode()
236 else:
237     if bezier1 is None:
238         print "MakeSplineBezier([point2, point3, point7, point1]) returned null : ", CurvesOp.GetErrorCode()
239     else:
240         bezier1.SetName("Bezier1: MakeSplineBezier([point2, point3, point7, point1])")
241         print bezier1.GetName(), " : ", CurvesOp.GetErrorCode()
242
243 #######################################################
244 bspline1 = CurvesOp.MakeSplineInterpolation([point2, point7, point1, point3])
245 if CurvesOp.IsDone() == 0:
246     print "MakeSplineInterpolation([point2, point7, point1, point3]) NOT DONE : ", CurvesOp.GetErrorCode()
247 else:
248     if bspline1 is None:
249         print "MakeSplineInterpolation([point2, point7, point1, point3]) returned null : ", CurvesOp.GetErrorCode()
250     else:
251         bspline1.SetName("B-Spline1: MakeSplineInterpolation([point2, point7, point1, point3])")
252         print bspline1.GetName(), " : ", CurvesOp.GetErrorCode()
253
254 #######################################################
255 ### 3D Primitives Creation
256 #######################################################
257 ###
258 PrimOp = geom.GetI3DPrimOperations(id)
259 print "\n --- 3D Primitives Creation --- \n"
260
261 #######################################################
262 box1 = PrimOp.MakeBoxTwoPnt(point1, point2)
263 if PrimOp.IsDone() == 0:
264     print "MakeBoxTwoPnt(point1, point2) NOT DONE : ", PrimOp.GetErrorCode()
265 else:
266     if box1 is None:
267         print "MakeBoxTwoPnt(point1, point2) returned null : ", PrimOp.GetErrorCode()
268     else:
269         box1.SetName("Box1: MakeBoxTwoPnt(point1, point2)")
270         print box1.GetName(), " : ", PrimOp.GetErrorCode()
271
272 #######################################################
273 box2 = PrimOp.MakeBoxDXDYDZ(10, 20, -30)
274 if PrimOp.IsDone() == 0:
275     print "MakeBoxDXDYDZ(10, 20, -30) NOT DONE : ", PrimOp.GetErrorCode()
276 else:
277     if box2 is None:
278         print "MakeBoxDXDYDZ(10, 20, -30) returned null : ", PrimOp.GetErrorCode()
279     else:
280         box2.SetName("Box2: MakeBoxDXDYDZ(10, 20, -30)")
281         print box2.GetName(), " : ", PrimOp.GetErrorCode()
282
283 #######################################################
284 sphere1 = PrimOp.MakeSphereR(7)
285 if PrimOp.IsDone() == 0:
286     print "MakeSphereR(7) NOT DONE : ", PrimOp.GetErrorCode()
287 else:
288     if sphere1 is None:
289         print "MakeSphereR(7) returned null : ", PrimOp.GetErrorCode()
290     else:
291         sphere1.SetName("Sphere1: MakeSphereR(7)")
292         print sphere1.GetName(), " : ", PrimOp.GetErrorCode()
293
294 #######################################################
295 sphere2 = PrimOp.MakeSpherePntR(point5, 3.5)
296 if PrimOp.IsDone() == 0:
297     print "MakeSpherePntR(point5, 3.5) NOT DONE : ", PrimOp.GetErrorCode()
298 else:
299     if sphere2 is None:
300         print "MakeSpherePntR(point5, 3.5) returned null : ", PrimOp.GetErrorCode()
301     else:
302         sphere2.SetName("Sphere2: MakeSpherePntR(point5, 3.5)")
303         print sphere2.GetName(), " : ", PrimOp.GetErrorCode()
304
305 #######################################################
306 cylinder1 = PrimOp.MakeCylinderRH(3, 33)
307 if PrimOp.IsDone() == 0:
308     print "MakeCylinderRH(3, 33) NOT DONE : ", PrimOp.GetErrorCode()
309 else:
310     if cylinder1 is None:
311         print "MakeCylinderRH(3, 33) returned null : ", PrimOp.GetErrorCode()
312     else:
313         cylinder1.SetName("Cylinder1: MakeCylinderRH(3, 33)")
314         print cylinder1.GetName(), " : ", PrimOp.GetErrorCode()
315
316 #######################################################
317 cylinder2 = PrimOp.MakeCylinderPntVecRH(point3, vector1, 20, 13)
318 if PrimOp.IsDone() == 0:
319     print "MakeCylinderPntVecRH(point3, vector1, 20, 13) NOT DONE : ", PrimOp.GetErrorCode()
320 else:
321     if cylinder2 is None:
322         print "MakeCylinderPntVecRH(point3, vector1, 20, 13) returned null : ", PrimOp.GetErrorCode()
323     else:
324         cylinder2.SetName("Cylinder2: MakeCylinderPntVecRH(point3, vector1, 20, 13)")
325         print cylinder2.GetName(), " : ", PrimOp.GetErrorCode()
326
327 #######################################################
328 cone1 = PrimOp.MakeConeR1R2H(10, 3, 2)
329 if PrimOp.IsDone() == 0:
330     print "MakeConeR1R2H(10, 3, 2) NOT DONE : ", PrimOp.GetErrorCode()
331 else:
332     if cone1 is None:
333         print "MakeConeR1R2H(10, 3, 2) returned null : ", PrimOp.GetErrorCode()
334     else:
335         cone1.SetName("Cone1: MakeConeR1R2H(10, 3, 2)")
336         print cone1.GetName(), " : ", PrimOp.GetErrorCode()
337
338 #######################################################
339 cone2 = PrimOp.MakeConePntVecR1R2H(point6, vector1, 3.5, 0, 9)
340 if PrimOp.IsDone() == 0:
341     print "MakeConePntVecR1R2H(point6, vector1, 3.5, 0, 9) NOT DONE : ", PrimOp.GetErrorCode()
342 else:
343     if cone2 is None:
344         print "MakeConePntVecR1R2H(point6, vector1, 3.5, 0, 9) returned null : ", PrimOp.GetErrorCode()
345     else:
346         cone2.SetName("Cone2: MakeConePntVecR1R2H(point6, vector1, 3.5, 0, 9)")
347         print cone2.GetName(), " : ", PrimOp.GetErrorCode()
348
349 #######################################################
350 cone3 = PrimOp.MakeConePntVecR1R2H(point6, vector1, 3.5, 0, -9)
351 if PrimOp.IsDone() == 0:
352     print "MakeConePntVecR1R2H(point6, vector1, 3.5, 0, -9) NOT DONE : ", PrimOp.GetErrorCode()
353 else:
354     if cone3 is None:
355         print "MakeConePntVecR1R2H(point6, vector1, 3.5, 0, -9) returned null : ", PrimOp.GetErrorCode()
356     else:
357         cone3.SetName("Cone3: MakeConePntVecR1R2H(point6, vector1, 3.5, 0, -9)")
358         print cone3.GetName(), " : ", PrimOp.GetErrorCode()
359
360 #######################################################
361 torus1 = PrimOp.MakeTorusPntVecRR(point7, vector2, 50, 49)
362 if PrimOp.IsDone() == 0:
363     print "MakeTorusPntVecRR(point7, vector2, 50, 49) NOT DONE : ", PrimOp.GetErrorCode()
364 else:
365     if torus1 is None:
366         print "MakeTorusPntVecRR(point7, vector2, 50, 49) returned null : ", PrimOp.GetErrorCode()
367     else:
368         torus1.SetName("Torus1: MakeTorusPntVecRR(point7, vector2, 50, 49)")
369         print torus1.GetName(), " : ", PrimOp.GetErrorCode()
370
371 #######################################################
372 torus2 = PrimOp.MakeTorusRR(50, 49)
373 if PrimOp.IsDone() == 0:
374     print "MakeTorusRR(50, 49) NOT DONE : ", PrimOp.GetErrorCode()
375 else:
376     if torus2 is None:
377         print "MakeTorusRR(50, 49) returned null : ", PrimOp.GetErrorCode()
378     else:
379         torus2.SetName("Torus2: MakeTorusRR(50, 49)")
380         print torus2.GetName(), " : ", PrimOp.GetErrorCode()
381
382 #######################################################
383 prism1 = PrimOp.MakePrismVecH(poly1, vector3, 10)
384 if PrimOp.IsDone() == 0:
385     print "MakePrismVecH(poly1, vector3, 10) NOT DONE : ", PrimOp.GetErrorCode()
386 else:
387     if prism1 is None:
388         print "MakePrismVecH(poly1, vector3, 10) returned null : ", PrimOp.GetErrorCode()
389     else:
390         prism1.SetName("Prism1: MakePrismVecH(poly1, vector3, 10)")
391         print prism1.GetName(), " : ", PrimOp.GetErrorCode()
392
393 #######################################################
394 pipe1 = PrimOp.MakePipe(circle1, bspline1)
395 if PrimOp.IsDone() == 0:
396     print "MakePipe(circle1, bspline1) NOT DONE : ", PrimOp.GetErrorCode()
397 else:
398     if pipe1 is None:
399         print "MakePipe(circle1, bspline1) returned null : ", PrimOp.GetErrorCode()
400     else:
401         pipe1.SetName("Pipe1: MakePipe(circle1, bspline1)")
402         print pipe1.GetName(), " : ", PrimOp.GetErrorCode()
403
404 #######################################################
405 pipe2 = PrimOp.MakePipe(circle1, box1)
406 if PrimOp.IsDone() == 0:
407     print "MakePipe(circle1, box1) NOT DONE : ", PrimOp.GetErrorCode()
408 else:
409     if pipe2 is None:
410         print "MakePipe(circle1, box1) returned null : ", PrimOp.GetErrorCode()
411     else:
412         pipe2.SetName("Pipe2: MakePipe(circle1, box1)")
413         print pipe2.GetName(), " : ", PrimOp.GetErrorCode()
414
415 #######################################################
416 revol1 = PrimOp.MakeRevolutionAxisAngle(bezier1, vector3, 10*math.pi/180.0)
417 if PrimOp.IsDone() == 0:
418     print "MakeRevolutionAxisAngle(bezier1, vector3, 10*math.pi/180.0) NOT DONE : ", PrimOp.GetErrorCode()
419 else:
420     if revol1 is None:
421         print "MakeRevolutionAxisAngle(bezier1, vector3, 10*math.pi/180.0) returned null : ", PrimOp.GetErrorCode()
422     else:
423         revol1.SetName("Revolution1: MakeRevolutionAxisAngle(bezier1, vector3, 10*math.pi/180.0)")
424         print revol1.GetName(), " : ", PrimOp.GetErrorCode()
425
426 #######################################################
427 ### Shapes Creation
428 #######################################################
429 ###
430 ShapesOp = geom.GetIShapesOperations(id)
431 print "\n --- Shapes Creation --- \n"
432
433 #######################################################
434 edge1 = ShapesOp.MakeEdge(point1, point2)
435 if ShapesOp.IsDone() == 0:
436     print "MakeEdge(point1, point2) NOT DONE : ", ShapesOp.GetErrorCode()
437 else:
438     if edge1 is None:
439         print "MakeEdge(point1, point2) returned null : ", ShapesOp.GetErrorCode()
440     else:
441         edge1.SetName("Edge1: MakeEdge(point1, point2)")
442         print edge1.GetName(), " : ", ShapesOp.GetErrorCode()
443
444 #######################################################
445 edge2 = ShapesOp.MakeEdge(point2, point3)
446 if ShapesOp.IsDone() == 0:
447     print "MakeEdge(point2, point3) NOT DONE : ", ShapesOp.GetErrorCode()
448 else:
449     if edge2 is None:
450         print "MakeEdge(point2, point3) returned null : ", ShapesOp.GetErrorCode()
451     else:
452         edge2.SetName("Edge2: MakeEdge(point2, point3)")
453         print edge2.GetName(), " : ", ShapesOp.GetErrorCode()
454
455 #######################################################
456 edge3 = ShapesOp.MakeEdge(point3, point1)
457 if ShapesOp.IsDone() == 0:
458     print "MakeEdge(point3, point1) NOT DONE : ", ShapesOp.GetErrorCode()
459 else:
460     if edge3 is None:
461         print "MakeEdge(point3, point1) returned null : ", ShapesOp.GetErrorCode()
462     else:
463         edge3.SetName("Edge3: MakeEdge(point3, point1)")
464         print edge3.GetName(), " : ", ShapesOp.GetErrorCode()
465
466 #######################################################
467 wire1 = ShapesOp.MakeWire([edge1, edge2, edge3])
468 if ShapesOp.IsDone() == 0:
469     print "MakeWire([edge1, edge2, edge3]) NOT DONE : ", ShapesOp.GetErrorCode()
470 else:
471     if wire1 is None:
472         print "MakeWire([edge1, edge2, edge3]) returned null : ", ShapesOp.GetErrorCode()
473     else:
474         wire1.SetName("Wire1: MakeWire([edge1, edge2, edge3])")
475         print wire1.GetName(), " : ", ShapesOp.GetErrorCode()
476
477 #######################################################
478 face1 = ShapesOp.MakeFace(wire1, 1)
479 if ShapesOp.IsDone() == 0:
480     print "MakeFace(wire1, 1) NOT DONE : ", ShapesOp.GetErrorCode()
481 else:
482     if face1 is None:
483         print "MakeFace(wire1, 1) returned null : ", ShapesOp.GetErrorCode()
484     else:
485         face1.SetName("Face1: MakeFace(wire1, 1)")
486         print face1.GetName(), " : ", ShapesOp.GetErrorCode()
487
488 #######################################################
489 shell1 = ShapesOp.MakeShell([face1])
490 if ShapesOp.IsDone() == 0:
491     print "MakeShell([face1]) NOT DONE : ", ShapesOp.GetErrorCode()
492 else:
493     if shell1 is None:
494         print "MakeShell([face1]) returned null : ", ShapesOp.GetErrorCode()
495     else:
496         shell1.SetName("Shell1: MakeShell([face1])")
497         print shell1.GetName(), " : ", ShapesOp.GetErrorCode()
498
499 #######################################################
500 solid1 = ShapesOp.MakeSolidShells([shell1])
501 if ShapesOp.IsDone() == 0:
502     print "MakeSolidShells([shell1]) NOT DONE : ", ShapesOp.GetErrorCode()
503 else:
504     if solid1 is None:
505         print "MakeSolidShells([shell1]) returned null : ", ShapesOp.GetErrorCode()
506     else:
507         solid1.SetName("Solid1: MakeSolidShells([shell1])")
508         print solid1.GetName(), " : ", ShapesOp.GetErrorCode()
509
510 #######################################################
511 solid2 = ShapesOp.MakeSolidShell(shell1)
512 if ShapesOp.IsDone() == 0:
513     print "MakeSolidShell(shell1) NOT DONE : ", ShapesOp.GetErrorCode()
514 else:
515     if solid2 is None:
516         print "MakeSolidShell(shell1) returned null : ", ShapesOp.GetErrorCode()
517     else:
518         solid2.SetName("Solid2: MakeSolidShell(shell1)")
519         print solid2.GetName(), " : ", ShapesOp.GetErrorCode()
520
521 #######################################################
522 comp1 = ShapesOp.MakeCompound([box1, sphere2, cone2])
523 if ShapesOp.IsDone() == 0:
524     print "MakeCompound([box1, sphere2, cone2]) NOT DONE : ", ShapesOp.GetErrorCode()
525 else:
526     if comp1 is None:
527         print "MakeCompound([box1, sphere2, cone2]) returned null : ", ShapesOp.GetErrorCode()
528     else:
529         comp1.SetName("Compound1: MakeCompound([box1, sphere2, cone2])")
530         print comp1.GetName(), " : ", ShapesOp.GetErrorCode()
531
532 #######################################################
533 ### Transformations
534 #######################################################
535 ###
536 TrsfOp = geom.GetITransformOperations(id)
537 print "\n --- Transformations --- \n"
538
539 #######################################################
540 TrsfOp.TranslateTwoPoints(cone1, point1, point2)
541 if TrsfOp.IsDone() == 0:
542     print "TranslateTwoPoints(cone1, point1, point2) NOT DONE : ", TrsfOp.GetErrorCode()
543 else:
544     print "TranslateTwoPoints(cone1, point1, point2) DONE : ", TrsfOp.GetErrorCode()
545
546 #######################################################
547 transl_cone1 = TrsfOp.TranslateTwoPointsCopy(cone1, point1, point2)
548 if TrsfOp.IsDone() == 0:
549     print "TranslateTwoPointsCopy(cone1, point1, point2) NOT DONE : ", TrsfOp.GetErrorCode()
550 else:
551     if transl_cone1 is None:
552         print "TranslateTwoPointsCopy(cone1, point1, point2) returned null : ", TrsfOp.GetErrorCode()
553     else:
554         transl_cone1.SetName("Copy1a: TranslateTwoPointsCopy(cone1, point1, point2)")
555         print transl_cone1.GetName(), " : ", TrsfOp.GetErrorCode()
556
557 #######################################################
558 TrsfOp.TranslateVector(cone1, vector2)
559 if TrsfOp.IsDone() == 0:
560     print "TranslateVector(cone1, vector2) NOT DONE : ", TrsfOp.GetErrorCode()
561 else:
562     print "TranslateVector(cone1, vector2) DONE : ", TrsfOp.GetErrorCode()
563
564 #######################################################
565 transl_cone2 = TrsfOp.TranslateVectorCopy(cone1, vector2)
566 if TrsfOp.IsDone() == 0:
567     print "TranslateVectorCopy(cone1, vector2) NOT DONE : ", TrsfOp.GetErrorCode()
568 else:
569     if transl_cone2 is None:
570         print "TranslateVectorCopy(cone1, vector2) returned null : ", TrsfOp.GetErrorCode()
571     else:
572         transl_cone2.SetName("Copy1b: TranslateVectorCopy(cone1, vector2)")
573         print transl_cone2.GetName(), " : ", TrsfOp.GetErrorCode()
574
575 #######################################################
576 #TrsfOp.Rotate(cone1, vector2, math.pi/2.0)
577 #if TrsfOp.IsDone() == 0:
578 #    print "Rotate(cone1, vector2, ) NOT DONE : ", TrsfOp.GetErrorCode()
579 #else:
580 #    print "Rotate(cone1, vector2, ) DONE : ", TrsfOp.GetErrorCode()
581
582 #######################################################
583 #rotate_cone2 = TrsfOp.RotateCopy(cone1, vector2, math.pi/4.0)
584 #if TrsfOp.IsDone() == 0:
585 #    print "RotateCopy(cone1, vector2, ) NOT DONE : ", TrsfOp.GetErrorCode()
586 #else:
587 #    if rotate_cone2 is None:
588 #        print "RotateCopy(cone1, vector2, ) returned null : ", TrsfOp.GetErrorCode()
589 #    else:
590 #        rotate_cone2.SetName("Copy1c: RotateCopy(cone1, vector2, )")
591 #        print rotate_cone2.GetName(), " : ", TrsfOp.GetErrorCode()
592
593 #######################################################
594 TrsfOp.MirrorPlane(arc1, plane1)
595 if TrsfOp.IsDone() == 0:
596     print "MirrorPlane(arc1, plane1) NOT DONE: ", TrsfOp.GetErrorCode()
597 else:
598     print "MirrorPlane(arc1, plane1) DONE: ", TrsfOp.GetErrorCode()
599
600 #######################################################
601 mirror_ell1 = TrsfOp.MirrorPlaneCopy(ellipse1, plane3)
602 if TrsfOp.IsDone() == 0:
603     print "MirrorPlaneCopy(ellipse1, plane3) NOT DONE : ", TrsfOp.GetErrorCode()
604 else:
605     if mirror_ell1 is None:
606         print "MirrorPlaneCopy(ellipse1, plane3) returned null : ", TrsfOp.GetErrorCode()
607     else:
608         mirror_ell1.SetName("Copy4: MirrorPlaneCopy(ellipse1, plane3)")
609         print mirror_ell1.GetName(), " : ", TrsfOp.GetErrorCode()
610
611 #######################################################
612 TrsfOp.MirrorAxis(arc1, line1)
613 if TrsfOp.IsDone() == 0:
614     print "MirrorAxis(arc1, line1) NOT DONE : ", TrsfOp.GetErrorCode()
615 else:
616     print "MirrorAxis(arc1, line1) DONE : ", TrsfOp.GetErrorCode()
617
618 #######################################################
619 mirror_ell1_vec3 = TrsfOp.MirrorAxisCopy(ellipse1, vector3)
620 if TrsfOp.IsDone() == 0:
621     print "MirrorAxisCopy(ellipse1, vector3) NOT DONE : ", TrsfOp.GetErrorCode()
622 else:
623     if mirror_ell1_vec3 is None:
624         print "MirrorAxisCopy(ellipse1, vector3) returned null : ", TrsfOp.GetErrorCode()
625     else:
626         mirror_ell1_vec3.SetName("Copy5: MirrorAxisCopy(ellipse1, vector3)")
627         print mirror_ell1_vec3.GetName(), " : ", TrsfOp.GetErrorCode()
628
629 #######################################################
630 TrsfOp.MirrorPoint(arc1, point7)
631 if TrsfOp.IsDone() == 0:
632     print "MirrorPoint(arc1, point7) NOT DONE : ", TrsfOp.GetErrorCode()
633 else:
634     print "MirrorPoint(arc1, point7) DONE : ", TrsfOp.GetErrorCode()
635
636 #######################################################
637 mirror_ell1_pnt7 = TrsfOp.MirrorPointCopy(ellipse1, point7)
638 if TrsfOp.IsDone() == 0:
639     print "MirrorPointCopy(ellipse1, point7) NOT DONE : ", TrsfOp.GetErrorCode()
640 else:
641     if mirror_ell1_pnt7 is None:
642         print "MirrorPointCopy(ellipse1, point7) returned null : ", TrsfOp.GetErrorCode()
643     else:
644         mirror_ell1_pnt7.SetName("Copy6: MirrorPointCopy(ellipse1, point7)")
645         print mirror_ell1_pnt7.GetName(), " : ", TrsfOp.GetErrorCode()
646
647 #######################################################
648 TrsfOp.OffsetShape(cone1, 11)
649 if TrsfOp.IsDone() == 0:
650     print "OffsetShape(cone1, 11) NOT DONE : ", TrsfOp.GetErrorCode()
651 else:
652     print "OffsetShape(cone1, 11) DONE : ", TrsfOp.GetErrorCode()
653
654 #######################################################
655 offset_cone2 = TrsfOp.OffsetShapeCopy(cone1, 11)
656 if TrsfOp.IsDone() == 0:
657     print "OffsetShapeCopy(cone1, 11) NOT DONE : ", TrsfOp.GetErrorCode()
658 else:
659     if offset_cone2 is None:
660         print "OffsetShapeCopy(cone1, 11) returned null : ", TrsfOp.GetErrorCode()
661     else:
662         offset_cone2.SetName("Copy2: OffsetShapeCopy(cone1, 11)")
663         print offset_cone2.GetName(), " : ", TrsfOp.GetErrorCode()
664
665 #######################################################
666 TrsfOp.ScaleShape(cylinder1, point1, 3)
667 if TrsfOp.IsDone() == 0:
668     print "ScaleShape(cylinder1, point1, 3) NOT DONE : ", TrsfOp.GetErrorCode()
669 else:
670     print "ScaleShape(cylinder1, point1, 3) DONE : ", TrsfOp.GetErrorCode()
671
672 #######################################################
673 copy_scale1 = TrsfOp.ScaleShapeCopy(cylinder1, point1, 3)
674 if TrsfOp.IsDone() == 0:
675     print "ScaleShapeCopy(cylinder1, point1, 3) NOT DONE : ", TrsfOp.GetErrorCode()
676 else:
677     if copy_scale1 is None:
678         print "ScaleShapeCopy(cylinder1, point1, 3) returned null : ", TrsfOp.GetErrorCode()
679     else:
680         copy_scale1.SetName("Copy3: ScaleShapeCopy(cylinder1, point1, 3)")
681         print copy_scale1.GetName(), " : ", TrsfOp.GetErrorCode()
682
683 #######################################################
684 ### Boolean Operations
685 #######################################################
686 ###
687 BoolOp = geom.GetIBooleanOperations(id)
688 print "\n --- Boolean Operations --- \n"
689
690 #######################################################
691 common1 = BoolOp.MakeBoolean(box1, sphere1, 1)
692 #print common1
693 #print dir(common1)
694 if BoolOp.IsDone() == 0:
695     print "MakeBoolean(box1, sphere1, 1) NOT DONE : ", BoolOp.GetErrorCode()
696 else:
697     if common1 is None:
698         print "MakeBoolean(box1, sphere1, 1) returned null : ", BoolOp.GetErrorCode()
699     else:
700 #        print common1.GetEntry()
701         common1.SetName("Common1: MakeBoolean(box1, sphere1, 1)")
702         print common1.GetName(), " : ", BoolOp.GetErrorCode()
703 #        geom.PublishInStudy(myStudy, None, common1, "common_box1_sphere1")
704
705 #######################################################
706 #part_limit = batchmode_geompy.ShapeType["SHAPE"]
707
708 partition1 = BoolOp.MakePartition([box1, sphere1], [], [], [], 8, 1, [7, 7])
709 if BoolOp.IsDone() == 0:
710     print "MakePartition([box1, sphere1], [], [], [], SHAPE, 1, [7, 7]) NOT DONE : ", BoolOp.GetErrorCode()
711 else:
712     if partition1 is None:
713         print "MakePartition([box1, sphere1], [], [], [], SHAPE, 1, [7, 7]) returned null : ", BoolOp.GetErrorCode()
714     else:
715         partition1.SetName("Partition1: MakePartition([box1, sphere1], [], [], [], SHAPE, 1, [7, 7])")
716         print partition1.GetName(), " : ", BoolOp.GetErrorCode()
717
718 #######################################################
719 ### Local Operations
720 #######################################################
721 ###
722 LocalOp = geom.GetILocalOperations(id)
723 print "\n --- Local Operations --- \n"
724
725 #######################################################
726 fillet1 = LocalOp.MakeFilletAll(box1, 7)
727 if LocalOp.IsDone() == 0:
728     print "MakeFilletAll(box1, 7) NOT DONE : ", LocalOp.GetErrorCode()
729 else:
730     if fillet1 is None:
731         print "MakeFilletAll(box1, 7) returned null : ", LocalOp.GetErrorCode()
732     else:
733         fillet1.SetName("Fillet1: MakeFilletAll(box1, 7)")
734         print fillet1.GetName(), " : ", LocalOp.GetErrorCode()