Salome HOME
60c341f82f34a76d7b403ff4761d67d622896948
[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 import GEOM
31
32 """
33     \namespace geompy
34     \brief Module geompy
35 """
36
37 g = lcc.FindOrLoadComponent("FactoryServer", "GEOM")
38 geom = g._narrow( GEOM.GEOM_Gen )
39 myBuilder = myStudy.NewBuilder()
40
41 father = myStudy.FindComponent("GEOM")
42 if father is None:
43         father = myBuilder.NewComponent("GEOM")
44         A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName")
45         FName = A1._narrow(SALOMEDS.AttributeName)
46         FName.SetValue("Geometry")
47         A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap")
48         aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
49         aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
50         myBuilder.DefineComponentInstance(father,geom)
51
52 gg = ImportComponentGUI("GEOM")
53
54 def SubShapeName(aSubObj, aMainObj):
55     """
56      *  Get name for sub-shape aSubObj of shape aMainObj
57
58      *  Example: see GEOM_TestAll.py
59     """
60     aSubId  = orb.object_to_string(aSubObj)
61     aMainId = orb.object_to_string(aMainObj)
62     index = gg.getIndexTopology(aSubId, aMainId)
63     name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
64     return name
65
66 def addToStudy(aShape, aName):
67     """
68      *  Publish in study aShape with name aName
69
70      *  Example: see GEOM_TestAll.py
71     """
72     try:
73         aSObject = geom.AddInStudy(myStudy, aShape, aName, None)
74     except:
75         print "addToStudy() failed"
76         return ""
77     return aShape.GetStudyEntry()
78
79 def addToStudyInFather(aFather, aShape, aName):
80     """
81      *  Publish in study aShape with name aName as sub-object of previously published aFather
82
83      *  Example: see GEOM_TestAll.py
84     """
85     try:
86         aSObject = geom.AddInStudy(myStudy, aShape, aName, aFather)
87     except:
88         print "addToStudyInFather() failed"
89         return ""
90     return aShape.GetStudyEntry()
91
92 # -----------------------------------------------------------------------------
93 # enumeration ShapeType as a dictionary
94 # -----------------------------------------------------------------------------
95
96 ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
97
98 # -----------------------------------------------------------------------------
99 # Get Operations Interfaces
100 # -----------------------------------------------------------------------------
101
102 BasicOp  = geom.GetIBasicOperations    (myStudyId)
103 CurvesOp = geom.GetICurvesOperations   (myStudyId)
104 PrimOp   = geom.GetI3DPrimOperations   (myStudyId)
105 ShapesOp = geom.GetIShapesOperations   (myStudyId)
106 HealOp   = geom.GetIHealingOperations  (myStudyId)
107 InsertOp = geom.GetIInsertOperations   (myStudyId)
108 BoolOp   = geom.GetIBooleanOperations  (myStudyId)
109 TrsfOp   = geom.GetITransformOperations(myStudyId)
110 LocalOp  = geom.GetILocalOperations    (myStudyId)
111 MeasuOp  = geom.GetIMeasureOperations  (myStudyId)
112 BlocksOp = geom.GetIBlocksOperations   (myStudyId)
113 GroupOp  = geom.GetIGroupOperations   (myStudyId)
114
115 # -----------------------------------------------------------------------------
116 # Basic primitives
117 # -----------------------------------------------------------------------------
118
119 def MakeVertex(theX, theY, theZ):
120     """
121      *  Create point by three coordinates.
122      *  \param theX The X coordinate of the point.
123      *  \param theY The Y coordinate of the point.
124      *  \param theZ The Z coordinate of the point.
125      *  \return New GEOM_Object, containing the created point.
126
127      *  Example: see GEOM_TestAll.py
128     """
129     anObj = BasicOp.MakePointXYZ(theX, theY, theZ)
130     if BasicOp.IsDone() == 0:
131       print "MakePointXYZ : ", BasicOp.GetErrorCode()
132     return anObj
133
134 def MakeVertexWithRef(theReference, theX, theY, theZ):
135     """
136      *  Create a point, distant from the referenced point
137      *  on the given distances along the coordinate axes.
138      *  \param theReference The referenced point.
139      *  \param theX Displacement from the referenced point along OX axis.
140      *  \param theY Displacement from the referenced point along OY axis.
141      *  \param theZ Displacement from the referenced point along OZ axis.
142      *  \return New GEOM_Object, containing the created point.
143
144      *  Example: see GEOM_TestAll.py
145     """
146     anObj = BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
147     if BasicOp.IsDone() == 0:
148       print "MakePointWithReference : ", BasicOp.GetErrorCode()
149     return anObj
150
151 def MakeVertexOnCurve(theRefCurve, theParameter):
152     """
153      *  Create a point, corresponding to the given parameter on the given curve.
154      *  \param theRefCurve The referenced curve.
155      *  \param theParameter Value of parameter on the referenced curve.
156      *  \return New GEOM_Object, containing the created point.
157
158      *  Example: see GEOM_TestAll.py
159     """
160     anObj = BasicOp.MakePointOnCurve(theRefCurve, theParameter)
161     if BasicOp.IsDone() == 0:
162       print "MakePointOnCurve : ", BasicOp.GetErrorCode()
163     return anObj
164
165 def MakeVectorDXDYDZ(theDX, theDY, theDZ):
166     """
167      *  Create a vector with the given components.
168      *  \param theDX X component of the vector.
169      *  \param theDY Y component of the vector.
170      *  \param theDZ Z component of the vector.
171      *  \return New GEOM_Object, containing the created vector.
172
173      *  Example: see GEOM_TestAll.py
174     """
175     anObj = BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
176     if BasicOp.IsDone() == 0:
177       print "MakeVectorDXDYDZ : ", BasicOp.GetErrorCode()
178     return anObj
179
180 def MakeVector(thePnt1, thePnt2):
181     """
182      *  Create a vector between two points.
183      *  \param thePnt1 Start point for the vector.
184      *  \param thePnt2 End point for the vector.
185      *  \return New GEOM_Object, containing the created vector.
186
187      *  Example: see GEOM_TestAll.py
188     """
189     anObj = BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
190     if BasicOp.IsDone() == 0:
191       print "MakeVectorTwoPnt : ", BasicOp.GetErrorCode()
192     return anObj
193
194 def MakeLine(thePnt, theDir):
195     """
196      *  Create a line, passing through the given point
197      *  and parrallel to the given direction
198      *  \param thePnt Point. The resulting line will pass through it.
199      *  \param theDir Direction. The resulting line will be parallel to it.
200      *  \return New GEOM_Object, containing the created line.
201
202      *  Example: see GEOM_TestAll.py
203     """
204     anObj = BasicOp.MakeLine(thePnt, theDir)
205     if BasicOp.IsDone() == 0:
206       print "MakeLine : ", BasicOp.GetErrorCode()
207     return anObj
208
209 def MakeLineTwoPnt(thePnt1, thePnt2):
210     """
211      *  Create a line, passing through the given points
212      *  \param thePnt1 First of two points, defining the line.
213      *  \param thePnt2 Second of two points, defining the line.
214      *  \return New GEOM_Object, containing the created line.
215
216      *  Example: see GEOM_TestAll.py
217     """
218     anObj = BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
219     if BasicOp.IsDone() == 0:
220       print "MakeLineTwoPnt : ", BasicOp.GetErrorCode()
221     return anObj
222
223 def MakePlane(thePnt, theVec, theTrimSize):
224     """
225      *  Create a plane, passing through the given point
226      *  and normal to the given vector.
227      *  \param thePnt Point, the plane has to pass through.
228      *  \param theVec Vector, defining the plane normal direction.
229      *  \param theTrimSize Half size of a side of quadrangle face, representing the plane.
230      *  \return New GEOM_Object, containing the created plane.
231
232      *  Example: see GEOM_TestAll.py
233     """
234     anObj = BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
235     if BasicOp.IsDone() == 0:
236       print "MakePlanePntVec : ", BasicOp.GetErrorCode()
237     return anObj
238
239 def MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize):
240     """
241      *  Create a plane, passing through the three given points
242      *  \param thePnt1 First of three points, defining the plane.
243      *  \param thePnt2 Second of three points, defining the plane.
244      *  \param thePnt3 Fird of three points, defining the plane.
245      *  \param theTrimSize Half size of a side of quadrangle face, representing the plane.
246      *  \return New GEOM_Object, containing the created plane.
247
248      *  Example: see GEOM_TestAll.py
249     """
250     anObj = BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
251     if BasicOp.IsDone() == 0:
252       print "MakePlaneThreePnt : ", BasicOp.GetErrorCode()
253     return anObj
254
255 def MakePlaneFace(theFace, theTrimSize):
256     """
257      *  Create a plane, similar to the existing one, but with another size of representing face.
258      *  \param theFace Referenced plane.
259      *  \param theTrimSize New half size of a side of quadrangle face, representing the plane.
260      *  \return New GEOM_Object, containing the created plane.
261
262      *  Example: see GEOM_TestAll.py
263     """
264     anObj = BasicOp.MakePlaneFace(theFace, theTrimSize)
265     if BasicOp.IsDone() == 0:
266       print "MakePlaneFace : ", BasicOp.GetErrorCode()
267     return anObj
268
269 def MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
270     """
271      *  Create a local coordinate system.
272      *  \param OX,OY,OZ Three coordinates of coordinate system origin.
273      *  \param XDX,XDY,XDZ Three components of OX direction
274      *  \param YDX,YDY,YDZ Three components of OY direction
275      *  \return New GEOM_Object, containing the created coordinate system.
276
277      *  Example: see GEOM_TestAll.py
278     """
279     anObj = BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
280     if BasicOp.IsDone() == 0:
281       print "MakeMarker : ", BasicOp.GetErrorCode()
282     return anObj
283
284 # -----------------------------------------------------------------------------
285 # Curves
286 # -----------------------------------------------------------------------------
287
288 def MakeArc(thePnt1, thePnt2, thePnt3):
289     """
290      *  Create an arc of circle, passing through three given points.
291      *  \param thePnt1 Start point of the arc.
292      *  \param thePnt2 Middle point of the arc.
293      *  \param thePnt3 End point of the arc.
294      *  \return New GEOM_Object, containing the created arc.
295
296      *  Example: see GEOM_TestAll.py
297     """
298     anObj = CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
299     if CurvesOp.IsDone() == 0:
300       print "MakeArc : ", CurvesOp.GetErrorCode()
301     return anObj
302
303 def MakeCircle(thePnt, theVec, theR):
304     """
305      *  Create a circle with given center, normal vector and radius.
306      *  \param thePnt Circle center.
307      *  \param theVec Vector, normal to the plane of the circle.
308      *  \param theR Circle radius.
309      *  \return New GEOM_Object, containing the created circle.
310
311      *  Example: see GEOM_TestAll.py
312     """
313     anObj = CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
314     if CurvesOp.IsDone() == 0:
315       print "MakeCirclePntVecR : ", CurvesOp.GetErrorCode()
316     return anObj
317
318 def MakeCircleThreePnt(thePnt1, thePnt2, thePnt3):
319     """
320      *  Create a circle, passing through three given points
321      *  \param thePnt1,thePnt2,thePnt3 Points, defining the circle.
322      *  \return New GEOM_Object, containing the created circle.
323
324      *  Example: see GEOM_TestAll.py
325     """
326     anObj = CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
327     if CurvesOp.IsDone() == 0:
328       print "MakeCircleThreePnt : ", CurvesOp.GetErrorCode()
329     return anObj
330
331 def MakeEllipse(thePnt, theVec, theRMajor, theRMinor):
332     """
333      *  Create an ellipse with given center, normal vector and radiuses.
334      *  \param thePnt Ellipse center.
335      *  \param theVec Vector, normal to the plane of the ellipse.
336      *  \param theRMajor Major ellipse radius.
337      *  \param theRMinor Minor ellipse radius.
338      *  \return New GEOM_Object, containing the created ellipse.
339
340      *  Example: see GEOM_TestAll.py
341     """
342     anObj = CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
343     if CurvesOp.IsDone() == 0:
344       print "MakeEllipse : ", CurvesOp.GetErrorCode()
345     return anObj
346
347 def MakePolyline(thePoints):
348     """
349      *  Create a polyline on the set of points.
350      *  \param thePoints Sequence of points for the polyline.
351      *  \return New GEOM_Object, containing the created polyline.
352
353      *  Example: see GEOM_TestAll.py
354     """
355     anObj = CurvesOp.MakePolyline(thePoints)
356     if CurvesOp.IsDone() == 0:
357       print "MakePolyline : ", CurvesOp.GetErrorCode()
358     return anObj
359
360 def MakeBezier(thePoints):
361     """
362      *  Create bezier curve on the set of points.
363      *  \param thePoints Sequence of points for the bezier curve.
364      *  \return New GEOM_Object, containing the created bezier curve.
365
366      *  Example: see GEOM_TestAll.py
367     """
368     anObj = CurvesOp.MakeSplineBezier(thePoints)
369     if CurvesOp.IsDone() == 0:
370       print "MakeSplineBezier : ", CurvesOp.GetErrorCode()
371     return anObj
372
373 def MakeInterpol(thePoints):
374     """
375      *  Create B-Spline curve on the set of points.
376      *  \param thePoints Sequence of points for the B-Spline curve.
377      *  \return New GEOM_Object, containing the created B-Spline curve.
378
379      *  Example: see GEOM_TestAll.py
380     """
381     anObj = CurvesOp.MakeSplineInterpolation(thePoints)
382     if CurvesOp.IsDone() == 0:
383       print "MakeSplineInterpolation : ", CurvesOp.GetErrorCode()
384     return anObj
385
386 def MakeSketcher(theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
387     """
388      *  Create a sketcher (wire or face), following the textual description,
389      *  passed through \a theCommand argument. \n
390      *  Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
391      *  Format of the description string have to be the following:
392      *
393      *  "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
394      *
395      *  Where:
396      *  - x1, y1 are coordinates of the first sketcher point (zero by default),
397      *  - CMD is one of
398      *     - "R angle" : Set the direction by angle
399      *     - "D dx dy" : Set the direction by DX & DY
400      *     .
401      *       \n
402      *     - "TT x y" : Create segment by point at X & Y
403      *     - "T dx dy" : Create segment by point with DX & DY
404      *     - "L length" : Create segment by direction & Length
405      *     - "IX x" : Create segment by direction & Intersect. X
406      *     - "IY y" : Create segment by direction & Intersect. Y
407      *     .
408      *       \n
409      *     - "C radius length" : Create arc by direction, radius and length(in degree)
410      *     .
411      *       \n
412      *     - "WW" : Close Wire (to finish)
413      *     - "WF" : Close Wire and build face (to finish)
414      *
415      *  \param theCommand String, defining the sketcher in local
416      *                    coordinates of the working plane.
417      *  \param theWorkingPlane Nine double values, defining origin,
418      *                         OZ and OX directions of the working plane.
419      *  \return New GEOM_Object, containing the created wire.
420
421      *  Example: see GEOM_TestAll.py
422     """
423     anObj = CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
424     if CurvesOp.IsDone() == 0:
425       print "MakeSketcher : ", CurvesOp.GetErrorCode()
426     return anObj
427
428 # -----------------------------------------------------------------------------
429 # Create 3D Primitives
430 # -----------------------------------------------------------------------------
431
432 def MakeBox(x1,y1,z1,x2,y2,z2):
433     """
434      *  Create a box by coordinates of two opposite vertices.
435
436      *  Example: see GEOM_TestAll.py
437     """
438     pnt1 = MakeVertex(x1,y1,z1)
439     pnt2 = MakeVertex(x2,y2,z2)
440     return MakeBoxTwoPnt(pnt1,pnt2)
441
442 def MakeBoxDXDYDZ(theDX, theDY, theDZ):
443     """
444      *  Create a box with specified dimensions along the coordinate axes
445      *  and with edges, parallel to the coordinate axes.
446      *  Center of the box will be at point (DX/2, DY/2, DZ/2).
447      *  \param theDX Length of Box edges, parallel to OX axis.
448      *  \param theDY Length of Box edges, parallel to OY axis.
449      *  \param theDZ Length of Box edges, parallel to OZ axis.
450      *  \return New GEOM_Object, containing the created box.
451
452      *  Example: see GEOM_TestAll.py
453     """
454     anObj = PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
455     if PrimOp.IsDone() == 0:
456       print "MakeBoxDXDYDZ : ", PrimOp.GetErrorCode()
457     return anObj
458
459 def MakeBoxTwoPnt(thePnt1, thePnt2):
460     """
461      *  Create a box with two specified opposite vertices,
462      *  and with edges, parallel to the coordinate axes
463      *  \param thePnt1 First of two opposite vertices.
464      *  \param thePnt2 Second of two opposite vertices.
465      *  \return New GEOM_Object, containing the created box.
466
467      *  Example: see GEOM_TestAll.py
468     """
469     anObj = PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
470     if PrimOp.IsDone() == 0:
471       print "MakeBoxTwoPnt : ", PrimOp.GetErrorCode()
472     return anObj
473
474 def MakeCylinder(thePnt, theAxis, theR, theH):
475     """
476      *  Create a cylinder with given base point, axis, radius and height.
477      *  \param thePnt Central point of cylinder base.
478      *  \param theAxis Cylinder axis.
479      *  \param theR Cylinder radius.
480      *  \param theH Cylinder height.
481      *  \return New GEOM_Object, containing the created cylinder.
482
483      *  Example: see GEOM_TestAll.py
484     """
485     anObj = PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
486     if PrimOp.IsDone() == 0:
487       print "MakeCylinderPntVecRH : ", PrimOp.GetErrorCode()
488     return anObj
489
490 def MakeCylinderRH(theR, theH):
491     """
492      *  Create a cylinder with given radius and height at
493      *  the origin of coordinate system. Axis of the cylinder
494      *  will be collinear to the OZ axis of the coordinate system.
495      *  \param theR Cylinder radius.
496      *  \param theH Cylinder height.
497      *  \return New GEOM_Object, containing the created cylinder.
498
499      *  Example: see GEOM_TestAll.py
500     """
501     anObj = PrimOp.MakeCylinderRH(theR, theH)
502     if PrimOp.IsDone() == 0:
503       print "MakeCylinderRH : ", PrimOp.GetErrorCode()
504     return anObj
505
506 def MakeSpherePntR(thePnt, theR):
507     """
508      *  Create a sphere with given center and radius.
509      *  \param thePnt Sphere center.
510      *  \param theR Sphere radius.
511      *  \return New GEOM_Object, containing the created sphere.
512
513      *  Example: see GEOM_TestAll.py
514     """
515     anObj = PrimOp.MakeSpherePntR(thePnt, theR)
516     if PrimOp.IsDone() == 0:
517       print "MakeSpherePntR : ", PrimOp.GetErrorCode()
518     return anObj
519
520 def MakeSphere(x, y, z, theR):
521     """
522      *  Create a sphere with given center and radius.
523      *  \param x,y,z Coordinates of sphere center.
524      *  \param theR Sphere radius.
525      *  \return New GEOM_Object, containing the created sphere.
526
527      *  Example: see GEOM_TestAll.py
528     """
529     point = MakeVertex(x, y, z)
530     anObj = MakeSpherePntR(point, theR)
531     return anObj
532
533 def MakeSphereR(theR):
534     """
535      *  Create a sphere with given radius at the origin of coordinate system.
536      *  \param theR Sphere radius.
537      *  \return New GEOM_Object, containing the created sphere.
538
539      *  Example: see GEOM_TestAll.py
540     """
541     anObj = PrimOp.MakeSphereR(theR)
542     if PrimOp.IsDone() == 0:
543       print "MakeSphereR : ", PrimOp.GetErrorCode()
544     return anObj
545
546 def MakeCone(thePnt, theAxis, theR1, theR2, theH):
547     """
548      *  Create a cone with given base point, axis, height and radiuses.
549      *  \param thePnt Central point of the first cone base.
550      *  \param theAxis Cone axis.
551      *  \param theR1 Radius of the first cone base.
552      *  \param theR2 Radius of the second cone base.
553      *    \note If both radiuses are non-zero, the cone will be truncated.
554      *    \note If the radiuses are equal, a cylinder will be created instead.
555      *  \param theH Cone height.
556      *  \return New GEOM_Object, containing the created cone.
557
558      *  Example: see GEOM_TestAll.py
559     """
560     anObj = PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
561     if PrimOp.IsDone() == 0:
562       print "MakeConePntVecR1R2H : ", PrimOp.GetErrorCode()
563     return anObj
564
565 def MakeConeR1R2H(theR1, theR2, theH):
566     """
567      *  Create a cone with given height and radiuses at
568      *  the origin of coordinate system. Axis of the cone will
569      *  be collinear to the OZ axis of the coordinate system.
570      *  \param theR1 Radius of the first cone base.
571      *  \param theR2 Radius of the second cone base.
572      *    \note If both radiuses are non-zero, the cone will be truncated.
573      *    \note If the radiuses are equal, a cylinder will be created instead.
574      *  \param theH Cone height.
575      *  \return New GEOM_Object, containing the created cone.
576
577      *  Example: see GEOM_TestAll.py
578     """
579     anObj = PrimOp.MakeConeR1R2H(theR1, theR2, theH)
580     if PrimOp.IsDone() == 0:
581       print "MakeConeR1R2H : ", PrimOp.GetErrorCode()
582     return anObj
583
584 def MakeTorus(thePnt, theVec, theRMajor, theRMinor):
585     """
586      *  Create a torus with given center, normal vector and radiuses.
587      *  \param thePnt Torus central point.
588      *  \param theVec Torus axis of symmetry.
589      *  \param theRMajor Torus major radius.
590      *  \param theRMinor Torus minor radius.
591      *  \return New GEOM_Object, containing the created torus.
592
593      *  Example: see GEOM_TestAll.py
594     """
595     anObj = PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
596     if PrimOp.IsDone() == 0:
597       print "MakeTorusPntVecRR : ", PrimOp.GetErrorCode()
598     return anObj
599
600 def MakeTorusRR(theRMajor, theRMinor):
601     """
602      *  Create a torus with given radiuses at the origin of coordinate system.
603      *  \param theRMajor Torus major radius.
604      *  \param theRMinor Torus minor radius.
605      *  \return New GEOM_Object, containing the created torus.
606
607      *  Example: see GEOM_TestAll.py
608     """
609     anObj = PrimOp.MakeTorusRR(theRMajor, theRMinor)
610     if PrimOp.IsDone() == 0:
611       print "MakeTorusRR : ", PrimOp.GetErrorCode()
612     return anObj
613
614 def MakePrism(theBase, thePoint1, thePoint2):
615     """
616      *  Create a shape by extrusion of the base shape along a vector, defined by two points.
617      *  \param theBase Base shape to be extruded.
618      *  \param thePoint1 First end of extrusion vector.
619      *  \param thePoint2 Second end of extrusion vector.
620      *  \return New GEOM_Object, containing the created prism.
621
622      *  Example: see GEOM_TestAll.py
623     """
624     anObj = PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
625     if PrimOp.IsDone() == 0:
626       print "MakePrismTwoPnt : ", PrimOp.GetErrorCode()
627     return anObj
628
629 def MakePrismVecH(theBase, theVec, theH):
630     """
631      *  Create a shape by extrusion of the base shape along the vector,
632      *  i.e. all the space, transfixed by the base shape during its translation
633      *  along the vector on the given distance.
634      *  \param theBase Base shape to be extruded.
635      *  \param theVec Direction of extrusion.
636      *  \param theH Prism dimension along theVec.
637      *  \return New GEOM_Object, containing the created prism.
638
639      *  Example: see GEOM_TestAll.py
640     """
641     anObj = PrimOp.MakePrismVecH(theBase, theVec, theH)
642     if PrimOp.IsDone() == 0:
643       print "MakePrismVecH : ", PrimOp.GetErrorCode()
644     return anObj
645
646 def MakePipe(theBase, thePath):
647     """
648      *  Create a shape by extrusion of the base shape along
649      *  the path shape. The path shape can be a wire or an edge.
650      *  \param theBase Base shape to be extruded.
651      *  \param thePath Path shape to extrude the base shape along it.
652      *  \return New GEOM_Object, containing the created pipe.
653
654      *  Example: see GEOM_TestAll.py
655     """
656     anObj = PrimOp.MakePipe(theBase, thePath)
657     if PrimOp.IsDone() == 0:
658       print "MakePipe : ", PrimOp.GetErrorCode()
659     return anObj
660
661 def MakeRevolution(theBase, theAxis, theAngle):
662     """
663      *  Create a shape by revolution of the base shape around the axis
664      *  on the given angle, i.e. all the space, transfixed by the base
665      *  shape during its rotation around the axis on the given angle.
666      *  \param theBase Base shape to be rotated.
667      *  \param theAxis Rotation axis.
668      *  \param theAngle Rotation angle in radians.
669      *  \return New GEOM_Object, containing the created revolution.
670
671      *  Example: see GEOM_TestAll.py
672     """
673     anObj = PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
674     if PrimOp.IsDone() == 0:
675       print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode()
676     return anObj
677
678 # -----------------------------------------------------------------------------
679 # Create base shapes
680 # -----------------------------------------------------------------------------
681
682 def MakeEdge(thePnt1, thePnt2):
683     """
684      *  Create a linear edge with specified ends.
685      *  \param thePnt1 Point for the first end of edge.
686      *  \param thePnt2 Point for the second end of edge.
687      *  \return New GEOM_Object, containing the created edge.
688
689      *  Example: see GEOM_TestAll.py
690     """
691     anObj = ShapesOp.MakeEdge(thePnt1, thePnt2)
692     if ShapesOp.IsDone() == 0:
693       print "MakeEdge : ", ShapesOp.GetErrorCode()
694     return anObj
695
696 def MakeWire(theEdgesAndWires):
697     """
698      *  Create a wire from the set of edges and wires.
699      *  \param theEdgesAndWires List of edges and/or wires.
700      *  \return New GEOM_Object, containing the created wire.
701
702      *  Example: see GEOM_TestAll.py
703     """
704     anObj = ShapesOp.MakeWire(theEdgesAndWires)
705     if ShapesOp.IsDone() == 0:
706       print "MakeWire : ", ShapesOp.GetErrorCode()
707     return anObj
708
709 def MakeFace(theWire, isPlanarWanted):
710     """
711      *  Create a face on the given wire.
712      *  \param theWire Wire to build the face on.
713      *  \param isPlanarWanted If TRUE, only planar face will be built.
714      *                        If impossible, NULL object will be returned.
715      *  \return New GEOM_Object, containing the created face.
716
717      *  Example: see GEOM_TestAll.py
718     """
719     anObj = ShapesOp.MakeFace(theWire, isPlanarWanted)
720     if ShapesOp.IsDone() == 0:
721       print "MakeFace : ", ShapesOp.GetErrorCode()
722     return anObj
723
724 def MakeFaceWires(theWires, isPlanarWanted):
725     """
726      *  Create a face on the given wires set.
727      *  \param theWires List of wires to build the face on.
728      *  \param isPlanarWanted If TRUE, only planar face will be built.
729      *                        If impossible, NULL object will be returned.
730      *  \return New GEOM_Object, containing the created face.
731
732      *  Example: see GEOM_TestAll.py
733     """
734     anObj = ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
735     if ShapesOp.IsDone() == 0:
736       print "MakeFaceWires : ", ShapesOp.GetErrorCode()
737     return anObj
738
739 def MakeFaces(theWires, isPlanarWanted):
740     """
741      *  Shortcut to MakeFaceWires()
742
743      *  Example: see GEOM_TestOthers.py
744     """
745     anObj = MakeFaceWires(theWires, isPlanarWanted)
746     return anObj
747
748 def MakeShell(theFacesAndShells):
749     """
750      *  Create a shell from the set of faces and shells.
751      *  \param theFacesAndShells List of faces and/or shells.
752      *  \return New GEOM_Object, containing the created shell.
753
754      *  Example: see GEOM_TestAll.py
755     """
756     anObj = ShapesOp.MakeShell(theFacesAndShells)
757     if ShapesOp.IsDone() == 0:
758         print "MakeShell : ", ShapesOp.GetErrorCode()
759     return anObj
760
761 def MakeSolid(theShells):
762     """
763      *  Create a solid, bounded by the given shells.
764      *  \param theShells Sequence of bounding shells.
765      *  \return New GEOM_Object, containing the created solid.
766
767      *  Example: see GEOM_TestAll.py
768     """
769     anObj = ShapesOp.MakeSolidShells(theShells)
770     if ShapesOp.IsDone() == 0:
771         print "MakeSolid : ", ShapesOp.GetErrorCode()
772     return anObj
773
774 def MakeCompound(theShapes):
775     """
776      *  Create a compound of the given shapes.
777      *  \param theShapes List of shapes to put in compound.
778      *  \return New GEOM_Object, containing the created compound.
779
780      *  Example: see GEOM_TestAll.py
781     """
782     anObj = ShapesOp.MakeCompound(theShapes)
783     if ShapesOp.IsDone() == 0:
784       print "MakeCompound : ", ShapesOp.GetErrorCode()
785     return anObj
786
787 def NumberOfFaces(theShape):
788     """
789      *  Gives quantity of faces in the given shape.
790      *  \param theShape Shape to count faces of.
791      *  \return Quantity of faces.
792
793      *  Example: see GEOM_TestOthers.py
794     """
795     nb_faces = ShapesOp.NumberOfFaces(theShape)
796     if ShapesOp.IsDone() == 0:
797       print "NumberOfFaces : ", ShapesOp.GetErrorCode()
798     return nb_faces
799
800 def NumberOfEdges(theShape):
801     """
802      *  Gives quantity of edges in the given shape.
803      *  \param theShape Shape to count edges of.
804      *  \return Quantity of edges.
805
806      *  Example: see GEOM_TestOthers.py
807     """
808     nb_edges = ShapesOp.NumberOfEdges(theShape)
809     if ShapesOp.IsDone() == 0:
810       print "NumberOfEdges : ", ShapesOp.GetErrorCode()
811     return nb_edges
812
813 def ChangeOrientation(theShape):
814     """
815      *  Reverses an orientation the given shape.
816      *  \param theShape Shape to be reversed.
817      *  \return The reversed copy of theShape.
818
819      *  Example: see GEOM_TestAll.py
820     """
821     anObj = ShapesOp.ChangeOrientation(theShape)
822     if ShapesOp.IsDone() == 0:
823       print "ChangeOrientation : ", ShapesOp.GetErrorCode()
824     return anObj
825
826 def OrientationChange(theShape):
827     """
828      *  Shortcut to ChangeOrientation()
829
830      *  Example: see GEOM_TestOthers.py
831     """
832     anObj = ChangeOrientation(theShape)
833     return anObj
834
835 def GetFreeFacesIDs(theShape):
836     """
837      *  Retrieve all free faces from the given shape.
838      *  Free face is a face, which is not shared between two shells of the shape.
839      *  \param theShape Shape to find free faces in.
840      *  \return List of IDs of all free faces, contained in theShape.
841
842      *  Example: see GEOM_TestOthers.py
843     """
844     anIDs = ShapesOp.GetFreeFacesIDs(theShape)
845     if ShapesOp.IsDone() == 0:
846       print "GetFreeFacesIDs : ", ShapesOp.GetErrorCode()
847     return anIDs
848
849 def GetSharedShapes(theShape1, theShape2, theShapeType):
850     """
851      *  Get all sub-shapes of theShape1 of the given type, shared with theShape2.
852      *  \param theShape1 Shape to find sub-shapes in.
853      *  \param theShape2 Shape to find shared sub-shapes with.
854      *  \param theShapeType Type of sub-shapes to be retrieved.
855      *  \return List of sub-shapes of theShape1, shared with theShape2.
856
857      *  Example: see GEOM_TestOthers.py
858     """
859     aList = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
860     if ShapesOp.IsDone() == 0:
861       print "GetSharedShapes : ", ShapesOp.GetErrorCode()
862     return aList
863
864 def GetShapesOnPlane(theShape, theShapeType, theAx1, theState):
865     """
866      *  Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
867      *  the specified plane by the certain way, defined through \a theState parameter.
868      *  \param theShape Shape to find sub-shapes of.
869      *  \param theShapeType Type of sub-shapes to be retrieved.
870      *  \param theAx1 Vector (or line, or linear edge), specifying normal
871      *                direction and location of the plane to find shapes on.
872      *  \param theState The state of the subshapes to find. It can be one of
873      *   ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
874      *  \return List of all found sub-shapes.
875
876      *  Example: see GEOM_TestOthers.py
877     """
878     aList = ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
879     if ShapesOp.IsDone() == 0:
880       print "GetShapesOnPlane : ", ShapesOp.GetErrorCode()
881     return aList
882
883 def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState):
884     """
885      *  Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
886      *  the specified cylinder by the certain way, defined through \a theState parameter.
887      *  \param theShape Shape to find sub-shapes of.
888      *  \param theShapeType Type of sub-shapes to be retrieved.
889      *  \param theAxis Vector (or line, or linear edge), specifying
890      *                 axis of the cylinder to find shapes on.
891      *  \param theRadius Radius of the cylinder to find shapes on.
892      *  \param theState The state of the subshapes to find. It can be one of
893      *   ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
894      *  \return List of all found sub-shapes.
895
896      *  Example: see GEOM_TestOthers.py
897     """
898     aList = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
899     if ShapesOp.IsDone() == 0:
900       print "GetShapesOnCylinder : ", ShapesOp.GetErrorCode()
901     return aList
902
903 def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState):
904     """
905      *  Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
906      *  the specified sphere by the certain way, defined through \a theState parameter.
907      *  \param theShape Shape to find sub-shapes of.
908      *  \param theShapeType Type of sub-shapes to be retrieved.
909      *  \param theCenter Point, specifying center of the sphere to find shapes on.
910      *  \param theRadius Radius of the sphere to find shapes on.
911      *  \param theState The state of the subshapes to find. It can be one of
912      *   ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN.
913      *  \return List of all found sub-shapes.
914
915      *  Example: see GEOM_TestOthers.py
916     """
917     aList = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
918     if ShapesOp.IsDone() == 0:
919       print "GetShapesOnSphere : ", ShapesOp.GetErrorCode()
920     return aList
921
922 def GetInPlace(theShapeWhere, theShapeWhat):
923     """
924      *  Get sub-shape(s) of theShapeWhere, which are
925      *  coincident with \a theShapeWhat or could be a part of it.
926      *  \param theShapeWhere Shape to find sub-shapes of.
927      *  \param theShapeWhat Shape, specifying what to find.
928      *  \return Group of all found sub-shapes or a single found sub-shape.
929
930      *  Example: see GEOM_TestOthers.py
931     """
932     anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
933     if ShapesOp.IsDone() == 0:
934       print "GetInPlace : ", ShapesOp.GetErrorCode()
935     return anObj
936
937 # -----------------------------------------------------------------------------
938 # Access to sub-shapes by their unique IDs inside the main shape.
939 # -----------------------------------------------------------------------------
940
941 def GetSubShape(aShape, ListOfID):
942     """
943      *  Obtain a composite sub-shape of <aShape>, composed from sub-shapes
944      *  of <aShape>, selected by their unique IDs inside <aShape>
945
946      *  Example: see GEOM_TestAll.py
947     """
948     anObj = geom.AddSubShape(aShape,ListOfID)
949     return anObj
950
951 def GetSubShapeID(aShape, aSubShape):
952     """
953      *  Obtain unique ID of sub-shape <aSubShape> inside <aShape>
954
955      *  Example: see GEOM_TestAll.py
956     """
957     anID = LocalOp.GetSubShapeIndex(aShape, aSubShape)
958     if LocalOp.IsDone() == 0:
959       print "GetSubShapeIndex : ", LocalOp.GetErrorCode()
960     return anID
961
962 # -----------------------------------------------------------------------------
963 # Decompose objects
964 # -----------------------------------------------------------------------------
965
966 def SubShapeAll(aShape, aType):
967     """
968      *  Explode a shape on subshapes of a given type.
969      *  \param theShape Shape to be exploded.
970      *  \param theShapeType Type of sub-shapes to be retrieved.
971      *  \return List of sub-shapes of type theShapeType, contained in theShape.
972
973      *  Example: see GEOM_TestAll.py
974     """
975     ListObj = ShapesOp.MakeExplode(aShape,aType,0)
976     if ShapesOp.IsDone() == 0:
977       print "MakeExplode : ", ShapesOp.GetErrorCode()
978     return ListObj
979
980 def SubShapeAllIDs(aShape, aType):
981     """
982      *  Explode a shape on subshapes of a given type.
983      *  \param theShape Shape to be exploded.
984      *  \param theShapeType Type of sub-shapes to be retrieved.
985      *  \return List of IDs of sub-shapes.
986     """
987     ListObj = ShapesOp.SubShapeAllIDs(aShape,aType,0)
988     if ShapesOp.IsDone() == 0:
989       print "SubShapeAllIDs : ", ShapesOp.GetErrorCode()
990     return ListObj
991
992 def SubShapeAllSorted(aShape, aType):
993     """
994      *  Explode a shape on subshapes of a given type.
995      *  Sub-shapes will be sorted by coordinates of their gravity centers.
996      *  \param theShape Shape to be exploded.
997      *  \param theShapeType Type of sub-shapes to be retrieved.
998      *  \return List of sub-shapes of type theShapeType, contained in theShape.
999
1000      *  Example: see GEOM_TestAll.py
1001     """
1002     ListObj = ShapesOp.MakeExplode(aShape,aType,1)
1003     if ShapesOp.IsDone() == 0:
1004       print "MakeExplode : ", ShapesOp.GetErrorCode()
1005     return ListObj
1006
1007 def SubShapeAllSortedIDs(aShape, aType):
1008     """
1009      *  Explode a shape on subshapes of a given type.
1010      *  Sub-shapes will be sorted by coordinates of their gravity centers.
1011      *  \param theShape Shape to be exploded.
1012      *  \param theShapeType Type of sub-shapes to be retrieved.
1013      *  \return List of IDs of sub-shapes.
1014     """
1015     ListIDs = ShapesOp.SubShapeAllIDs(aShape,aType,1)
1016     if ShapesOp.IsDone() == 0:
1017       print "SubShapeAllSortedIDs : ", ShapesOp.GetErrorCode()
1018     return ListObj
1019
1020 def SubShape(aShape, aType, ListOfInd):
1021     """
1022      *  Obtain a compound of sub-shapes of <aShape>,
1023      *  selected by they indices in list of all sub-shapes of type <aType>.
1024      *  Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1025
1026      *  Example: see GEOM_TestAll.py
1027     """
1028     ListOfIDs = []
1029     AllShapeList = SubShapeAll(aShape, aType)
1030     for ind in ListOfInd:
1031         ListOfIDs.append(GetSubShapeID(aShape, AllShapeList[ind - 1]))
1032     anObj = GetSubShape(aShape, ListOfIDs)
1033     return anObj
1034
1035 def SubShapeSorted(aShape, aType, ListOfInd):
1036     """
1037      *  Obtain a compound of sub-shapes of <aShape>,
1038      *  selected by they indices in sorted list of all sub-shapes of type <aType>.
1039      *  Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
1040
1041      *  Example: see GEOM_TestAll.py
1042     """
1043     ListOfIDs = []
1044     AllShapeList = SubShapeAllSorted(aShape, aType)
1045     for ind in ListOfInd:
1046         ListOfIDs.append(GetSubShapeID(aShape, AllShapeList[ind - 1]))
1047     anObj = GetSubShape(aShape, ListOfIDs)
1048     return anObj
1049
1050 # -----------------------------------------------------------------------------
1051 # Healing operations
1052 # -----------------------------------------------------------------------------
1053
1054 def ProcessShape(theShape, theOperators, theParameters, theValues):
1055     """
1056      *  Apply a sequence of Shape Healing operators to the given object.
1057      *  \param theShape Shape to be processed.
1058      *  \param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
1059      *  \param theParameters List of names of parameters
1060      *                    ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
1061      *  \param theValues List of values of parameters, in the same order
1062      *                    as parameters are listed in \a theParameters list.
1063      *  \return New GEOM_Object, containing processed shape.
1064
1065      *  Example: see GEOM_TestHealing.py
1066     """
1067     anObj = HealOp.ProcessShape(theShape, theOperators, theParameters, theValues)
1068     if HealOp.IsDone() == 0:
1069         print "ProcessShape : ", HealOp.GetErrorCode()
1070     return anObj
1071
1072 def SuppressFaces(theObject, theFaces):
1073     """
1074      *  Remove faces from the given object (shape).
1075      *  \param theObject Shape to be processed.
1076      *  \param theFaces Indices of faces to be removed, if EMPTY then the method
1077      *                  removes ALL faces of the given object.
1078      *  \return New GEOM_Object, containing processed shape.
1079
1080      *  Example: see GEOM_TestHealing.py
1081     """
1082     anObj = HealOp.SuppressFaces(theObject, theFaces)
1083     if HealOp.IsDone() == 0:
1084       print "SuppressFaces : ", HealOp.GetErrorCode()
1085     return anObj
1086
1087 def MakeSewing(ListShape, theTolerance):
1088     """
1089      *  Sewing of some shapes into single shape.
1090
1091      *  Example: see GEOM_TestHealing.py
1092     """
1093     comp = MakeCompound(ListShape)
1094     anObj = Sew(comp, theTolerance)
1095     return anObj
1096
1097 def Sew(theObject, theTolerance):
1098     """
1099      *  Sewing of the given object.
1100      *  \param theObject Shape to be processed.
1101      *  \param theTolerance Required tolerance value.
1102      *  \return New GEOM_Object, containing processed shape.
1103
1104      *  Example: see MakeSewing() above
1105     """
1106     anObj = HealOp.Sew(theObject, theTolerance)
1107     if HealOp.IsDone() == 0:
1108       print "Sew : ", HealOp.GetErrorCode()
1109     return anObj
1110
1111 def SuppressInternalWires(theObject, theWires):
1112     """
1113      *  Remove internal wires and edges from the given object (face).
1114      *  \param theObject Shape to be processed.
1115      *  \param theWires Indices of wires to be removed, if EMPTY then the method
1116      *                  removes ALL internal wires of the given object.
1117      *  \return New GEOM_Object, containing processed shape.
1118
1119      *  Example: see GEOM_TestHealing.py
1120     """
1121     anObj = HealOp.RemoveIntWires(theObject, theWires)
1122     if HealOp.IsDone() == 0:
1123       print "SuppressInternalWires : ", HealOp.GetErrorCode()
1124     return anObj
1125
1126 def SuppressHoles(theObject, theWires):
1127     """
1128      *  Remove internal closed contours (holes) from the given object.
1129      *  \param theObject Shape to be processed.
1130      *  \param theWires Indices of wires to be removed, if EMPTY then the method
1131      *                  removes ALL internal holes of the given object
1132      *  \return New GEOM_Object, containing processed shape.
1133
1134      *  Example: see GEOM_TestHealing.py
1135     """
1136     anObj = HealOp.FillHoles(theObject, theWires)
1137     if HealOp.IsDone() == 0:
1138       print "SuppressHoles : ", HealOp.GetErrorCode()
1139     return anObj
1140
1141 def CloseContour(theObject, theWires, isCommonVertex):
1142     """
1143      *  Close an open wire.
1144      *  \param theObject Shape to be processed.
1145      *  \param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
1146      *                  if -1, then theObject itself is a wire.
1147      *  \param isCommonVertex If TRUE : closure by creation of a common vertex,
1148      *                        If FALS : closure by creation of an edge between ends.
1149      *  \return New GEOM_Object, containing processed shape.
1150
1151      *  Example: see GEOM_TestHealing.py
1152     """
1153     anObj = HealOp.CloseContour(theObject, theWires, isCommonVertex)
1154     if HealOp.IsDone() == 0:
1155       print "CloseContour : ", HealOp.GetErrorCode()
1156     return anObj
1157
1158 def DivideEdge(theObject, theEdgeIndex, theValue, isByParameter):
1159     """
1160      *  Addition of a point to a given edge object.
1161      *  \param theObject Shape to be processed.
1162      *  \param theEdgeIndex Index of edge to be divided within theObject's shape,
1163      *                      if -1, then theObject itself is the edge.
1164      *  \param theValue Value of parameter on edge or length parameter,
1165      *                  depending on \a isByParameter.
1166      *  \param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1],
1167      *                       if FALSE : \a theValue is treated as a length parameter [0..1]
1168      *  \return New GEOM_Object, containing processed shape.
1169
1170      *  Example: see GEOM_TestHealing.py
1171     """
1172     anObj = HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
1173     if HealOp.IsDone() == 0:
1174       print "DivideEdge : ", HealOp.GetErrorCode()
1175     return anObj
1176
1177 def GetFreeBoundary(theObject):
1178     """
1179      *  Get a list of wires (wrapped in GEOM_Object-s),
1180      *  that constitute a free boundary of the given shape.
1181      *  \param theObject Shape to get free boundary of.
1182      *  \return [status, theClosedWires, theOpenWires]
1183      *  status: FALSE, if an error(s) occured during the method execution.
1184      *  theClosedWires: Closed wires on the free boundary of the given shape.
1185      *  theOpenWires: Open wires on the free boundary of the given shape.
1186
1187      *  Example: see GEOM_TestHealing.py
1188     """
1189     anObj = HealOp.GetFreeBoundary(theObject)
1190     if HealOp.IsDone() == 0:
1191       print "GetFreeBoundaries : ", HealOp.GetErrorCode()
1192     return anObj
1193
1194 # -----------------------------------------------------------------------------
1195 # Create advanced objects
1196 # -----------------------------------------------------------------------------
1197
1198 def MakeCopy(theOriginal):
1199     """
1200      *  Create a copy of the given object
1201
1202      *  Example: see GEOM_TestAll.py
1203     """
1204     anObj = InsertOp.MakeCopy(theOriginal)
1205     if InsertOp.IsDone() == 0:
1206       print "MakeCopy : ", InsertOp.GetErrorCode()
1207     return anObj
1208
1209 def MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter):
1210     """
1211      *  Create a filling from the given compound of contours.
1212      *  \param theShape the compound of contours
1213      *  \param theMinDeg a minimal degree
1214      *  \param theMaxDeg a maximal degree
1215      *  \param theTol2D a 2d tolerance
1216      *  \param theTol3D a 3d tolerance
1217      *  \param theNbIter a number of iteration
1218      *  \return New GEOM_Object, containing the created filling surface.
1219
1220      *  Example: see GEOM_TestAll.py
1221     """
1222     anObj = PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter)
1223     if PrimOp.IsDone() == 0:
1224       print "MakeFilling : ", PrimOp.GetErrorCode()
1225     return anObj
1226
1227 def MakeGlueFaces(theShape, theTolerance):
1228     """
1229      *  Replace coincident faces in theShape by one face.
1230      *  \param theShape Initial shape.
1231      *  \param theTolerance Maximum distance between faces, which can be considered as coincident.
1232      *  \return New GEOM_Object, containing a copy of theShape without coincident faces.
1233
1234      *  Example: see GEOM_Spanner.py
1235     """
1236     anObj = ShapesOp.MakeGlueFaces(theShape, theTolerance)
1237     if ShapesOp.IsDone() == 0:
1238       print "MakeGlueFaces : ", ShapesOp.GetErrorCode()
1239     return anObj
1240
1241 # -----------------------------------------------------------------------------
1242 # Boolean (Common, Cut, Fuse, Section)
1243 # -----------------------------------------------------------------------------
1244
1245 def MakeBoolean(theShape1, theShape2, theOperation):
1246     """
1247      *  Perform one of boolean operations on two given shapes.
1248      *  \param theShape1 First argument for boolean operation.
1249      *  \param theShape2 Second argument for boolean operation.
1250      *  \param theOperation Indicates the operation to be done:
1251      *                      1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
1252      *  \return New GEOM_Object, containing the result shape.
1253
1254      *  Example: see GEOM_TestAll.py
1255     """
1256     anObj = BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
1257     if BoolOp.IsDone() == 0:
1258       print "MakeBoolean : ", BoolOp.GetErrorCode()
1259     return anObj
1260
1261 def MakeCommon(s1, s2):
1262     """
1263      *  Shortcut to MakeBoolean(s1, s2, 1)
1264
1265      *  Example: see GEOM_TestOthers.py
1266     """
1267     return MakeBoolean(s1, s2, 1)
1268
1269 def MakeCut(s1, s2):
1270     """
1271      *  Shortcut to MakeBoolean(s1, s2, 2)
1272
1273      *  Example: see GEOM_TestOthers.py
1274     """
1275     return MakeBoolean(s1, s2, 2)
1276
1277 def MakeFuse(s1, s2):
1278     """
1279      *  Shortcut to MakeBoolean(s1, s2, 3)
1280
1281      *  Example: see GEOM_TestOthers.py
1282     """
1283     return MakeBoolean(s1, s2, 3)
1284
1285 def MakeSection(s1, s2):
1286     """
1287      *  Shortcut to MakeBoolean(s1, s2, 4)
1288
1289      *  Example: see GEOM_TestOthers.py
1290     """
1291     return MakeBoolean(s1, s2, 4)
1292
1293 def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
1294                   Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
1295     """
1296      *  Perform partition operation.
1297      *  \param ListShapes Shapes to be intersected.
1298      *  \param ListTools Shapes to intersect theShapes.
1299      *  \param ListKeepInside Shapes, outside which the results will be deleted.
1300      *         Each shape from theKeepInside must belong to theShapes also.
1301      *  \param ListRemoveInside Shapes, inside which the results will be deleted.
1302      *         Each shape from theRemoveInside must belong to theShapes also.
1303      *  \param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
1304      *  \param RemoveWebs If TRUE, perform Glue 3D algorithm.
1305      *  \param ListMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE.
1306      *  \return New GEOM_Object, containing the result shapes.
1307
1308      *  Example: see GEOM_TestAll.py
1309     """
1310     anObj = BoolOp.MakePartition(ListShapes, ListTools,
1311                                  ListKeepInside, ListRemoveInside,
1312                                  Limit, RemoveWebs, ListMaterials);
1313     if BoolOp.IsDone() == 0:
1314       print "MakePartition : ", BoolOp.GetErrorCode()
1315     return anObj
1316
1317 def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
1318               Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
1319     """
1320      *  Shortcut to MakePartition()
1321
1322      *  Example: see GEOM_TestOthers.py
1323     """
1324     anObj = MakePartition(ListShapes, ListTools,
1325                           ListKeepInside, ListRemoveInside,
1326                           Limit, RemoveWebs, ListMaterials);
1327     return anObj
1328
1329 def MakeHalfPartition(theShape, thePlane):
1330     """
1331      *  Perform partition of the Shape with the Plane
1332      *  \param theShape Shape to be intersected.
1333      *  \param thePlane Tool shape, to intersect theShape.
1334      *  \return New GEOM_Object, containing the result shape.
1335
1336      *  Example: see GEOM_TestAll.py
1337     """
1338     anObj = BoolOp.MakeHalfPartition(theShape, thePlane)
1339     if BoolOp.IsDone() == 0:
1340       print "MakeHalfPartition : ", BoolOp.GetErrorCode()
1341     return anObj
1342
1343 # -----------------------------------------------------------------------------
1344 # Transform objects
1345 # -----------------------------------------------------------------------------
1346
1347 def MakeTranslationTwoPoints(theObject, thePoint1, thePoint2):
1348     """
1349      *  Translate the given object along the vector, specified
1350      *  by its end points, creating its copy before the translation.
1351      *  \param theObject The object to be translated.
1352      *  \param thePoint1 Start point of translation vector.
1353      *  \param thePoint2 End point of translation vector.
1354      *  \return New GEOM_Object, containing the translated object.
1355
1356      *  Example: see GEOM_TestAll.py
1357     """
1358     anObj = TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
1359     if TrsfOp.IsDone() == 0:
1360       print "TranslateTwoPointsCopy : ", TrsfOp.GetErrorCode()
1361     return anObj
1362
1363 def MakeTranslation(theObject, theDX, theDY, theDZ):
1364     """
1365      *  Translate the given object along the vector, specified
1366      *  by its components, creating its copy before the translation.
1367      *  \param theObject The object to be translated.
1368      *  \param theDX,theDY,theDZ Components of translation vector.
1369      *  \return New GEOM_Object, containing the translated object.
1370
1371      *  Example: see GEOM_TestAll.py
1372     """
1373     anObj = TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
1374     if TrsfOp.IsDone() == 0:
1375       print "TranslateDXDYDZCopy : ", TrsfOp.GetErrorCode()
1376     return anObj
1377
1378 def MakeTranslationVector(theObject, theVector):
1379     """
1380      *  Translate the given object along the given vector,
1381      *  creating its copy before the translation.
1382      *  \param theObject The object to be translated.
1383      *  \param theVector The translation vector.
1384      *  \return New GEOM_Object, containing the translated object.
1385
1386      *  Example: see GEOM_TestAll.py
1387     """
1388     anObj = TrsfOp.TranslateVectorCopy(theObject, theVector)
1389     if TrsfOp.IsDone() == 0:
1390       print "TranslateVectorCopy : ", TrsfOp.GetErrorCode()
1391     return anObj
1392
1393 def MakeRotation(theObject, theAxis, theAngle):
1394     """
1395      *  Rotate the given object around the given axis
1396      *  on the given angle, creating its copy before the rotatation.
1397      *  \param theObject The object to be rotated.
1398      *  \param theAxis Rotation axis.
1399      *  \param theAngle Rotation angle in radians.
1400      *  \return New GEOM_Object, containing the rotated object.
1401
1402      *  Example: see GEOM_TestAll.py
1403     """
1404     anObj = TrsfOp.RotateCopy(theObject, theAxis, theAngle)
1405     if TrsfOp.IsDone() == 0:
1406       print "RotateCopy : ", TrsfOp.GetErrorCode()
1407     return anObj
1408
1409 def MakeScaleTransform(theObject, thePoint, theFactor):
1410     """
1411      *  Scale the given object by the factor, creating its copy before the scaling.
1412      *  \param theObject The object to be scaled.
1413      *  \param thePoint Center point for scaling.
1414      *  \param theFactor Scaling factor value.
1415      *  \return New GEOM_Object, containing the scaled shape.
1416
1417      *  Example: see GEOM_TestAll.py
1418     """
1419     anObj = TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
1420     if TrsfOp.IsDone() == 0:
1421       print "ScaleShapeCopy : ", TrsfOp.GetErrorCode()
1422     return anObj
1423
1424 def MakeMirrorByPlane(theObject, thePlane):
1425     """
1426      *  Create an object, symmetrical
1427      *  to the given one relatively the given plane.
1428      *  \param theObject The object to be mirrored.
1429      *  \param thePlane Plane of symmetry.
1430      *  \return New GEOM_Object, containing the mirrored shape.
1431
1432      *  Example: see GEOM_TestAll.py
1433     """
1434     anObj = TrsfOp.MirrorPlaneCopy(theObject, thePlane)
1435     if TrsfOp.IsDone() == 0:
1436       print "MirrorPlaneCopy : ", TrsfOp.GetErrorCode()
1437     return anObj
1438
1439 def MakeMirrorByAxis(theObject, theAxis):
1440     """
1441      *  Create an object, symmetrical
1442      *  to the given one relatively the given axis.
1443      *  \param theObject The object to be mirrored.
1444      *  \param theAxis Axis of symmetry.
1445      *  \return New GEOM_Object, containing the mirrored shape.
1446
1447      *  Example: see GEOM_TestAll.py
1448     """
1449     anObj = TrsfOp.MirrorAxisCopy(theObject, theAxis)
1450     if TrsfOp.IsDone() == 0:
1451       print "MirrorAxisCopy : ", TrsfOp.GetErrorCode()
1452     return anObj
1453
1454 def MakeMirrorByPoint(theObject, thePoint):
1455     """
1456      *  Create an object, symmetrical
1457      *  to the given one relatively the given point.
1458      *  \param theObject The object to be mirrored.
1459      *  \param thePoint Point of symmetry.
1460      *  \return New GEOM_Object, containing the mirrored shape.
1461
1462      *  Example: see GEOM_TestAll.py
1463     """
1464     anObj = TrsfOp.MirrorPointCopy(theObject, thePoint)
1465     if TrsfOp.IsDone() == 0:
1466       print "MirrorPointCopy : ", TrsfOp.GetErrorCode()
1467     return anObj
1468
1469 def MakePosition(theObject, theStartLCS, theEndLCS):
1470     """
1471      *  Modify the Location of the given object by LCS
1472      *  creating its copy before the setting
1473
1474      *  Example: see GEOM_TestAll.py
1475     """
1476     anObj = TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
1477     if TrsfOp.IsDone() == 0:
1478       print "PositionShapeCopy : ", TrsfOp.GetErrorCode()
1479     return anObj
1480
1481 def MakeOffset(theObject, theOffset):
1482     """
1483      *  Create new object as offset of the given one.
1484      *  \param theObject The base object for the offset.
1485      *  \param theOffset Offset value.
1486      *  \return New GEOM_Object, containing the offset object.
1487
1488      *  Example: see GEOM_TestAll.py
1489     """
1490     anObj = TrsfOp.OffsetShapeCopy(theObject, theOffset)
1491     if TrsfOp.IsDone() == 0:
1492       print "OffsetShapeCopy : ", TrsfOp.GetErrorCode()
1493     return anObj
1494
1495 # -----------------------------------------------------------------------------
1496 # Patterns
1497 # -----------------------------------------------------------------------------
1498
1499 def MakeMultiTranslation1D(theObject, theVector, theStep, theNbTimes):
1500     """
1501      *  Translate the given object along the given vector a given number times
1502      *  \param theObject The object to be translated.
1503      *  \param theVector Direction of the translation.
1504      *  \param theStep Distance to translate on.
1505      *  \param theNbTimes Quantity of translations to be done.
1506      *  \return New GEOM_Object, containing compound of all
1507      *          the shapes, obtained after each translation.
1508
1509      *  Example: see GEOM_TestAll.py
1510     """
1511     anObj = TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
1512     if TrsfOp.IsDone() == 0:
1513       print "MultiTranslate1D : ", TrsfOp.GetErrorCode()
1514     return anObj
1515
1516 def MakeMultiTranslation2D(theObject, theVector1, theStep1, theNbTimes1,
1517                                       theVector2, theStep2, theNbTimes2):
1518     """
1519      *  Conseqently apply two specified translations to theObject specified number of times.
1520      *  \param theObject The object to be translated.
1521      *  \param theVector1 Direction of the first translation.
1522      *  \param theStep1 Step of the first translation.
1523      *  \param theNbTimes1 Quantity of translations to be done along theVector1.
1524      *  \param theVector2 Direction of the second translation.
1525      *  \param theStep2 Step of the second translation.
1526      *  \param theNbTimes2 Quantity of translations to be done along theVector2.
1527      *  \return New GEOM_Object, containing compound of all
1528      *          the shapes, obtained after each translation.
1529
1530      *  Example: see GEOM_TestAll.py
1531     """
1532     anObj = TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
1533                                                theVector2, theStep2, theNbTimes2)
1534     if TrsfOp.IsDone() == 0:
1535       print "MultiTranslate2D : ", TrsfOp.GetErrorCode()
1536     return anObj
1537
1538 def MultiRotate1D(theObject, theAxis, theNbTimes):
1539     """
1540      *  Rotate the given object around the given axis a given number times.
1541      *  Rotation angle will be 2*PI/theNbTimes.
1542      *  \param theObject The object to be rotated.
1543      *  \param theAxis The rotation axis.
1544      *  \param theNbTimes Quantity of rotations to be done.
1545      *  \return New GEOM_Object, containing compound of all the
1546      *          shapes, obtained after each rotation.
1547
1548      *  Example: see GEOM_TestAll.py
1549     """
1550     anObj = TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
1551     if TrsfOp.IsDone() == 0:
1552       print "MultiRotate1D : ", TrsfOp.GetErrorCode()
1553     return anObj
1554
1555 def MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
1556     """
1557      *  Rotate the given object around the
1558      *  given axis on the given angle a given number
1559      *  times and multi-translate each rotation result.
1560      *  Translation direction passes through center of gravity
1561      *  of rotated shape and its projection on the rotation axis.
1562      *  \param theObject The object to be rotated.
1563      *  \param theAxis Rotation axis.
1564      *  \param theAngle Rotation angle in graduces.
1565      *  \param theNbTimes1 Quantity of rotations to be done.
1566      *  \param theStep Translation distance.
1567      *  \param theNbTimes2 Quantity of translations to be done.
1568      *  \return New GEOM_Object, containing compound of all the
1569      *          shapes, obtained after each transformation.
1570
1571      *  Example: see GEOM_TestAll.py
1572     """
1573     anObj = TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
1574     if TrsfOp.IsDone() == 0:
1575       print "MultiRotate2D : ", TrsfOp.GetErrorCode()
1576     return anObj
1577
1578 def MakeMultiRotation1D(aShape,aDir,aPoint,aNbTimes):
1579     """
1580      *  The same, as MultiRotate1D(), but axis is given by direction and point
1581
1582      *  Example: see GEOM_TestOthers.py
1583     """
1584     aVec = MakeLine(aPoint,aDir)
1585     anObj = MultiRotate1D(aShape,aVec,aNbTimes)
1586     return anObj
1587
1588 def MakeMultiRotation2D(aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
1589     """
1590      *  The same, as MultiRotate2D(), but axis is given by direction and point
1591
1592      *  Example: see GEOM_TestOthers.py
1593     """
1594     aVec = MakeLine(aPoint,aDir)
1595     anObj = MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
1596     return anObj
1597
1598 # -----------------------------------------------------------------------------
1599 # Local operations
1600 # -----------------------------------------------------------------------------
1601
1602 def MakeFilletAll(theShape, theR):
1603     """
1604      *  Perform a fillet on all edges of the given shape.
1605      *  \param theShape Shape, to perform fillet on.
1606      *  \param theR Fillet radius.
1607      *  \return New GEOM_Object, containing the result shape.
1608
1609      *  Example: see GEOM_TestOthers.py
1610     """
1611     anObj = LocalOp.MakeFilletAll(theShape, theR)
1612     if LocalOp.IsDone() == 0:
1613       print "MakeFilletAll : ", LocalOp.GetErrorCode()
1614     return anObj
1615
1616 def MakeFillet(theShape, theR, theShapeType, theListShapes):
1617     """
1618      *  Perform a fillet on the specified edges/faces of the given shape
1619      *  \param theShape Shape, to perform fillet on.
1620      *  \param theR Fillet radius.
1621      *  \param theShapeType Type of shapes in <theListShapes>.
1622      *  \param theListShapes Global indices of edges/faces to perform fillet on.
1623      *    \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1624      *  \return New GEOM_Object, containing the result shape.
1625
1626      *  Example: see GEOM_TestAll.py
1627     """
1628     anObj = None
1629     if theShapeType == ShapeType["EDGE"]:
1630         anObj = LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
1631     else:
1632         anObj = LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
1633     if LocalOp.IsDone() == 0:
1634       print "MakeFillet : ", LocalOp.GetErrorCode()
1635     return anObj
1636
1637 def MakeChamferAll(theShape, theD):
1638     """
1639      *  Perform a symmetric chamfer on all edges of the given shape.
1640      *  \param theShape Shape, to perform chamfer on.
1641      *  \param theD Chamfer size along each face.
1642      *  \return New GEOM_Object, containing the result shape.
1643
1644      *  Example: see GEOM_TestOthers.py
1645     """
1646     anObj = LocalOp.MakeChamferAll(theShape, theD)
1647     if LocalOp.IsDone() == 0:
1648       print "MakeChamferAll : ", LocalOp.GetErrorCode()
1649     return anObj
1650
1651 def MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2):
1652     """
1653      *  Perform a chamfer on edges, common to the specified faces,
1654      *  with distance D1 on the Face1
1655      *  \param theShape Shape, to perform chamfer on.
1656      *  \param theD1 Chamfer size along \a theFace1.
1657      *  \param theD2 Chamfer size along \a theFace2.
1658      *  \param theFace1,theFace2 Global indices of two faces of \a theShape.
1659      *    \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1660      *  \return New GEOM_Object, containing the result shape.
1661
1662      *  Example: see GEOM_TestAll.py
1663     """
1664     anObj = LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
1665     if LocalOp.IsDone() == 0:
1666       print "MakeChamferEdge : ", LocalOp.GetErrorCode()
1667     return anObj
1668
1669 def MakeChamferFaces(theShape, theD1, theD2, theFaces):
1670     """
1671      *  Perform a chamfer on all edges of the specified faces,
1672      *  with distance D1 on the first specified face (if several for one edge)
1673      *  \param theShape Shape, to perform chamfer on.
1674      *  \param theD1 Chamfer size along face from \a theFaces. If both faces,
1675      *               connected to the edge, are in \a theFaces, \a theD1
1676      *               will be get along face, which is nearer to \a theFaces beginning.
1677      *  \param theD2 Chamfer size along another of two faces, connected to the edge.
1678      *  \param theFaces Sequence of global indices of faces of \a theShape.
1679      *    \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1680      *  \return New GEOM_Object, containing the result shape.
1681
1682      *  Example: see GEOM_TestAll.py
1683     """
1684     anObj = LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
1685     if LocalOp.IsDone() == 0:
1686       print "MakeChamferFaces : ", LocalOp.GetErrorCode()
1687     return anObj
1688
1689 def MakeChamfer(aShape,d1,d2,aShapeType,ListShape):
1690     """
1691      *  Shortcut to MakeChamferEdge() and MakeChamferFaces()
1692
1693      *  Example: see GEOM_TestOthers.py
1694     """
1695     anObj = None
1696     if aShapeType == ShapeType["EDGE"]:
1697         anObj = MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
1698     else:
1699         anObj = MakeChamferFaces(aShape,d1,d2,ListShape)
1700     return anObj
1701
1702 def Archimede(theShape, theWeight, theWaterDensity, theMeshDeflection):
1703     """
1704      *  Perform an Archimde operation on the given shape with given parameters.
1705      *                    The object presenting the resulting face is returned
1706      *  \param theShape Shape to be put in water.
1707      *  \param theWeight Weight og the shape.
1708      *  \param theWaterDensity Density of the water.
1709      *  \param theMeshDeflection Deflection of the mesh, using to compute the section.
1710      *  \return New GEOM_Object, containing a section of \a theShape
1711      *          by a plane, corresponding to water level.
1712
1713      *  Example: see GEOM_TestAll.py
1714     """
1715     anObj = LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
1716     if LocalOp.IsDone() == 0:
1717       print "MakeArchimede : ", LocalOp.GetErrorCode()
1718     return anObj
1719
1720 # -----------------------------------------------------------------------------
1721 # Information objects
1722 # -----------------------------------------------------------------------------
1723
1724 def PointCoordinates(Point):
1725     """
1726      *  Get point coordinates
1727      *  \return [x, y, z]
1728
1729      *  Example: see GEOM_TestMeasures.py
1730     """
1731     aTuple = MeasuOp.PointCoordinates(Point)
1732     if MeasuOp.IsDone() == 0:
1733       print "PointCoordinates : ", MeasuOp.GetErrorCode()
1734     return aTuple
1735
1736 def BasicProperties(theShape):
1737     """
1738      *  Get summarized length of all wires,
1739      *  area of surface and volume of the given shape.
1740      *  \param theShape Shape to define properties of.
1741      *  \return [theLength, theSurfArea, theVolume]
1742      *  theLength:   Summarized length of all wires of the given shape.
1743      *  theSurfArea: Area of surface of the given shape.
1744      *  theVolume:   Volume of the given shape.
1745
1746      *  Example: see GEOM_TestMeasures.py
1747     """
1748     aTuple = MeasuOp.GetBasicProperties(theShape)
1749     if MeasuOp.IsDone() == 0:
1750       print "BasicProperties : ", MeasuOp.GetErrorCode()
1751     return aTuple
1752
1753 def BoundingBox(theShape):
1754     """
1755      *  Get parameters of bounding box of the given shape
1756      *  \param theShape Shape to obtain bounding box of.
1757      *  \return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
1758      *  Xmin,Xmax: Limits of shape along OX axis.
1759      *  Ymin,Ymax: Limits of shape along OY axis.
1760      *  Zmin,Zmax: Limits of shape along OZ axis.
1761
1762      *  Example: see GEOM_TestMeasures.py
1763     """
1764     aTuple = MeasuOp.GetBoundingBox(theShape)
1765     if MeasuOp.IsDone() == 0:
1766       print "BoundingBox : ", MeasuOp.GetErrorCode()
1767     return aTuple
1768
1769 def Inertia(theShape):
1770     """
1771      *  Get inertia matrix and moments of inertia of theShape.
1772      *  \param theShape Shape to calculate inertia of.
1773      *  \return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
1774      *  I(1-3)(1-3): Components of the inertia matrix of the given shape.
1775      *  Ix,Iy,Iz:    Moments of inertia of the given shape.
1776
1777      *  Example: see GEOM_TestMeasures.py
1778     """
1779     aTuple = MeasuOp.GetInertia(theShape)
1780     if MeasuOp.IsDone() == 0:
1781       print "Inertia : ", MeasuOp.GetErrorCode()
1782     return aTuple
1783
1784 def MinDistance(theShape1, theShape2):
1785     """
1786      *  Get minimal distance between the given shapes.
1787      *  \param theShape1,theShape2 Shapes to find minimal distance between.
1788      *  \return Value of the minimal distance between the given shapes.
1789
1790      *  Example: see GEOM_TestMeasures.py
1791     """
1792     aTuple = MeasuOp.GetMinDistance(theShape1, theShape2)
1793     if MeasuOp.IsDone() == 0:
1794       print "MinDistance : ", MeasuOp.GetErrorCode()
1795     return aTuple[0]
1796
1797 def Tolerance(theShape):
1798     """
1799      *  Get min and max tolerances of sub-shapes of theShape
1800      *  \param theShape Shape, to get tolerances of.
1801      *  \return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
1802      *  FaceMin,FaceMax: Min and max tolerances of the faces.
1803      *  EdgeMin,EdgeMax: Min and max tolerances of the edges.
1804      *  VertMin,VertMax: Min and max tolerances of the vertices.
1805
1806      *  Example: see GEOM_TestMeasures.py
1807     """
1808     aTuple = MeasuOp.GetTolerance(theShape)
1809     if MeasuOp.IsDone() == 0:
1810       print "Tolerance : ", MeasuOp.GetErrorCode()
1811     return aTuple
1812
1813 def WhatIs(theShape):
1814     """
1815      *  Obtain description of the given shape (number of sub-shapes of each type)
1816      *  \param theShape Shape to be described.
1817      *  \return Description of the given shape.
1818
1819      *  Example: see GEOM_TestMeasures.py
1820     """
1821     aDescr = MeasuOp.WhatIs(theShape)
1822     if MeasuOp.IsDone() == 0:
1823       print "WhatIs : ", MeasuOp.GetErrorCode()
1824     return aDescr
1825
1826 def MakeCDG(theShape):
1827     """
1828      *  Get a point, situated at the centre of mass of theShape.
1829      *  \param theShape Shape to define centre of mass of.
1830      *  \return New GEOM_Object, containing the created point.
1831
1832      *  Example: see GEOM_TestMeasures.py
1833     """
1834     anObj = MeasuOp.GetCentreOfMass(theShape)
1835     if MeasuOp.IsDone() == 0:
1836       print "GetCentreOfMass : ", MeasuOp.GetErrorCode()
1837     return anObj
1838
1839 def CheckShape(theShape):
1840     """
1841      *  Check a topology of the given shape.
1842      *  \param theShape Shape to check validity of.
1843      *  \return TRUE, if the shape "seems to be valid" from the topological point of view.
1844      *  If theShape is invalid, prints a description of problem.
1845
1846      *  Example: see GEOM_TestMeasures.py
1847     """
1848     (IsValid, Status) = MeasuOp.CheckShape(theShape)
1849     if MeasuOp.IsDone() == 0:
1850       print "CheckShape : ", MeasuOp.GetErrorCode()
1851     else:
1852       if IsValid == 0:
1853         print Status
1854     return IsValid
1855
1856 # -----------------------------------------------------------------------------
1857 # Import/Export objects
1858 # -----------------------------------------------------------------------------
1859
1860 def Import(theFileName, theFormatName):
1861     """
1862      *  Import a shape from the BREP or IGES or STEP file
1863      *  (depends on given format) with given name.
1864      *  \param theFileName The file, containing the shape.
1865      *  \param theFormatName Specify format for the file reading.
1866      *         Available formats can be obtained with InsertOp.ImportTranslators() method.
1867      *  \return New GEOM_Object, containing the imported shape.
1868
1869      *  Example: see GEOM_TestOthers.py
1870     """
1871     anObj = InsertOp.Import(theFileName, theFormatName)
1872     if InsertOp.IsDone() == 0:
1873       print "Import : ", InsertOp.GetErrorCode()
1874     return anObj
1875
1876 def ImportBREP(theFileName):
1877     """
1878      *  Shortcut to Import() for BREP format
1879
1880      *  Example: see GEOM_TestOthers.py
1881     """
1882     return Import(theFileName, "BREP")
1883
1884 def ImportIGES(theFileName):
1885     """
1886      *  Shortcut to Import() for IGES format
1887
1888      *  Example: see GEOM_TestOthers.py
1889     """
1890     return Import(theFileName, "IGES")
1891
1892 def ImportSTEP(theFileName):
1893     """
1894      *  Shortcut to Import() for STEP format
1895
1896      *  Example: see GEOM_TestOthers.py
1897     """
1898     return Import(theFileName, "STEP")
1899
1900 def Export(theObject, theFileName, theFormatName):
1901     """
1902      *  Export the given shape into a file with given name.
1903      *  \param theObject Shape to be stored in the file.
1904      *  \param theFileName Name of the file to store the given shape in.
1905      *  \param theFormatName Specify format for the shape storage.
1906      *         Available formats can be obtained with InsertOp.ImportTranslators() method.
1907
1908      *  Example: see GEOM_TestOthers.py
1909     """
1910     InsertOp.Export(theObject, theFileName, theFormatName)
1911     if InsertOp.IsDone() == 0:
1912       print "Export : ", InsertOp.GetErrorCode()
1913
1914 def ExportBREP(theObject, theFileName):
1915     """
1916      *  Shortcut to Export() for BREP format
1917
1918      *  Example: see GEOM_TestOthers.py
1919     """
1920     return Export(theObject, theFileName, "BREP")
1921
1922 def ExportIGES(theObject, theFileName):
1923     """
1924      *  Shortcut to Export() for IGES format
1925
1926      *  Example: see GEOM_TestOthers.py
1927     """
1928     return Export(theObject, theFileName, "IGES")
1929
1930 def ExportSTEP(theObject, theFileName):
1931     """
1932      *  Shortcut to Export() for STEP format
1933
1934      *  Example: see GEOM_TestOthers.py
1935     """
1936     return Export(theObject, theFileName, "STEP")
1937
1938 # -----------------------------------------------------------------------------
1939 # Block operations
1940 # -----------------------------------------------------------------------------
1941
1942 def MakeQuad(E1, E2, E3, E4):
1943     """
1944      *  Create a quadrangle face from four edges. Order of Edges is not
1945      *  important. It is  not necessary that edges share the same vertex.
1946      *  \param E1,E2,E3,E4 Edges for the face bound.
1947      *  \return New GEOM_Object, containing the created face.
1948
1949      *  Example: see GEOM_Spanner.py
1950     """
1951     anObj = BlocksOp.MakeQuad(E1, E2, E3, E4)
1952     if BlocksOp.IsDone() == 0:
1953       print "MakeQuad : ", BlocksOp.GetErrorCode()
1954     return anObj
1955
1956 def MakeQuad2Edges(E1, E2):
1957     """
1958      *  Create a quadrangle face on two edges.
1959      *  The missing edges will be built by creating the shortest ones.
1960      *  \param E1,E2 Two opposite edges for the face.
1961      *  \return New GEOM_Object, containing the created face.
1962
1963      *  Example: see GEOM_Spanner.py
1964     """
1965     anObj = BlocksOp.MakeQuad2Edges(E1, E2)
1966     if BlocksOp.IsDone() == 0:
1967       print "MakeQuad2Edges : ", BlocksOp.GetErrorCode()
1968     return anObj
1969
1970 def MakeQuad4Vertices(V1, V2, V3, V4):
1971     """
1972      *  Create a quadrangle face with specified corners.
1973      *  The missing edges will be built by creating the shortest ones.
1974      *  \param V1,V2,V3,V4 Corner vertices for the face.
1975      *  \return New GEOM_Object, containing the created face.
1976
1977      *  Example: see GEOM_Spanner.py
1978     """
1979     anObj = BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
1980     if BlocksOp.IsDone() == 0:
1981       print "MakeQuad4Vertices : ", BlocksOp.GetErrorCode()
1982     return anObj
1983
1984 def MakeHexa(F1, F2, F3, F4, F5, F6):
1985     """
1986      *  Create a hexahedral solid, bounded by the six given faces. Order of
1987      *  faces is not important. It is  not necessary that Faces share the same edge.
1988      *  \param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
1989      *  \return New GEOM_Object, containing the created solid.
1990
1991      *  Example: see GEOM_Spanner.py
1992     """
1993     anObj = BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
1994     if BlocksOp.IsDone() == 0:
1995       print "MakeHexa : ", BlocksOp.GetErrorCode()
1996     return anObj
1997
1998 def MakeHexa2Faces(F1, F2):
1999     """
2000      *  Create a hexahedral solid between two given faces.
2001      *  The missing faces will be built by creating the smallest ones.
2002      *  \param F1,F2 Two opposite faces for the hexahedral solid.
2003      *  \return New GEOM_Object, containing the created solid.
2004
2005      *  Example: see GEOM_Spanner.py
2006     """
2007     anObj = BlocksOp.MakeHexa2Faces(F1, F2)
2008     if BlocksOp.IsDone() == 0:
2009       print "MakeHexa2Faces : ", BlocksOp.GetErrorCode()
2010     return anObj
2011
2012 def GetPoint(theShape, theX, theY, theZ, theEpsilon):
2013     """
2014      *  Get a vertex, found in the given shape by its coordinates.
2015      *  \param theShape Block or a compound of blocks.
2016      *  \param theX,theY,theZ Coordinates of the sought vertex.
2017      *  \param theEpsilon Maximum allowed distance between the resulting
2018      *                    vertex and point with the given coordinates.
2019      *  \return New GEOM_Object, containing the found vertex.
2020
2021      *  Example: see GEOM_TestOthers.py
2022     """
2023     anObj = BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
2024     if BlocksOp.IsDone() == 0:
2025       print "GetPoint : ", BlocksOp.GetErrorCode()
2026     return anObj
2027
2028 def GetEdge(theShape, thePoint1, thePoint2):
2029     """
2030      *  Get an edge, found in the given shape by two given vertices.
2031      *  \param theShape Block or a compound of blocks.
2032      *  \param thePoint1,thePoint2 Points, close to the ends of the desired edge.
2033      *  \return New GEOM_Object, containing the found edge.
2034
2035      *  Example: see GEOM_Spanner.py
2036     """
2037     anObj = BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
2038     if BlocksOp.IsDone() == 0:
2039       print "GetEdge : ", BlocksOp.GetErrorCode()
2040     return anObj
2041
2042 def GetEdgeNearPoint(theShape, thePoint):
2043     """
2044      *  Find an edge of the given shape, which has minimal distance to the given point.
2045      *  \param theShape Block or a compound of blocks.
2046      *  \param thePoint Point, close to the desired edge.
2047      *  \return New GEOM_Object, containing the found edge.
2048
2049      *  Example: see GEOM_TestOthers.py
2050     """
2051     anObj = BlocksOp.GetEdgeNearPoint(theShape, thePoint)
2052     if BlocksOp.IsDone() == 0:
2053       print "GetEdgeNearPoint : ", BlocksOp.GetErrorCode()
2054     return anObj
2055
2056 def GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4):
2057     """
2058      *  Returns a face, found in the given shape by four given corner vertices.
2059      *  \param theShape Block or a compound of blocks.
2060      *  \param thePoint1-thePoint4 Points, close to the corners of the desired face.
2061      *  \return New GEOM_Object, containing the found face.
2062
2063      *  Example: see GEOM_Spanner.py
2064     """
2065     anObj = BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
2066     if BlocksOp.IsDone() == 0:
2067       print "GetFaceByPoints : ", BlocksOp.GetErrorCode()
2068     return anObj
2069
2070 def GetFaceByEdges(theShape, theEdge1, theEdge2):
2071     """
2072      *  Get a face of block, found in the given shape by two given edges.
2073      *  \param theShape Block or a compound of blocks.
2074      *  \param theEdge1,theEdge2 Edges, close to the edges of the desired face.
2075      *  \return New GEOM_Object, containing the found face.
2076
2077      *  Example: see GEOM_Spanner.py
2078     """
2079     anObj = BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
2080     if BlocksOp.IsDone() == 0:
2081       print "GetFaceByEdges : ", BlocksOp.GetErrorCode()
2082     return anObj
2083
2084 def GetOppositeFace(theBlock, theFace):
2085     """
2086      *  Find a face, opposite to the given one in the given block.
2087      *  \param theBlock Must be a hexahedral solid.
2088      *  \param theFace Face of \a theBlock, opposite to the desired face.
2089      *  \return New GEOM_Object, containing the found face.
2090
2091      *  Example: see GEOM_Spanner.py
2092     """
2093     anObj = BlocksOp.GetOppositeFace(theBlock, theFace)
2094     if BlocksOp.IsDone() == 0:
2095       print "GetOppositeFace : ", BlocksOp.GetErrorCode()
2096     return anObj
2097
2098 def GetFaceNearPoint(theShape, thePoint):
2099     """
2100      *  Find a face of the given shape, which has minimal distance to the given point.
2101      *  \param theShape Block or a compound of blocks.
2102      *  \param thePoint Point, close to the desired face.
2103      *  \return New GEOM_Object, containing the found face.
2104
2105      *  Example: see GEOM_Spanner.py
2106     """
2107     anObj = BlocksOp.GetFaceNearPoint(theShape, thePoint)
2108     if BlocksOp.IsDone() == 0:
2109       print "GetFaceNearPoint : ", BlocksOp.GetErrorCode()
2110     return anObj
2111
2112 def GetFaceByNormale(theBlock, theVector):
2113     """
2114      *  Find a face of block, whose outside normale has minimal angle with the given vector.
2115      *  \param theShape Block or a compound of blocks.
2116      *  \param theVector Vector, close to the normale of the desired face.
2117      *  \return New GEOM_Object, containing the found face.
2118
2119      *  Example: see GEOM_Spanner.py
2120     """
2121     anObj = BlocksOp.GetFaceByNormale(theBlock, theVector)
2122     if BlocksOp.IsDone() == 0:
2123       print "GetFaceByNormale : ", BlocksOp.GetErrorCode()
2124     return anObj
2125
2126 def CheckCompoundOfBlocks(theCompound):
2127     """
2128      *  Check, if the compound of blocks is given.
2129      *  To be considered as a compound of blocks, the
2130      *  given shape must satisfy the following conditions:
2131      *  - Each element of the compound should be a Block (6 faces and 12 edges).
2132      *  - A connection between two Blocks should be an entire quadrangle face or an entire edge.
2133      *  - The compound should be connexe.
2134      *  - The glue between two quadrangle faces should be applied.
2135      *  \param theCompound The compound to check.
2136      *  \return TRUE, if the given shape is a compound of blocks.
2137      *  If theCompound is not valid, prints all discovered errors.
2138
2139      *  Example: see GEOM_Spanner.py
2140     """
2141     (IsValid, BCErrors) = BlocksOp.CheckCompoundOfBlocks(theCompound)
2142     if BlocksOp.IsDone() == 0:
2143       print "CheckCompoundOfBlocks : ", BlocksOp.GetErrorCode()
2144     else:
2145       if IsValid == 0:
2146         Descr = BlocksOp.PrintBCErrors(theCompound, BCErrors)
2147         print Descr
2148     return IsValid
2149
2150 def RemoveExtraEdges(theShape):
2151     """
2152      *  Remove all seam and degenerated edges from \a theShape.
2153      *  Unite faces and edges, sharing one surface.
2154      *  \param theShape The compound or single solid to remove irregular edges from.
2155      *  \return Improved shape.
2156
2157      *  Example: see GEOM_TestOthers.py
2158     """
2159     anObj = BlocksOp.RemoveExtraEdges(theShape)
2160     if BlocksOp.IsDone() == 0:
2161       print "RemoveExtraEdges : ", BlocksOp.GetErrorCode()
2162     return anObj
2163
2164 def CheckAndImprove(theShape):
2165     """
2166      *  Check, if the given shape is a blocks compound.
2167      *  Fix all detected errors.
2168      *    \note Single block can be also fixed by this method.
2169      *  \param theCompound The compound to check and improve.
2170      *  \return Improved compound.
2171
2172      *  Example: see GEOM_TestOthers.py
2173     """
2174     anObj = BlocksOp.CheckAndImprove(theShape)
2175     if BlocksOp.IsDone() == 0:
2176       print "CheckAndImprove : ", BlocksOp.GetErrorCode()
2177     return anObj
2178
2179 def MakeBlockExplode(theCompound, theMinNbFaces, theMaxNbFaces):
2180     """
2181      *  Get all the blocks, contained in the given compound.
2182      *  \param theCompound The compound to explode.
2183      *  \param theMinNbFaces If solid has lower number of faces, it is not a block.
2184      *  \param theMaxNbFaces If solid has higher number of faces, it is not a block.
2185      *    \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
2186      *  \return List of GEOM_Objects, containing the retrieved blocks.
2187
2188      *  Example: see GEOM_TestOthers.py
2189     """
2190     aList = BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
2191     if BlocksOp.IsDone() == 0:
2192       print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
2193     return aList
2194
2195 def GetBlockNearPoint(theCompound, thePoint):
2196     """
2197      *  Find block, containing the given point inside its volume or on boundary.
2198      *  \param theCompound Compound, to find block in.
2199      *  \param thePoint Point, close to the desired block. If the point lays on
2200      *         boundary between some blocks, we return block with nearest center.
2201      *  \return New GEOM_Object, containing the found block.
2202
2203      *  Example: see GEOM_Spanner.py
2204     """
2205     anObj = BlocksOp.GetBlockNearPoint(theCompound, thePoint)
2206     if BlocksOp.IsDone() == 0:
2207       print "GetBlockNearPoint : ", BlocksOp.GetErrorCode()
2208     return anObj
2209
2210 def GetBlockByParts(theCompound, theParts):
2211     """
2212      *  Find block, containing all the elements, passed as the parts, or maximum quantity of them.
2213      *  \param theCompound Compound, to find block in.
2214      *  \param theParts List of faces and/or edges and/or vertices to be parts of the found block.
2215      *  \return New GEOM_Object, containing the found block.
2216
2217      *  Example: see GEOM_TestOthers.py
2218     """
2219     anObj = BlocksOp.GetBlockByParts(theCompound, theParts)
2220     if BlocksOp.IsDone() == 0:
2221       print "GetBlockByParts : ", BlocksOp.GetErrorCode()
2222     return anObj
2223
2224 def GetBlocksByParts(theCompound, theParts):
2225     """
2226      *  Return all blocks, containing all the elements, passed as the parts.
2227      *  \param theCompound Compound, to find blocks in.
2228      *  \param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
2229      *  \return List of GEOM_Objects, containing the found blocks.
2230
2231      *  Example: see GEOM_Spanner.py
2232     """
2233     aList = BlocksOp.GetBlocksByParts(theCompound, theParts)
2234     if BlocksOp.IsDone() == 0:
2235       print "GetBlocksByParts : ", BlocksOp.GetErrorCode()
2236     return aList
2237
2238 def MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes):
2239     """
2240      *  Multi-transformate block and glue the result.
2241      *  Transformation is defined so, as to superpose direction faces.
2242      *  \param Block Hexahedral solid to be multi-transformed.
2243      *  \param DirFace1 ID of First direction face.
2244      *  \param DirFace2 ID of Second direction face.
2245      *  \param NbTimes Quantity of transformations to be done.
2246      *    \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
2247      *  \return New GEOM_Object, containing the result shape.
2248
2249      *  Example: see GEOM_Spanner.py
2250     """
2251     anObj = BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
2252     if BlocksOp.IsDone() == 0:
2253       print "MakeMultiTransformation1D : ", BlocksOp.GetErrorCode()
2254     return anObj
2255
2256 def MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
2257                                      DirFace1V, DirFace2V, NbTimesV):
2258     """
2259      *  Multi-transformate block and glue the result.
2260      *  \param Block Hexahedral solid to be multi-transformed.
2261      *  \param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
2262      *  \param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
2263      *  \param NbTimesU,NbTimesV Quantity of transformations to be done.
2264      *  \return New GEOM_Object, containing the result shape.
2265
2266      *  Example: see GEOM_Spanner.py
2267     """
2268     anObj = BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
2269                                                       DirFace1V, DirFace2V, NbTimesV)
2270     if BlocksOp.IsDone() == 0:
2271       print "MakeMultiTransformation2D : ", BlocksOp.GetErrorCode()
2272     return anObj
2273
2274 def Propagate(theShape):
2275     """
2276      *  Build all possible propagation groups.
2277      *  Propagation group is a set of all edges, opposite to one (main)
2278      *  edge of this group directly or through other opposite edges.
2279      *  Notion of Opposite Edge make sence only on quadrangle face.
2280      *  \param theShape Shape to build propagation groups on.
2281      *  \return List of GEOM_Objects, each of them is a propagation group.
2282
2283      *  Example: see GEOM_TestOthers.py
2284     """
2285     listChains = BlocksOp.Propagate(theShape)
2286     if BlocksOp.IsDone() == 0:
2287       print "Propagate : ", BlocksOp.GetErrorCode()
2288     return listChains
2289
2290 # -----------------------------------------------------------------------------
2291 # Group operations
2292 # -----------------------------------------------------------------------------
2293
2294 def CreateGroup(theMainShape, theShapeType):
2295     """
2296      *  Creates a new group which will store sub shapes of theMainShape
2297      *  \param theMainShape is a GEOM object on which the group is selected
2298      *  \param theShapeType defines a shape type of the group
2299      *  \return a newly created GEOM group
2300
2301      *  Example: see GEOM_TestOthers.py
2302     """
2303     anObj = GroupOp.CreateGroup(theMainShape, theShapeType)
2304     if GroupOp.IsDone() == 0:
2305        print "CreateGroup : ", GroupOp.GetErrorCode()
2306     return anObj
2307
2308 def AddObject(theGroup, theSubShapeID):
2309     """
2310      *  Adds a sub object with ID theSubShapeId to the group
2311      *  \param theGroup is a GEOM group to which the new sub shape is added
2312      *  \param theSubShapeID is a sub shape ID in the main object.
2313      *  \note Use method GetSubShapeID() to get an unique ID of the sub shape
2314
2315      *  Example: see GEOM_TestOthers.py
2316     """
2317     GroupOp.AddObject(theGroup, theSubShapeID)
2318     if GroupOp.IsDone() == 0:
2319       print "AddObject : ", GroupOp.GetErrorCode()
2320
2321 def RemoveObject(theGroup, theSubShapeID):
2322     """
2323      *  Removes a sub object with ID \a theSubShapeId from the group
2324      *  \param theGroup is a GEOM group from which the new sub shape is removed
2325      *  \param theSubShapeID is a sub shape ID in the main object.
2326      *  \note Use method GetSubShapeID() to get an unique ID of the sub shape
2327
2328      *  Example: see GEOM_TestOthers.py
2329     """
2330     GroupOp.RemoveObject(theGroup, theSubShapeID)
2331     if GroupOp.IsDone() == 0:
2332       print "RemoveObject : ", GroupOp.GetErrorCode()
2333
2334 def UnionList (theGroup, theSubShapes):
2335     """
2336      *  Adds to the group all the given shapes. No errors, if some shapes are alredy included.
2337      *  \param theGroup is a GEOM group to which the new sub shapes are added.
2338      *  \param theSubShapes is a list of sub shapes to be added.
2339
2340      *  Example: see GEOM_TestOthers.py
2341     """
2342     GroupOp.UnionList(theGroup, theSubShapes)
2343     if GroupOp.IsDone() == 0:
2344       print "UnionList : ", GroupOp.GetErrorCode()
2345
2346 def DifferenceList (theGroup, theSubShapes):
2347     """
2348      *  Removes from the group all the given shapes. No errors, if some shapes are not included.
2349      *  \param theGroup is a GEOM group from which the sub-shapes are removed.
2350      *  \param theSubShapes is a list of sub-shapes to be removed.
2351
2352      *  Example: see GEOM_TestOthers.py
2353     """
2354     GroupOp.DifferenceList(theGroup, theSubShapes)
2355     if GroupOp.IsDone() == 0:
2356       print "DifferenceList : ", GroupOp.GetErrorCode()
2357
2358 def GetObjectIDs(theGroup):
2359     """
2360      *  Returns a list of sub objects ID stored in the group
2361      *  \param theGroup is a GEOM group for which a list of IDs is requested
2362
2363      *  Example: see GEOM_TestOthers.py
2364     """
2365     ListIDs = GroupOp.GetObjects(theGroup)
2366     if GroupOp.IsDone() == 0:
2367       print "GetObjectIDs : ", GroupOp.GetErrorCode()
2368     return ListIDs
2369
2370 def GetType(theGroup):
2371     """
2372      *  Returns a type of sub objects stored in the group
2373      *  \param theGroup is a GEOM group which type is returned.
2374
2375      *  Example: see GEOM_TestOthers.py
2376     """
2377     aType = GroupOp.GetType(theGroup)
2378     if GroupOp.IsDone() == 0:
2379       print "GetType : ", GroupOp.GetErrorCode()
2380     return aType
2381
2382 def GetMainShape(theGroup):
2383     """
2384      *  Returns a main shape associated with the group
2385      *  \param theGroup is a GEOM group for which a main shape object is requested
2386      *  \return a GEOM object which is a main shape for theGroup
2387
2388      *  Example: see GEOM_TestOthers.py
2389     """
2390     anObj = GroupOp.GetMainShape(theGroup)
2391     if GroupOp.IsDone() == 0:
2392       print "GetMainShape : ", GroupOp.GetErrorCode()
2393     return anObj
2394
2395 def addPath(Path):
2396     """
2397      * Add Path to load python scripts from
2398     """
2399     if (sys.path.count(Path) < 1):
2400         sys.path.append(Path)