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