1 from batchmode_salome import *
5 geom = lcc.FindOrLoadComponent("FactoryServer", "GEOM")
6 myBuilder = myStudy.NewBuilder()
8 id = myStudy._get_StudyId()
10 #######################################################
12 #######################################################
14 BasicOp = geom.GetIBasicOperations(id)
15 print "\n --- Basic Operations --- \n"
17 #######################################################
18 point1 = BasicOp.MakePointXYZ(0, 0, 0)
19 if BasicOp.IsDone() == 0:
20 print "MakePointXYZ(0, 0, 0) NOT DONE : ", BasicOp.GetErrorCode()
23 print "MakePointXYZ(0, 0, 0) returned null : ", BasicOp.GetErrorCode()
25 point1.SetName("Point1: MakePointXYZ(0, 0, 0)")
26 print point1.GetName(), " : ", BasicOp.GetErrorCode()
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()
34 print "MakePointWithReference(point1, 40, 40, 52) returned null : ", BasicOp.GetErrorCode()
36 point2.SetName("Point2: MakePointWithReference(point1, 40, 40, 52)")
37 print point2.GetName(), " : ", BasicOp.GetErrorCode()
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()
45 print "MakePointWithReference(point2, -20, -20, 0) returned null : ", BasicOp.GetErrorCode()
47 point3.SetName("Point3: MakePointWithReference(point2, -20, -20, 0)")
48 print point3.GetName(), " : ", BasicOp.GetErrorCode()
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()
56 print "MakePointWithReference(point3, 40, 0, -3.5) returned null : ", BasicOp.GetErrorCode()
58 point5.SetName("Point5: MakePointWithReference(point3, 40, 0, -3.5)")
59 print point5.GetName(), " : ", BasicOp.GetErrorCode()
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()
67 print "MakePointWithReference(point5, 0, 0, -9) returned null : ", BasicOp.GetErrorCode()
69 point6.SetName("Point6: MakePointWithReference(point5, 0, 0, -9)")
70 print point6.GetName(), " : ", BasicOp.GetErrorCode()
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()
78 print "MakePointWithReference(point2, 0, 0, -52) returned null : ", BasicOp.GetErrorCode()
80 point7.SetName("Point7: MakePointWithReference(point2, 0, 0, -52)")
81 print point7.GetName(), " : ", BasicOp.GetErrorCode()
83 #######################################################
84 vector1 = BasicOp.MakeVectorDXDYDZ(0,0,1)
85 if BasicOp.IsDone() == 0:
86 print "MakeVectorDXDYDZ(0,0,1) NOT DONE : ", BasicOp.GetErrorCode()
89 print "MakeVectorDXDYDZ(0,0,1) returned null : ", BasicOp.GetErrorCode()
91 vector1.SetName("Vector1: MakeVectorDXDYDZ(0,0,1)")
92 print vector1.GetName(), " : ", BasicOp.GetErrorCode()
94 #######################################################
95 vector2 = BasicOp.MakeVectorTwoPnt(point2, point3)
96 if BasicOp.IsDone() == 0:
97 print "MakeVectorTwoPnt(point2, point3) NOT DONE : ", BasicOp.GetErrorCode()
100 print "MakeVectorTwoPnt(point2, point3) returned null : ", BasicOp.GetErrorCode()
102 vector2.SetName("Vector2: MakeVectorTwoPnt(point2, point3)")
103 print vector2.GetName(), " : ", BasicOp.GetErrorCode()
105 #######################################################
106 vector3 = BasicOp.MakeVectorTwoPnt(point2, point6)
107 if BasicOp.IsDone() == 0:
108 print "MakeVectorTwoPnt(point2, point6) NOT DONE : ", BasicOp.GetErrorCode()
111 print "MakeVectorTwoPnt(point2, point6) returned null : ", BasicOp.GetErrorCode()
113 vector3.SetName("Vector3: MakeVectorTwoPnt(point2, point6)")
114 print vector3.GetName(), " : ", BasicOp.GetErrorCode()
116 #######################################################
117 line1 = BasicOp.MakeLine(point7, point3)
118 if BasicOp.IsDone() == 0:
119 print "MakeLine(point7, point3) NOT DONE : ", BasicOp.GetErrorCode()
122 print "MakeLine(point7, point3) returned null : ", BasicOp.GetErrorCode()
124 line1.SetName("Line1: MakeLine(point7, point3)")
125 print line1.GetName(), " : ", BasicOp.GetErrorCode()
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()
133 print "MakePlanePntVec(point3, vector1, 20.0 * math.sqrt(2.0)) returned null : ", BasicOp.GetErrorCode()
135 plane1.SetName("Plane1: MakePlanePntVec(point3, vector1, 20.0 * math.sqrt(2.0))")
136 print plane1.GetName(), " : ", BasicOp.GetErrorCode()
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()
144 print "MakePlaneThreePnt(point1, point2, point3, 50) returned null : ", BasicOp.GetErrorCode()
146 plane2.SetName("Plane2: MakePlaneThreePnt(point1, point2, point3, 50)")
147 print plane2.GetName(), " : ", BasicOp.GetErrorCode()
149 #######################################################
150 plane3 = BasicOp.MakePlaneFace(plane2, 70)
151 if BasicOp.IsDone() == 0:
152 print "MakePlaneFace(plane2, 70) NOT DONE : ", BasicOp.GetErrorCode()
155 print "MakePlaneFace(plane2, 70) returned null : ", BasicOp.GetErrorCode()
157 plane3.SetName("Plane3: MakePlaneFace(plane2, 70)")
158 print plane3.GetName(), " : ", BasicOp.GetErrorCode()
160 #######################################################
161 ### Insert Operations
162 #######################################################
164 #InsertOp = geom.GetIInsertOperations(id)
165 #print "\n --- Insert Operations --- \n"
167 #######################################################
168 #obj3 = InsertOp.MakeCopy(obj2)
170 #######################################################
172 #######################################################
174 CurvesOp = geom.GetICurvesOperations(id)
175 print "\n --- Curves Creation --- \n"
177 #######################################################
178 circle1 = CurvesOp.MakeCirclePntVecR(point2, vector2, 13)
179 if CurvesOp.IsDone() == 0:
180 print "MakeCirclePntVecR(point2, vector2, 13) NOT DONE : ", CurvesOp.GetErrorCode()
183 print "MakeCirclePntVecR(point2, vector2, 13) returned null : ", CurvesOp.GetErrorCode()
185 circle1.SetName("Circle1: MakeCirclePntVecR(point2, vector2, 13)")
186 print circle1.GetName(), " : ", CurvesOp.GetErrorCode()
188 #######################################################
189 circle2 = CurvesOp.MakeCircleThreePnt(point1, point2, point3)
190 if CurvesOp.IsDone() == 0:
191 print "MakeCircleThreePnt(point1, point2, point3) NOT DONE : ", CurvesOp.GetErrorCode()
194 print "MakeCircleThreePnt(point1, point2, point3) returned null : ", CurvesOp.GetErrorCode()
196 circle2.SetName("Circle2: MakeCircleThreePnt(point1, point2, point3)")
197 print circle2.GetName(), " : ", CurvesOp.GetErrorCode()
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()
205 print "MakeEllipse(point2, vector2, 21, 13) returned null : ", CurvesOp.GetErrorCode()
207 ellipse1.SetName("Ellipse1: MakeEllipse(point2, vector2, 21, 13)")
208 print ellipse1.GetName(), " : ", CurvesOp.GetErrorCode()
210 #######################################################
211 arc1 = CurvesOp.MakeArc(point1, point2, point3)
212 if CurvesOp.IsDone() == 0:
213 print "MakeArc(point1, point2, point3) NOT DONE : ", CurvesOp.GetErrorCode()
216 print "MakeArc(point1, point2, point3) returned null : ", CurvesOp.GetErrorCode()
218 arc1.SetName("Arc1: MakeArc(point1, point2, point3)")
219 print arc1.GetName(), " : ", CurvesOp.GetErrorCode()
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()
227 print "MakePolyline([point1, point3, point2, point7]) returned null : ", CurvesOp.GetErrorCode()
229 poly1.SetName("Polyline1: MakePolyline([point1, point3, point2, point7])")
230 print poly1.GetName(), " : ", CurvesOp.GetErrorCode()
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()
238 print "MakeSplineBezier([point2, point3, point7, point1]) returned null : ", CurvesOp.GetErrorCode()
240 bezier1.SetName("Bezier1: MakeSplineBezier([point2, point3, point7, point1])")
241 print bezier1.GetName(), " : ", CurvesOp.GetErrorCode()
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()
249 print "MakeSplineInterpolation([point2, point7, point1, point3]) returned null : ", CurvesOp.GetErrorCode()
251 bspline1.SetName("B-Spline1: MakeSplineInterpolation([point2, point7, point1, point3])")
252 print bspline1.GetName(), " : ", CurvesOp.GetErrorCode()
254 #######################################################
255 ### 3D Primitives Creation
256 #######################################################
258 PrimOp = geom.GetI3DPrimOperations(id)
259 print "\n --- 3D Primitives Creation --- \n"
261 #######################################################
262 box1 = PrimOp.MakeBoxTwoPnt(point1, point2)
263 if PrimOp.IsDone() == 0:
264 print "MakeBoxTwoPnt(point1, point2) NOT DONE : ", PrimOp.GetErrorCode()
267 print "MakeBoxTwoPnt(point1, point2) returned null : ", PrimOp.GetErrorCode()
269 box1.SetName("Box1: MakeBoxTwoPnt(point1, point2)")
270 print box1.GetName(), " : ", PrimOp.GetErrorCode()
272 #######################################################
273 box2 = PrimOp.MakeBoxDXDYDZ(10, 20, -30)
274 if PrimOp.IsDone() == 0:
275 print "MakeBoxDXDYDZ(10, 20, -30) NOT DONE : ", PrimOp.GetErrorCode()
278 print "MakeBoxDXDYDZ(10, 20, -30) returned null : ", PrimOp.GetErrorCode()
280 box2.SetName("Box2: MakeBoxDXDYDZ(10, 20, -30)")
281 print box2.GetName(), " : ", PrimOp.GetErrorCode()
283 #######################################################
284 sphere1 = PrimOp.MakeSphereR(7)
285 if PrimOp.IsDone() == 0:
286 print "MakeSphereR(7) NOT DONE : ", PrimOp.GetErrorCode()
289 print "MakeSphereR(7) returned null : ", PrimOp.GetErrorCode()
291 sphere1.SetName("Sphere1: MakeSphereR(7)")
292 print sphere1.GetName(), " : ", PrimOp.GetErrorCode()
294 #######################################################
295 sphere2 = PrimOp.MakeSpherePntR(point5, 3.5)
296 if PrimOp.IsDone() == 0:
297 print "MakeSpherePntR(point5, 3.5) NOT DONE : ", PrimOp.GetErrorCode()
300 print "MakeSpherePntR(point5, 3.5) returned null : ", PrimOp.GetErrorCode()
302 sphere2.SetName("Sphere2: MakeSpherePntR(point5, 3.5)")
303 print sphere2.GetName(), " : ", PrimOp.GetErrorCode()
305 #######################################################
306 cylinder1 = PrimOp.MakeCylinderRH(3, 33)
307 if PrimOp.IsDone() == 0:
308 print "MakeCylinderRH(3, 33) NOT DONE : ", PrimOp.GetErrorCode()
310 if cylinder1 is None:
311 print "MakeCylinderRH(3, 33) returned null : ", PrimOp.GetErrorCode()
313 cylinder1.SetName("Cylinder1: MakeCylinderRH(3, 33)")
314 print cylinder1.GetName(), " : ", PrimOp.GetErrorCode()
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()
321 if cylinder2 is None:
322 print "MakeCylinderPntVecRH(point3, vector1, 20, 13) returned null : ", PrimOp.GetErrorCode()
324 cylinder2.SetName("Cylinder2: MakeCylinderPntVecRH(point3, vector1, 20, 13)")
325 print cylinder2.GetName(), " : ", PrimOp.GetErrorCode()
327 #######################################################
328 cone1 = PrimOp.MakeConeR1R2H(10, 3, 2)
329 if PrimOp.IsDone() == 0:
330 print "MakeConeR1R2H(10, 3, 2) NOT DONE : ", PrimOp.GetErrorCode()
333 print "MakeConeR1R2H(10, 3, 2) returned null : ", PrimOp.GetErrorCode()
335 cone1.SetName("Cone1: MakeConeR1R2H(10, 3, 2)")
336 print cone1.GetName(), " : ", PrimOp.GetErrorCode()
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()
344 print "MakeConePntVecR1R2H(point6, vector1, 3.5, 0, 9) returned null : ", PrimOp.GetErrorCode()
346 cone2.SetName("Cone2: MakeConePntVecR1R2H(point6, vector1, 3.5, 0, 9)")
347 print cone2.GetName(), " : ", PrimOp.GetErrorCode()
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()
355 print "MakeConePntVecR1R2H(point6, vector1, 3.5, 0, -9) returned null : ", PrimOp.GetErrorCode()
357 cone3.SetName("Cone3: MakeConePntVecR1R2H(point6, vector1, 3.5, 0, -9)")
358 print cone3.GetName(), " : ", PrimOp.GetErrorCode()
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()
366 print "MakeTorusPntVecRR(point7, vector2, 50, 49) returned null : ", PrimOp.GetErrorCode()
368 torus1.SetName("Torus1: MakeTorusPntVecRR(point7, vector2, 50, 49)")
369 print torus1.GetName(), " : ", PrimOp.GetErrorCode()
371 #######################################################
372 torus2 = PrimOp.MakeTorusRR(50, 49)
373 if PrimOp.IsDone() == 0:
374 print "MakeTorusRR(50, 49) NOT DONE : ", PrimOp.GetErrorCode()
377 print "MakeTorusRR(50, 49) returned null : ", PrimOp.GetErrorCode()
379 torus2.SetName("Torus2: MakeTorusRR(50, 49)")
380 print torus2.GetName(), " : ", PrimOp.GetErrorCode()
382 #######################################################
383 prism1 = PrimOp.MakePrismVecH(poly1, vector3, 10)
384 if PrimOp.IsDone() == 0:
385 print "MakePrismVecH(poly1, vector3, 10) NOT DONE : ", PrimOp.GetErrorCode()
388 print "MakePrismVecH(poly1, vector3, 10) returned null : ", PrimOp.GetErrorCode()
390 prism1.SetName("Prism1: MakePrismVecH(poly1, vector3, 10)")
391 print prism1.GetName(), " : ", PrimOp.GetErrorCode()
393 #######################################################
394 pipe1 = PrimOp.MakePipe(circle1, bspline1)
395 if PrimOp.IsDone() == 0:
396 print "MakePipe(circle1, bspline1) NOT DONE : ", PrimOp.GetErrorCode()
399 print "MakePipe(circle1, bspline1) returned null : ", PrimOp.GetErrorCode()
401 pipe1.SetName("Pipe1: MakePipe(circle1, bspline1)")
402 print pipe1.GetName(), " : ", PrimOp.GetErrorCode()
404 #######################################################
405 pipe2 = PrimOp.MakePipe(circle1, box1)
406 if PrimOp.IsDone() == 0:
407 print "MakePipe(circle1, box1) NOT DONE : ", PrimOp.GetErrorCode()
410 print "MakePipe(circle1, box1) returned null : ", PrimOp.GetErrorCode()
412 pipe2.SetName("Pipe2: MakePipe(circle1, box1)")
413 print pipe2.GetName(), " : ", PrimOp.GetErrorCode()
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()
421 print "MakeRevolutionAxisAngle(bezier1, vector3, 10*math.pi/180.0) returned null : ", PrimOp.GetErrorCode()
423 revol1.SetName("Revolution1: MakeRevolutionAxisAngle(bezier1, vector3, 10*math.pi/180.0)")
424 print revol1.GetName(), " : ", PrimOp.GetErrorCode()
426 #######################################################
428 #######################################################
430 ShapesOp = geom.GetIShapesOperations(id)
431 print "\n --- Shapes Creation --- \n"
433 #######################################################
434 edge1 = ShapesOp.MakeEdge(point1, point2)
435 if ShapesOp.IsDone() == 0:
436 print "MakeEdge(point1, point2) NOT DONE : ", ShapesOp.GetErrorCode()
439 print "MakeEdge(point1, point2) returned null : ", ShapesOp.GetErrorCode()
441 edge1.SetName("Edge1: MakeEdge(point1, point2)")
442 print edge1.GetName(), " : ", ShapesOp.GetErrorCode()
444 #######################################################
445 edge2 = ShapesOp.MakeEdge(point2, point3)
446 if ShapesOp.IsDone() == 0:
447 print "MakeEdge(point2, point3) NOT DONE : ", ShapesOp.GetErrorCode()
450 print "MakeEdge(point2, point3) returned null : ", ShapesOp.GetErrorCode()
452 edge2.SetName("Edge2: MakeEdge(point2, point3)")
453 print edge2.GetName(), " : ", ShapesOp.GetErrorCode()
455 #######################################################
456 edge3 = ShapesOp.MakeEdge(point3, point1)
457 if ShapesOp.IsDone() == 0:
458 print "MakeEdge(point3, point1) NOT DONE : ", ShapesOp.GetErrorCode()
461 print "MakeEdge(point3, point1) returned null : ", ShapesOp.GetErrorCode()
463 edge3.SetName("Edge3: MakeEdge(point3, point1)")
464 print edge3.GetName(), " : ", ShapesOp.GetErrorCode()
466 #######################################################
467 wire1 = ShapesOp.MakeWire([edge1, edge2, edge3])
468 if ShapesOp.IsDone() == 0:
469 print "MakeWire([edge1, edge2, edge3]) NOT DONE : ", ShapesOp.GetErrorCode()
472 print "MakeWire([edge1, edge2, edge3]) returned null : ", ShapesOp.GetErrorCode()
474 wire1.SetName("Wire1: MakeWire([edge1, edge2, edge3])")
475 print wire1.GetName(), " : ", ShapesOp.GetErrorCode()
477 #######################################################
478 face1 = ShapesOp.MakeFace(wire1, 1)
479 if ShapesOp.IsDone() == 0:
480 print "MakeFace(wire1, 1) NOT DONE : ", ShapesOp.GetErrorCode()
483 print "MakeFace(wire1, 1) returned null : ", ShapesOp.GetErrorCode()
485 face1.SetName("Face1: MakeFace(wire1, 1)")
486 print face1.GetName(), " : ", ShapesOp.GetErrorCode()
488 #######################################################
489 shell1 = ShapesOp.MakeShell([face1])
490 if ShapesOp.IsDone() == 0:
491 print "MakeShell([face1]) NOT DONE : ", ShapesOp.GetErrorCode()
494 print "MakeShell([face1]) returned null : ", ShapesOp.GetErrorCode()
496 shell1.SetName("Shell1: MakeShell([face1])")
497 print shell1.GetName(), " : ", ShapesOp.GetErrorCode()
499 #######################################################
500 solid1 = ShapesOp.MakeSolidShells([shell1])
501 if ShapesOp.IsDone() == 0:
502 print "MakeSolidShells([shell1]) NOT DONE : ", ShapesOp.GetErrorCode()
505 print "MakeSolidShells([shell1]) returned null : ", ShapesOp.GetErrorCode()
507 solid1.SetName("Solid1: MakeSolidShells([shell1])")
508 print solid1.GetName(), " : ", ShapesOp.GetErrorCode()
510 #######################################################
511 solid2 = ShapesOp.MakeSolidShell(shell1)
512 if ShapesOp.IsDone() == 0:
513 print "MakeSolidShell(shell1) NOT DONE : ", ShapesOp.GetErrorCode()
516 print "MakeSolidShell(shell1) returned null : ", ShapesOp.GetErrorCode()
518 solid2.SetName("Solid2: MakeSolidShell(shell1)")
519 print solid2.GetName(), " : ", ShapesOp.GetErrorCode()
521 #######################################################
522 comp1 = ShapesOp.MakeCompound([box1, sphere2, cone2])
523 if ShapesOp.IsDone() == 0:
524 print "MakeCompound([box1, sphere2, cone2]) NOT DONE : ", ShapesOp.GetErrorCode()
527 print "MakeCompound([box1, sphere2, cone2]) returned null : ", ShapesOp.GetErrorCode()
529 comp1.SetName("Compound1: MakeCompound([box1, sphere2, cone2])")
530 print comp1.GetName(), " : ", ShapesOp.GetErrorCode()
532 #######################################################
534 #######################################################
536 TrsfOp = geom.GetITransformOperations(id)
537 print "\n --- Transformations --- \n"
539 #######################################################
540 TrsfOp.TranslateTwoPoints(cone1, point1, point2)
541 if TrsfOp.IsDone() == 0:
542 print "TranslateTwoPoints(cone1, point1, point2) NOT DONE : ", TrsfOp.GetErrorCode()
544 print "TranslateTwoPoints(cone1, point1, point2) DONE : ", TrsfOp.GetErrorCode()
546 #######################################################
547 transl_cone1 = TrsfOp.TranslateTwoPointsCopy(cone1, point1, point2)
548 if TrsfOp.IsDone() == 0:
549 print "TranslateTwoPointsCopy(cone1, point1, point2) NOT DONE : ", TrsfOp.GetErrorCode()
551 if transl_cone1 is None:
552 print "TranslateTwoPointsCopy(cone1, point1, point2) returned null : ", TrsfOp.GetErrorCode()
554 transl_cone1.SetName("Copy1a: TranslateTwoPointsCopy(cone1, point1, point2)")
555 print transl_cone1.GetName(), " : ", TrsfOp.GetErrorCode()
557 #######################################################
558 TrsfOp.TranslateVector(cone1, vector2)
559 if TrsfOp.IsDone() == 0:
560 print "TranslateVector(cone1, vector2) NOT DONE : ", TrsfOp.GetErrorCode()
562 print "TranslateVector(cone1, vector2) DONE : ", TrsfOp.GetErrorCode()
564 #######################################################
565 transl_cone2 = TrsfOp.TranslateVectorCopy(cone1, vector2)
566 if TrsfOp.IsDone() == 0:
567 print "TranslateVectorCopy(cone1, vector2) NOT DONE : ", TrsfOp.GetErrorCode()
569 if transl_cone2 is None:
570 print "TranslateVectorCopy(cone1, vector2) returned null : ", TrsfOp.GetErrorCode()
572 transl_cone2.SetName("Copy1b: TranslateVectorCopy(cone1, vector2)")
573 print transl_cone2.GetName(), " : ", TrsfOp.GetErrorCode()
575 #######################################################
576 #TrsfOp.Rotate(cone1, vector2, math.pi/2.0)
577 #if TrsfOp.IsDone() == 0:
578 # print "Rotate(cone1, vector2, ) NOT DONE : ", TrsfOp.GetErrorCode()
580 # print "Rotate(cone1, vector2, ) DONE : ", TrsfOp.GetErrorCode()
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()
587 # if rotate_cone2 is None:
588 # print "RotateCopy(cone1, vector2, ) returned null : ", TrsfOp.GetErrorCode()
590 # rotate_cone2.SetName("Copy1c: RotateCopy(cone1, vector2, )")
591 # print rotate_cone2.GetName(), " : ", TrsfOp.GetErrorCode()
593 #######################################################
594 TrsfOp.MirrorPlane(arc1, plane1)
595 if TrsfOp.IsDone() == 0:
596 print "MirrorPlane(arc1, plane1) NOT DONE: ", TrsfOp.GetErrorCode()
598 print "MirrorPlane(arc1, plane1) DONE: ", TrsfOp.GetErrorCode()
600 #######################################################
601 mirror_ell1 = TrsfOp.MirrorPlaneCopy(ellipse1, plane3)
602 if TrsfOp.IsDone() == 0:
603 print "MirrorPlaneCopy(ellipse1, plane3) NOT DONE : ", TrsfOp.GetErrorCode()
605 if mirror_ell1 is None:
606 print "MirrorPlaneCopy(ellipse1, plane3) returned null : ", TrsfOp.GetErrorCode()
608 mirror_ell1.SetName("Copy4: MirrorPlaneCopy(ellipse1, plane3)")
609 print mirror_ell1.GetName(), " : ", TrsfOp.GetErrorCode()
611 #######################################################
612 TrsfOp.MirrorAxis(arc1, line1)
613 if TrsfOp.IsDone() == 0:
614 print "MirrorAxis(arc1, line1) NOT DONE : ", TrsfOp.GetErrorCode()
616 print "MirrorAxis(arc1, line1) DONE : ", TrsfOp.GetErrorCode()
618 #######################################################
619 mirror_ell1_vec3 = TrsfOp.MirrorAxisCopy(ellipse1, vector3)
620 if TrsfOp.IsDone() == 0:
621 print "MirrorAxisCopy(ellipse1, vector3) NOT DONE : ", TrsfOp.GetErrorCode()
623 if mirror_ell1_vec3 is None:
624 print "MirrorAxisCopy(ellipse1, vector3) returned null : ", TrsfOp.GetErrorCode()
626 mirror_ell1_vec3.SetName("Copy5: MirrorAxisCopy(ellipse1, vector3)")
627 print mirror_ell1_vec3.GetName(), " : ", TrsfOp.GetErrorCode()
629 #######################################################
630 TrsfOp.MirrorPoint(arc1, point7)
631 if TrsfOp.IsDone() == 0:
632 print "MirrorPoint(arc1, point7) NOT DONE : ", TrsfOp.GetErrorCode()
634 print "MirrorPoint(arc1, point7) DONE : ", TrsfOp.GetErrorCode()
636 #######################################################
637 mirror_ell1_pnt7 = TrsfOp.MirrorPointCopy(ellipse1, point7)
638 if TrsfOp.IsDone() == 0:
639 print "MirrorPointCopy(ellipse1, point7) NOT DONE : ", TrsfOp.GetErrorCode()
641 if mirror_ell1_pnt7 is None:
642 print "MirrorPointCopy(ellipse1, point7) returned null : ", TrsfOp.GetErrorCode()
644 mirror_ell1_pnt7.SetName("Copy6: MirrorPointCopy(ellipse1, point7)")
645 print mirror_ell1_pnt7.GetName(), " : ", TrsfOp.GetErrorCode()
647 #######################################################
648 TrsfOp.OffsetShape(cone1, 11)
649 if TrsfOp.IsDone() == 0:
650 print "OffsetShape(cone1, 11) NOT DONE : ", TrsfOp.GetErrorCode()
652 print "OffsetShape(cone1, 11) DONE : ", TrsfOp.GetErrorCode()
654 #######################################################
655 offset_cone2 = TrsfOp.OffsetShapeCopy(cone1, 11)
656 if TrsfOp.IsDone() == 0:
657 print "OffsetShapeCopy(cone1, 11) NOT DONE : ", TrsfOp.GetErrorCode()
659 if offset_cone2 is None:
660 print "OffsetShapeCopy(cone1, 11) returned null : ", TrsfOp.GetErrorCode()
662 offset_cone2.SetName("Copy2: OffsetShapeCopy(cone1, 11)")
663 print offset_cone2.GetName(), " : ", TrsfOp.GetErrorCode()
665 #######################################################
666 TrsfOp.ScaleShape(cylinder1, point1, 3)
667 if TrsfOp.IsDone() == 0:
668 print "ScaleShape(cylinder1, point1, 3) NOT DONE : ", TrsfOp.GetErrorCode()
670 print "ScaleShape(cylinder1, point1, 3) DONE : ", TrsfOp.GetErrorCode()
672 #######################################################
673 copy_scale1 = TrsfOp.ScaleShapeCopy(cylinder1, point1, 3)
674 if TrsfOp.IsDone() == 0:
675 print "ScaleShapeCopy(cylinder1, point1, 3) NOT DONE : ", TrsfOp.GetErrorCode()
677 if copy_scale1 is None:
678 print "ScaleShapeCopy(cylinder1, point1, 3) returned null : ", TrsfOp.GetErrorCode()
680 copy_scale1.SetName("Copy3: ScaleShapeCopy(cylinder1, point1, 3)")
681 print copy_scale1.GetName(), " : ", TrsfOp.GetErrorCode()
683 #######################################################
684 ### Boolean Operations
685 #######################################################
687 BoolOp = geom.GetIBooleanOperations(id)
688 print "\n --- Boolean Operations --- \n"
690 #######################################################
691 common1 = BoolOp.MakeBoolean(box1, sphere1, 1)
694 if BoolOp.IsDone() == 0:
695 print "MakeBoolean(box1, sphere1, 1) NOT DONE : ", BoolOp.GetErrorCode()
698 print "MakeBoolean(box1, sphere1, 1) returned null : ", BoolOp.GetErrorCode()
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")
705 #######################################################
706 #part_limit = batchmode_geompy.ShapeType["SHAPE"]
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()
712 if partition1 is None:
713 print "MakePartition([box1, sphere1], [], [], [], SHAPE, 1, [7, 7]) returned null : ", BoolOp.GetErrorCode()
715 partition1.SetName("Partition1: MakePartition([box1, sphere1], [], [], [], SHAPE, 1, [7, 7])")
716 print partition1.GetName(), " : ", BoolOp.GetErrorCode()
718 #######################################################
720 #######################################################
722 LocalOp = geom.GetILocalOperations(id)
723 print "\n --- Local Operations --- \n"
725 #######################################################
726 fillet1 = LocalOp.MakeFilletAll(box1, 7)
727 if LocalOp.IsDone() == 0:
728 print "MakeFilletAll(box1, 7) NOT DONE : ", LocalOp.GetErrorCode()
731 print "MakeFilletAll(box1, 7) returned null : ", LocalOp.GetErrorCode()
733 fillet1.SetName("Fillet1: MakeFilletAll(box1, 7)")
734 print fillet1.GetName(), " : ", LocalOp.GetErrorCode()