]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOM_SWIG/batchmode_geompy.py
Salome HOME
2a5ffb0225f5bd7e12117ffa1d1f76aa05ffaebf
[modules/geom.git] / src / GEOM_SWIG / batchmode_geompy.py
1 #  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
2 #
3 #  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 #  This library is free software; you can redistribute it and/or
7 #  modify it under the terms of the GNU Lesser General Public
8 #  License as published by the Free Software Foundation; either
9 #  version 2.1 of the License.
10 #
11 #  This library is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public
17 #  License along with this library; if not, write to the Free Software
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 #  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 #
22 #
23 #
24 #  File   : geompy.py
25 #  Author : Paul RASCLE, EDF
26 #  Module : GEOM
27 #  $Header$
28
29 from batchmode_salome import *
30
31 geom = lcc.FindOrLoadComponent("FactoryServer", "GEOM")
32 myBuilder = myStudy.NewBuilder()
33
34 father = myStudy.FindComponent("GEOM")
35 if father is None:
36         father = myBuilder.NewComponent("GEOM")
37         A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName")
38         FName = A1._narrow(SALOMEDS.AttributeName)
39         FName.SetValue("Geometry")
40         A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap")
41         aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
42         aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
43         myBuilder.DefineComponentInstance(father,geom)
44
45 # -----------------------------------------------------------------------------
46 # add To Study
47 # -----------------------------------------------------------------------------
48
49 def SubShapeName(aSubObj, aMainObj):
50     name = "SubShape"
51     print name
52     return name
53
54 # -----------------------------------------------------------------------------
55 # The code below is common with geompy.py
56 # -----------------------------------------------------------------------------
57
58 def addToStudy(aShape, aName):
59     try:
60         aSObject = geom.AddInStudy(myStudy, aShape, aName, None)
61     except:
62         print "addToStudy() failed"
63         return ""
64     return aShape.GetStudyEntry()
65
66 def addToStudyInFather(aFather, aShape, aName):
67     try:
68 #        myBuilder.NewCommand()
69         aSObject = geom.AddInStudy(myStudy, aShape, aName, aFather)
70 #        myBuilder.CommitCommand()
71     except:
72         print "addToStudyInFather() failed"
73         return ""
74     return aShape.GetStudyEntry()
75
76 # -----------------------------------------------------------------------------
77 # enumeration ShapeType as a dictionary
78 # -----------------------------------------------------------------------------
79
80 ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
81
82 # -----------------------------------------------------------------------------
83 # Get Operations Interfaces
84 # -----------------------------------------------------------------------------
85
86 BasicOp  = geom.GetIBasicOperations    (myStudyId)
87 CurvesOp = geom.GetICurvesOperations   (myStudyId)
88 PrimOp   = geom.GetI3DPrimOperations   (myStudyId)
89 ShapesOp = geom.GetIShapesOperations   (myStudyId)
90 HealOp   = geom.GetIHealingOperations  (myStudyId)
91 InsertOp = geom.GetIInsertOperations   (myStudyId)
92 BoolOp   = geom.GetIBooleanOperations  (myStudyId)
93 TrsfOp   = geom.GetITransformOperations(myStudyId)
94 LocalOp  = geom.GetILocalOperations    (myStudyId)
95 MeasuOp  = geom.GetIMeasureOperations  (myStudyId)
96 BlocksOp = geom.GetIBlocksOperations   (myStudyId)
97 GroupOp  = geom.GetIGroupOperations   (myStudyId)
98
99 # -----------------------------------------------------------------------------
100 # Basic primitives
101 # -----------------------------------------------------------------------------
102
103 def MakeVertex(x,y,z):
104     anObj = BasicOp.MakePointXYZ(x,y,z)
105     if BasicOp.IsDone() == 0:
106       print "MakePointXYZ : ", BasicOp.GetErrorCode()
107     return anObj
108
109 def MakeVertexWithRef(vertex,x,y,z):
110     anObj = BasicOp.MakePointWithReference(vertex,x,y,z)
111     if BasicOp.IsDone() == 0:
112       print "MakePointWithReference : ", BasicOp.GetErrorCode()
113     return anObj
114
115 def MakeVertexOnCurve(curve,par):
116     anObj = BasicOp.MakePointOnCurve(curve,par)
117     if BasicOp.IsDone() == 0:
118       print "MakePointOnCurve : ", BasicOp.GetErrorCode()
119     return anObj
120
121 def MakeVectorDXDYDZ(dx,dy,dz):
122     anObj = BasicOp.MakeVectorDXDYDZ(dx,dy,dz)
123     if BasicOp.IsDone() == 0:
124       print "MakeVectorDXDYDZ : ", BasicOp.GetErrorCode()
125     return anObj
126
127 def MakeVector(p1,p2):
128     anObj = BasicOp.MakeVectorTwoPnt(p1, p2)
129     if BasicOp.IsDone() == 0:
130       print "MakeVectorTwoPnt : ", BasicOp.GetErrorCode()
131     return anObj
132
133 def MakeLine(p1, p2):
134     anObj = BasicOp.MakeLineTwoPnt(p1,p2)
135     if BasicOp.IsDone() == 0:
136       print "MakeLineTwoPnt : ", BasicOp.GetErrorCode()
137     return anObj
138
139 def MakePlane(p1,v1,trimsize):
140     anObj = BasicOp.MakePlanePntVec(p1,v1,trimsize)
141     if BasicOp.IsDone() == 0:
142       print "MakePlanePntVec : ", BasicOp.GetErrorCode()
143     return anObj
144
145 def MakePlaneThreePnt(p1,p2,p3,trimsize):
146     anObj = BasicOp.MakePlaneThreePnt(p1,p2,p3,trimsize)
147     if BasicOp.IsDone() == 0:
148       print "MakePlaneThreePnt : ", BasicOp.GetErrorCode()
149     return anObj
150
151 def MakePlaneFace(face,trimsize):
152     anObj = BasicOp.MakePlaneFace(face,trimsize)
153     if BasicOp.IsDone() == 0:
154       print "MakePlaneFace : ", BasicOp.GetErrorCode()
155     return anObj
156
157 def MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
158     anObj = BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
159     if BasicOp.IsDone() == 0:
160       print "MakeMarker : ", BasicOp.GetErrorCode()
161     return anObj
162
163 # -----------------------------------------------------------------------------
164 # Curves
165 # -----------------------------------------------------------------------------
166
167 def MakeArc(p1,p2,p3):
168     anObj = CurvesOp.MakeArc(p1,p2,p3)
169     if CurvesOp.IsDone() == 0:
170       print "MakeArc : ", CurvesOp.GetErrorCode()
171     return anObj
172
173 def MakeCircle(p1,v1,radius):
174     anObj = CurvesOp.MakeCirclePntVecR(p1,v1,radius)
175     if CurvesOp.IsDone() == 0:
176       print "MakeCirclePntVecR : ", CurvesOp.GetErrorCode()
177     return anObj
178
179 def MakeCircleThreePnt(p1,p2,p3):
180     anObj = CurvesOp.MakeCircleThreePnt(p1,p2,p3)
181     if CurvesOp.IsDone() == 0:
182       print "MakeCircleThreePnt : ", CurvesOp.GetErrorCode()
183     return anObj
184
185 def MakeEllipse(p1,v1,radiusMaj,radiusMin):
186     anObj = CurvesOp.MakeEllipse(p1,v1,radiusMaj, radiusMin)
187     if CurvesOp.IsDone() == 0:
188       print "MakeEllipse : ", CurvesOp.GetErrorCode()
189     return anObj
190
191 def MakePolyline(ListShape):
192     anObj = CurvesOp.MakePolyline(ListShape)
193     if CurvesOp.IsDone() == 0:
194       print "MakePolyline : ", CurvesOp.GetErrorCode()
195     return anObj
196
197 def MakeBezier(ListShape):
198     anObj = CurvesOp.MakeSplineBezier(ListShape)
199     if CurvesOp.IsDone() == 0:
200       print "MakeSplineBezier : ", CurvesOp.GetErrorCode()
201     return anObj
202
203 def MakeInterpol(ListShape):
204     anObj = CurvesOp.MakeSplineInterpolation(ListShape)
205     if CurvesOp.IsDone() == 0:
206       print "MakeSplineInterpolation : ", CurvesOp.GetErrorCode()
207     return anObj
208
209 def MakeSketcher(Cmd, WPL):
210     anObj = CurvesOp.MakeSketcher(Cmd, WPL)
211     if CurvesOp.IsDone() == 0:
212       print "MakeSketcher : ", CurvesOp.GetErrorCode()
213     return anObj
214
215 # -----------------------------------------------------------------------------
216 # Create 3D Primitives
217 # -----------------------------------------------------------------------------
218
219 def MakeBox(x1,y1,z1,x2,y2,z2):
220     pnt1 = MakeVertex(x1,y1,z1)
221     pnt2 = MakeVertex(x2,y2,z2)
222     return MakeBoxTwoPnt(pnt1,pnt2)
223
224 def MakeBoxDXDYDZ(dx,dy,dz):
225     anObj = PrimOp.MakeBoxDXDYDZ(dx,dy,dz)
226     if PrimOp.IsDone() == 0:
227       print "MakeBoxDXDYDZ : ", PrimOp.GetErrorCode()
228     return anObj
229
230 def MakeBoxTwoPnt(point1, point2):
231     anObj = PrimOp.MakeBoxTwoPnt(point1, point2)
232     if PrimOp.IsDone() == 0:
233       print "MakeBoxTwoPnt : ", PrimOp.GetErrorCode()
234     return anObj
235
236 def MakeCylinder(p1,v1,radius,height):
237     anObj = PrimOp.MakeCylinderPntVecRH(p1,v1,radius,height)
238     if PrimOp.IsDone() == 0:
239       print "MakeCylinderPntVecRH : ", PrimOp.GetErrorCode()
240     return anObj
241
242 def MakeCylinderRH(radius,height):
243     anObj = PrimOp.MakeCylinderRH(radius,height)
244     if PrimOp.IsDone() == 0:
245       print "MakeCylinderRH : ", PrimOp.GetErrorCode()
246     return anObj
247
248 def MakeSphere(point,radius):
249     anObj = PrimOp.MakeSpherePntR(point,radius)
250     if PrimOp.IsDone() == 0:
251       print "MakeSpherePntR : ", PrimOp.GetErrorCode()
252     return anObj
253
254 def MakeSphereR(radius):
255     anObj = PrimOp.MakeSphereR(radius)
256     if PrimOp.IsDone() == 0:
257       print "MakeSphereR : ", PrimOp.GetErrorCode()
258     return anObj
259
260 def MakeCone(p1,v1,radius1,radius2,height):
261     anObj = PrimOp.MakeConePntVecR1R2H(p1,v1,radius1,radius2,height)
262     if PrimOp.IsDone() == 0:
263       print "MakeConePntVecR1R2H : ", PrimOp.GetErrorCode()
264     return anObj
265
266 def MakeConeR1R2H(radius1,radius2,height):
267     anObj = PrimOp.MakeConeR1R2H(radius1,radius2,height)
268     if PrimOp.IsDone() == 0:
269       print "MakeConeR1R2H : ", PrimOp.GetErrorCode()
270     return anObj
271
272 def MakeTorus(p1,v1,major_radius,minor_radius):
273     anObj = PrimOp.MakeTorusPntVecRR(p1,v1,major_radius,minor_radius)
274     if PrimOp.IsDone() == 0:
275       print "MakeTorusPntVecRR : ", PrimOp.GetErrorCode()
276     return anObj
277
278 def MakeTorusRR(major_radius,minor_radius):
279     anObj = PrimOp.MakeTorusRR(major_radius,minor_radius)
280     if PrimOp.IsDone() == 0:
281       print "MakeTorusRR : ", PrimOp.GetErrorCode()
282     return anObj
283
284 def MakePrism(baseShape,vector,height):
285     anObj = PrimOp.MakePrismVecH(baseShape,vector,height)
286     if PrimOp.IsDone() == 0:
287       print "MakePrismVecH : ", PrimOp.GetErrorCode()
288     return anObj
289
290 def MakePrismTwoPnt(baseShape,point1,point2):
291     anObj = PrimOp.MakePrismTwoPnt(baseShape,point1,point2)
292     if PrimOp.IsDone() == 0:
293       print "MakePrismTwoPnt : ", PrimOp.GetErrorCode()
294     return anObj
295
296 def MakePipe(baseShape,pathShape):
297     anObj = PrimOp.MakePipe(baseShape,pathShape)
298     if PrimOp.IsDone() == 0:
299       print "MakePipe : ", PrimOp.GetErrorCode()
300     return anObj
301
302 def MakeRevolution(aShape,axis,angle):
303     anObj = PrimOp.MakeRevolutionAxisAngle(aShape,axis,angle)
304     if PrimOp.IsDone() == 0:
305       print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode()
306     return anObj
307
308 # -----------------------------------------------------------------------------
309 # Create base shapes
310 # -----------------------------------------------------------------------------
311
312 def MakeEdge(p1,p2):
313     anObj = ShapesOp.MakeEdge(p1,p2)
314     if ShapesOp.IsDone() == 0:
315       print "MakeEdge : ", ShapesOp.GetErrorCode()
316     return anObj
317
318 def MakeWire(ListShape):
319     anObj = ShapesOp.MakeWire(ListShape)
320     if ShapesOp.IsDone() == 0:
321       print "MakeWire : ", ShapesOp.GetErrorCode()
322     return anObj
323
324 def MakeFace(aShapeWire,WantPlanarFace):
325     anObj = ShapesOp.MakeFace(aShapeWire,WantPlanarFace)
326     if ShapesOp.IsDone() == 0:
327       print "MakeFace : ", ShapesOp.GetErrorCode()
328     return anObj
329
330 def MakeFaceWires(ListWires,WantPlanarFace):
331     anObj = ShapesOp.MakeFaceWires(ListWires,WantPlanarFace)
332     if ShapesOp.IsDone() == 0:
333       print "MakeFaceWires : ", ShapesOp.GetErrorCode()
334     return anObj
335
336 def MakeShell(ListOfShapes):
337     anObj = ShapesOp.MakeShell(ListOfShapes)
338     if ShapesOp.IsDone() == 0:
339         print "MakeShell : ", ShapesOp.GetErrorCode()
340     return anObj
341
342 def MakeSolid(ListOfShells):
343     anObj = ShapesOp.MakeSolidShells(ListOfShells)
344     if ShapesOp.IsDone() == 0:
345         print "MakeSolid : ", ShapesOp.GetErrorCode()
346     return anObj
347
348 def MakeCompound(ListShape):
349     anObj = ShapesOp.MakeCompound(ListShape)
350     if ShapesOp.IsDone() == 0:
351       print "MakeCompound : ", ShapesOp.GetErrorCode()
352     return anObj
353
354 def ChangeOrientation(Shape):
355     anObj = ShapesOp.ChangeOrientation(Shape)
356     if ShapesOp.IsDone() == 0:
357       print "ChangeOrientation : ", ShapesOp.GetErrorCode()
358     return anObj
359
360 # -----------------------------------------------------------------------------
361 # Decompose objects
362 # -----------------------------------------------------------------------------
363
364 def SubShape(aShape,ListOfId):
365     anObj = geom.AddSubShape(aShape,ListOfId)
366     return anObj
367
368 def SubShapeAll(aShape,type):
369     ListObj = ShapesOp.MakeExplode(aShape,type,0)
370     if ShapesOp.IsDone() == 0:
371       print "MakeExplode : ", ShapesOp.GetErrorCode()
372     return ListObj
373
374 def SubShapeAllSorted(aShape,type):
375     ListObj = ShapesOp.MakeExplode(aShape,type,1)
376     if ShapesOp.IsDone() == 0:
377       print "MakeExplode : ", ShapesOp.GetErrorCode()
378     return ListObj
379
380 def GetSubShapeID(aShape, aSubShape):
381     return LocalOp.GetSubShapeIndex(aShape, aSubShape)
382
383 # -----------------------------------------------------------------------------
384 # Healing operations
385 # -----------------------------------------------------------------------------
386
387 def ProcessShape(Shape, Operators, Parameters, Values):
388     anObj = HealOp.ProcessShape(Shape, Operators, Parameters, Values)
389     if HealOp.IsDone() == 0:
390         print "ProcessShape : ", HealOp.GetErrorCode()
391     return anObj
392
393 def SuppressFaces(aShape,ListOfId):
394     anObj = HealOp.SuppressFaces(aShape,ListOfId)
395     if HealOp.IsDone() == 0:
396       print "SuppressFaces : ", HealOp.GetErrorCode()
397     return anObj
398
399 def MakeSewing(ListShape,precision):
400     comp = MakeCompound(ListShape)
401     anObj = Sew(comp,precision)
402     return anObj
403
404 def Sew(aShape,precision):
405     anObj = HealOp.Sew(aShape,precision)
406     if HealOp.IsDone() == 0:
407       print "Sew : ", HealOp.GetErrorCode()
408     return anObj
409
410 def SuppressInternalWires(aShape, Wires):
411     anObj = HealOp.RemoveIntWires(aShape, Wires)
412     if HealOp.IsDone() == 0:
413       print "SuppressInternalWires : ", HealOp.GetErrorCode()
414     return anObj
415
416 def SuppressHoles(aShape, ListOfId):
417     anObj = HealOp.FillHoles(aShape,ListOfId)
418     if HealOp.IsDone() == 0:
419       print "SuppressHoles : ", HealOp.GetErrorCode()
420     return anObj
421
422 def CloseContour(aShape, Wires, IsCommonVertex):
423     anObj = HealOp.CloseContour(aShape, Wires, IsCommonVertex)
424     if HealOp.IsDone() == 0:
425       print "CloseContour : ", HealOp.GetErrorCode()
426     return anObj
427
428 def DivideEdge(aShape, EdgeID, Value, IsByParameter):
429     anObj = HealOp.DivideEdge(aShape, EdgeID, Value, IsByParameter)
430     if HealOp.IsDone() == 0:
431       print "DivideEdge : ", HealOp.GetErrorCode()
432     return anObj
433
434 def GetFreeBoundary(Shape):
435     anObj = HealOp.GetFreeBoundary(Shape)
436     if HealOp.IsDone() == 0:
437       print "GetFreeBoundaries : ", HealOp.GetErrorCode()
438     return anObj
439
440 # -----------------------------------------------------------------------------
441 # Create advanced objects
442 # -----------------------------------------------------------------------------
443
444 def MakeCopy(aShape):
445     anObj = InsertOp.MakeCopy(aShape)
446     if InsertOp.IsDone() == 0:
447       print "MakeCopy : ", InsertOp.GetErrorCode()
448     return anObj
449
450 def MakeFilling(aShape,mindeg,maxdeg,tol2d,tol3d,nbiter):
451     anObj = PrimOp.MakeFilling(aShape,mindeg,maxdeg,tol2d,tol3d,nbiter)
452     if PrimOp.IsDone() == 0:
453       print "MakeFilling : ", PrimOp.GetErrorCode()
454     return anObj
455
456 def MakeGlueFaces(aShape,aTolerance):
457     anObj = ShapesOp.MakeGlueFaces(aShape,aTolerance)
458     if ShapesOp.IsDone() == 0:
459       print "MakeGlueFaces : ", ShapesOp.GetErrorCode()
460     return anObj
461
462 # -----------------------------------------------------------------------------
463 # Boolean (Common, Cut, Fuse, Section)
464 # -----------------------------------------------------------------------------
465
466 def MakeBoolean(shape1,shape2,operation):
467     anObj = BoolOp.MakeBoolean(shape1,shape2,operation)
468     if BoolOp.IsDone() == 0:
469       print "MakeBoolean : ", BoolOp.GetErrorCode()
470     return anObj
471
472 def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
473                   Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
474     anObj = BoolOp.MakePartition(ListShapes, ListTools,
475                                  ListKeepInside, ListRemoveInside,
476                                  Limit, RemoveWebs, ListMaterials);
477     if BoolOp.IsDone() == 0:
478       print "MakePartition : ", BoolOp.GetErrorCode()
479     return anObj
480
481 # -----------------------------------------------------------------------------
482 # Transform objects
483 # -----------------------------------------------------------------------------
484
485 def MakeTranslationTwoPoints(aShape,point1,point2):
486     anObj = TrsfOp.TranslateTwoPointsCopy(aShape,point1,point2)
487     if TrsfOp.IsDone() == 0:
488       print "TranslateTwoPointsCopy : ", TrsfOp.GetErrorCode()
489     return anObj
490
491 def MakeTranslation(aShape,dx,dy,dz):
492     anObj = TrsfOp.TranslateDXDYDZCopy(aShape,dx,dy,dz)
493     if TrsfOp.IsDone() == 0:
494       print "TranslateDXDYDZCopy : ", TrsfOp.GetErrorCode()
495     return anObj
496
497 def MakeRotation(aShape,axis,angle):
498     anObj = TrsfOp.RotateCopy(aShape,axis,angle)
499     if TrsfOp.IsDone() == 0:
500       print "RotateCopy : ", TrsfOp.GetErrorCode()
501     return anObj
502
503 def MakeScaleTransform(aShape,theCenterofScale,factor):
504     anObj = TrsfOp.ScaleShapeCopy(aShape,theCenterofScale,factor)
505     if TrsfOp.IsDone() == 0:
506       print "ScaleShapeCopy : ", TrsfOp.GetErrorCode()
507     return anObj
508
509 def MakeMirrorByPlane(aShape,aPlane):
510     anObj = TrsfOp.MirrorPlaneCopy(aShape,aPlane)
511     if TrsfOp.IsDone() == 0:
512       print "MirrorPlaneCopy : ", TrsfOp.GetErrorCode()
513     return anObj
514
515 def MakePosition(aShape,theStartLCS,theEndLCS):
516     anObj = TrsfOp.PositionShapeCopy(aShape,theStartLCS,theEndLCS)
517     if TrsfOp.IsDone() == 0:
518       print "PositionShapeCopy : ", TrsfOp.GetErrorCode()
519     return anObj
520
521 def MakeOffset(aShape, anOffset):
522     anObj = TrsfOp.OffsetShapeCopy(aShape, anOffset)
523     if TrsfOp.IsDone() == 0:
524       print "OffsetShapeCopy : ", TrsfOp.GetErrorCode()
525     return anObj
526
527 # -----------------------------------------------------------------------------
528 # Patterns
529 # -----------------------------------------------------------------------------
530
531 def MakeMultiTranslation1D(aShape,aDir,aStep,aNbTimes):
532     anObj = TrsfOp.MultiTranslate1D(aShape,aDir,aStep,aNbTimes)
533     if TrsfOp.IsDone() == 0:
534       print "MultiTranslate1D : ", TrsfOp.GetErrorCode()
535     return anObj
536
537 def MakeMultiTranslation2D(aShape,d1,step1,nbtimes1,d2,step2,nbtimes2):
538     anObj = TrsfOp.MultiTranslate2D(aShape,d1,step1,nbtimes1,d2,step2,nbtimes2)
539     if TrsfOp.IsDone() == 0:
540       print "MultiTranslate2D : ", TrsfOp.GetErrorCode()
541     return anObj
542
543 def MakeMultiRotation1D(aShape,aVec,aNbTimes):
544     anObj = TrsfOp.MultiRotate1D(aShape,aVec,aNbTimes)
545     if TrsfOp.IsDone() == 0:
546       print "MultiRotate1D : ", TrsfOp.GetErrorCode()
547     return anObj
548
549 def MakeMultiRotation2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2):
550     anObj = TrsfOp.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
551     if TrsfOp.IsDone() == 0:
552       print "MultiRotate2D : ", TrsfOp.GetErrorCode()
553     return anObj
554
555 # -----------------------------------------------------------------------------
556 # Local operations
557 # -----------------------------------------------------------------------------
558
559 def MakeFilletAll(aShape,radius):
560     anObj = LocalOp.MakeFilletAll(aShape,radius)
561     if LocalOp.IsDone() == 0:
562       print "MakeFilletAll : ", LocalOp.GetErrorCode()
563     return anObj
564
565 def MakeFillet(aShape,radius,aShapeType,ListShape):
566     anObj = None
567     if aShapeType == ShapeType["EDGE"]:
568         anObj = LocalOp.MakeFilletEdges(aShape,radius,ListShape)
569     else:
570         anObj = LocalOp.MakeFilletFaces(aShape,radius,ListShape)
571     if LocalOp.IsDone() == 0:
572       print "MakeFillet : ", LocalOp.GetErrorCode()
573     return anObj
574
575 def MakeChamferAll(aShape,d):
576     anObj = LocalOp.MakeChamferAll(aShape,d)
577     if LocalOp.IsDone() == 0:
578       print "MakeChamferAll : ", LocalOp.GetErrorCode()
579     return anObj
580
581 def MakeChamferEdge(aShape,d1,d2,face1,face2):
582     anObj = LocalOp.MakeChamferEdge(aShape,d1,d2,face1,face2)
583     if LocalOp.IsDone() == 0:
584       print "MakeChamferEdge : ", LocalOp.GetErrorCode()
585     return anObj
586
587 def MakeChamferFaces(aShape,d1,d2,ListShape):
588     anObj = LocalOp.MakeChamferFaces(aShape,d1,d2,ListShape)
589     if LocalOp.IsDone() == 0:
590       print "MakeChamferFaces : ", LocalOp.GetErrorCode()
591     return anObj
592
593 def Archimede(aShape,weight,WaterDensity,MeshingDeflection):
594     anObj = LocalOp.MakeArchimede(aShape,weight,WaterDensity,MeshingDeflection)
595     if LocalOp.IsDone() == 0:
596       print "MakeArchimede : ", LocalOp.GetErrorCode()
597     return anObj
598
599 def MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes):
600     anObj = BlocksOp.MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes)
601     if BlocksOp.IsDone() == 0:
602       print "MakeMultiTransformation1D : ", BlocksOp.GetErrorCode()
603     return anObj
604
605 def MakeMultiTransformation2D(Block, DirFaceID1U, DirFaceID2U, NbTimesU, DirFaceID1V, DirFaceID2V, NbTimesV):
606     anObj = BlocksOp.MakeMultiTransformation2D(Block, DirFaceID1U, DirFaceID2U, NbTimesU, DirFaceID1V, DirFaceID2V, NbTimesV)
607     if BlocksOp.IsDone() == 0:
608       print "MakeMultiTransformation2D : ", BlocksOp.GetErrorCode()
609     return anObj
610
611 def MakeBlockExplode(Compound, MinNbFaces, MaxNbFaces):
612     aList = BlocksOp.ExplodeCompoundOfBlocks(Compound, MinNbFaces, MaxNbFaces)
613     if BlocksOp.IsDone() == 0:
614       print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
615     return aList
616
617 # -----------------------------------------------------------------------------
618 # Information objects
619 # -----------------------------------------------------------------------------
620
621 def PointCoordinates(Point):
622     aTuple = MeasuOp.PointCoordinates(Point)
623     if MeasuOp.IsDone() == 0:
624       print "PointCoordinates : ", MeasuOp.GetErrorCode()
625     return aTuple
626
627 def BasicProperties(Shape):
628     aTuple = MeasuOp.GetBasicProperties(Shape)
629     if MeasuOp.IsDone() == 0:
630       print "BasicProperties : ", MeasuOp.GetErrorCode()
631     return aTuple
632
633 def BoundingBox(Shape):
634     aTuple = MeasuOp.GetBoundingBox(Shape)
635     if MeasuOp.IsDone() == 0:
636       print "BoundingBox : ", MeasuOp.GetErrorCode()
637     return aTuple
638
639 def Inertia(Shape):
640     aTuple = MeasuOp.GetInertia(Shape)
641     if MeasuOp.IsDone() == 0:
642       print "Inertia : ", MeasuOp.GetErrorCode()
643     return aTuple
644
645 def MinDistance(Shape1, Shape2):
646     aTuple = MeasuOp.GetMinDistance(Shape1, Shape2)
647     if MeasuOp.IsDone() == 0:
648       print "MinDistance : ", MeasuOp.GetErrorCode()
649     return aTuple[0]
650
651 def Tolerance(Shape):
652     aTuple = MeasuOp.GetTolerance(Shape)
653     if MeasuOp.IsDone() == 0:
654       print "Tolerance : ", MeasuOp.GetErrorCode()
655     return aTuple
656
657 def WhatIs(Shape):
658     aDescr = MeasuOp.WhatIs(Shape)
659     if MeasuOp.IsDone() == 0:
660       print "WhatIs : ", MeasuOp.GetErrorCode()
661     return aDescr
662
663 def MakeCDG(aShape):
664     anObj = MeasuOp.GetCentreOfMass(aShape)
665     if MeasuOp.IsDone() == 0:
666       print "GetCentreOfMass : ", MeasuOp.GetErrorCode()
667     return anObj
668
669 def CheckShape(aShape):
670     (IsValid, Status) = MeasuOp.CheckShape(aShape)
671     if MeasuOp.IsDone() == 0:
672       print "CheckShape : ", MeasuOp.GetErrorCode()
673     else:
674       if IsValid == 0:
675         print Status
676     return IsValid
677
678 # -----------------------------------------------------------------------------
679 # Import/Export objects
680 # -----------------------------------------------------------------------------
681
682 def Import(filename, formatname):
683     anObj = InsertOp.Import(filename, formatname)
684     if InsertOp.IsDone() == 0:
685       print "Import : ", InsertOp.GetErrorCode()
686     return anObj
687
688 def Export(aShape, filename, formatname):
689     InsertOp.Export(aShape, filename, formatname)
690     if InsertOp.IsDone() == 0:
691       print "Export : ", InsertOp.GetErrorCode()
692
693 # -----------------------------------------------------------------------------
694 # Block operations
695 # -----------------------------------------------------------------------------
696
697 def MakeQuadFace(E1, E2, E3, E4):
698     anObj = BlocksOp.MakeQuadFaceFourEdges(E1, E2, E3, E4)
699     if BlocksOp.IsDone() == 0:
700       print "MakeQuadFace : ", BlocksOp.GetErrorCode()
701     return anObj
702
703 def MakeQuadFaceTwoEdges(E1, E2):
704     anObj = BlocksOp.MakeQuadFaceTwoEdges(E1, E2)
705     if BlocksOp.IsDone() == 0:
706       print "MakeQuadFaceEdge : ", BlocksOp.GetErrorCode()
707     return anObj
708
709 def MakeQuadFaceVertices(V1, V2, V3, V4):
710     anObj = BlocksOp.MakeQuadFaceFourVertices(V1, V2, V3, V4)
711     if BlocksOp.IsDone() == 0:
712       print "MakeQuadFaceVertex : ", BlocksOp.GetErrorCode()
713     return anObj
714
715 def MakeHexaSolid(F1, F2, F3, F4, F5, F6):
716     anObj = BlocksOp.MakeHexaSolidSixFaces(F1, F2, F3, F4, F5, F6)
717     if BlocksOp.IsDone() == 0:
718       print "MakeHexaSolid : ", BlocksOp.GetErrorCode()
719     return anObj
720
721 def MakeHexaSolidTwoFaces(F1, F2):
722     anObj = BlocksOp.MakeHexaSolidTwoFaces(F1, F2)
723     if BlocksOp.IsDone() == 0:
724       print "MakeHexaSolidTwoFace : ", BlocksOp.GetErrorCode()
725     return anObj
726
727 # -----------------------------------------------------------------------------
728 # Group operations
729 # -----------------------------------------------------------------------------
730
731 def CreateGroup(MainShape, ShapeType):
732     anObj = GroupOp.CreateGroup(MainShape, ShapeType)
733     if GroupOp.IsDone() == 0:
734        print "CreateGroup : ", GroupOp.GetErrorCode()
735     return anObj
736
737 def AddObject(Group, SubShapeID):
738     anObj = GroupOp.AddObject(Group, SubShapeID)
739     if GroupOp.IsDone() == 0:
740       print "AddObject : ", GroupOp.GetErrorCode()
741     return anObj
742
743 def RemoveObject(Group, SubShapeID):
744     anObj = GroupOp.RemoveObject(Group, SubShapeID)
745     if GroupOp.IsDone() == 0:
746       print "RemoveObject : ", GroupOp.GetErrorCode()
747     return anObj
748
749 def GetObjectIDs(Group):
750     anObj = GroupOp.GetObjects(Group)
751     if GroupOp.IsDone() == 0:
752       print "GetObjectIDs : ", GroupOp.GetErrorCode()
753     return anObj