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