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