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