Salome HOME
NPAL 12483 Translate an object given a vector and a length
[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         ## Translate the given object along the given vector on given distance,
1619         #  creating its copy before the translation.
1620         #  @param theObject The object to be translated.
1621         #  @param theVector The translation vector.
1622         #  @param theDistance The translation distance.
1623         #  @return New GEOM_Object, containing the translated object.
1624         #
1625         #  Example: see GEOM_TestAll.py
1626         def MakeTranslationVectorDistance(self,theObject, theVector, theDistance):
1627             anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
1628             RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
1629             return anObj
1630         
1631         ## Rotate the given object around the given axis
1632         #  on the given angle, creating its copy before the rotatation.
1633         #  @param theObject The object to be rotated.
1634         #  @param theAxis Rotation axis.
1635         #  @param theAngle Rotation angle in radians.
1636         #  @return New GEOM_Object, containing the rotated object.
1637         #
1638         #  Example: see GEOM_TestAll.py
1639         def MakeRotation(self,theObject, theAxis, theAngle):
1640             anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
1641             RaiseIfFailed("RotateCopy", self.TrsfOp)
1642             return anObj
1643         
1644         ## Rotate given object around vector perpendicular to plane
1645         #  containing three points, creating its copy before the rotatation.
1646         #  @param theObject The object to be rotated.
1647         #  @param theCentPoint central point - the axis is the vector perpendicular to the plane
1648         #  containing the three points.
1649         #  @param thePoint1 and thePoint2 - in a perpendicular plan of the axis.
1650         #  @return New GEOM_Object, containing the rotated object.
1651         #
1652         #  Example: see GEOM_TestAll.py
1653         def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
1654             anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
1655             RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
1656             return anObj
1657         
1658         ## Scale the given object by the factor, creating its copy before the scaling.
1659         #  @param theObject The object to be scaled.
1660         #  @param thePoint Center point for scaling.
1661         #  @param theFactor Scaling factor value.
1662         #  @return New GEOM_Object, containing the scaled shape.
1663         #
1664         #  Example: see GEOM_TestAll.py
1665         def MakeScaleTransform(self,theObject, thePoint, theFactor):
1666             anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
1667             RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
1668             return anObj
1669         
1670         ## Create an object, symmetrical
1671         #  to the given one relatively the given plane.
1672         #  @param theObject The object to be mirrored.
1673         #  @param thePlane Plane of symmetry.
1674         #  @return New GEOM_Object, containing the mirrored shape.
1675         #
1676         #  Example: see GEOM_TestAll.py
1677         def MakeMirrorByPlane(self,theObject, thePlane):
1678             anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
1679             RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
1680             return anObj
1681         
1682         ## Create an object, symmetrical
1683         #  to the given one relatively the given axis.
1684         #  @param theObject The object to be mirrored.
1685         #  @param theAxis Axis of symmetry.
1686         #  @return New GEOM_Object, containing the mirrored shape.
1687         #
1688         #  Example: see GEOM_TestAll.py
1689         def MakeMirrorByAxis(self,theObject, theAxis):
1690             anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
1691             RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
1692             return anObj
1693         
1694         ## Create an object, symmetrical
1695         #  to the given one relatively the given point.
1696         #  @param theObject The object to be mirrored.
1697         #  @param thePoint Point of symmetry.
1698         #  @return New GEOM_Object, containing the mirrored shape.
1699         #
1700         #  Example: see GEOM_TestAll.py
1701         def MakeMirrorByPoint(self,theObject, thePoint):
1702             anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
1703             RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
1704             return anObj
1705         
1706         ## Modify the Location of the given object by LCS,
1707         #  creating its copy before the setting.
1708         #  @param theObject The object to be displaced.
1709         #  @param theStartLCS Coordinate system to perform displacement from it.
1710         #                     If \a theStartLCS is NULL, displacement
1711         #                     will be performed from global CS.
1712         #                     If \a theObject itself is used as \a theStartLCS,
1713         #                     its location will be changed to \a theEndLCS.
1714         #  @param theEndLCS Coordinate system to perform displacement to it.
1715         #  @return New GEOM_Object, containing the displaced shape.
1716         #
1717         #  Example: see GEOM_TestAll.py
1718         def MakePosition(self,theObject, theStartLCS, theEndLCS):
1719             anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
1720             RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
1721             return anObj
1722         
1723         ## Create new object as offset of the given one.
1724         #  @param theObject The base object for the offset.
1725         #  @param theOffset Offset value.
1726         #  @return New GEOM_Object, containing the offset object.
1727         #
1728         #  Example: see GEOM_TestAll.py
1729         def MakeOffset(self,theObject, theOffset):
1730             anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
1731             RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
1732             return anObj
1733         
1734         # -----------------------------------------------------------------------------
1735         # Patterns
1736         # -----------------------------------------------------------------------------
1737         
1738         ## Translate the given object along the given vector a given number times
1739         #  @param theObject The object to be translated.
1740         #  @param theVector Direction of the translation.
1741         #  @param theStep Distance to translate on.
1742         #  @param theNbTimes Quantity of translations to be done.
1743         #  @return New GEOM_Object, containing compound of all
1744         #          the shapes, obtained after each translation.
1745         #
1746         #  Example: see GEOM_TestAll.py
1747         def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
1748             anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
1749             RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
1750             return anObj
1751         
1752         ## Conseqently apply two specified translations to theObject specified number of times.
1753         #  @param theObject The object to be translated.
1754         #  @param theVector1 Direction of the first translation.
1755         #  @param theStep1 Step of the first translation.
1756         #  @param theNbTimes1 Quantity of translations to be done along theVector1.
1757         #  @param theVector2 Direction of the second translation.
1758         #  @param theStep2 Step of the second translation.
1759         #  @param theNbTimes2 Quantity of translations to be done along theVector2.
1760         #  @return New GEOM_Object, containing compound of all
1761         #          the shapes, obtained after each translation.
1762         #
1763         #  Example: see GEOM_TestAll.py
1764         def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
1765                                    theVector2, theStep2, theNbTimes2):
1766             anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1,
1767                                                  theVector2, theStep2, theNbTimes2)
1768             RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
1769             return anObj
1770         
1771         ## Rotate the given object around the given axis a given number times.
1772         #  Rotation angle will be 2*PI/theNbTimes.
1773         #  @param theObject The object to be rotated.
1774         #  @param theAxis The rotation axis.
1775         #  @param theNbTimes Quantity of rotations to be done.
1776         #  @return New GEOM_Object, containing compound of all the
1777         #          shapes, obtained after each rotation.
1778         #
1779         #  Example: see GEOM_TestAll.py
1780         def MultiRotate1D(self,theObject, theAxis, theNbTimes):
1781             anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
1782             RaiseIfFailed("MultiRotate1D", self.TrsfOp)
1783             return anObj
1784         
1785         ## Rotate the given object around the
1786         #  given axis on the given angle a given number
1787         #  times and multi-translate each rotation result.
1788         #  Translation direction passes through center of gravity
1789         #  of rotated shape and its projection on the rotation axis.
1790         #  @param theObject The object to be rotated.
1791         #  @param theAxis Rotation axis.
1792         #  @param theAngle Rotation angle in graduces.
1793         #  @param theNbTimes1 Quantity of rotations to be done.
1794         #  @param theStep Translation distance.
1795         #  @param theNbTimes2 Quantity of translations to be done.
1796         #  @return New GEOM_Object, containing compound of all the
1797         #          shapes, obtained after each transformation.
1798         #
1799         #  Example: see GEOM_TestAll.py
1800         def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
1801             anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
1802             RaiseIfFailed("MultiRotate2D", self.TrsfOp)
1803             return anObj
1804         
1805         ## The same, as MultiRotate1D(), but axis is given by direction and point
1806         #
1807         #  Example: see GEOM_TestOthers.py
1808         def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
1809             aVec = self.MakeLine(aPoint,aDir)
1810             anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
1811             return anObj
1812         
1813         ## The same, as MultiRotate2D(), but axis is given by direction and point
1814         #
1815         #  Example: see GEOM_TestOthers.py
1816         def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
1817             aVec = self.MakeLine(aPoint,aDir)
1818             anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
1819             return anObj
1820         
1821         # -----------------------------------------------------------------------------
1822         # Local operations
1823         # -----------------------------------------------------------------------------
1824         
1825         ## Perform a fillet on all edges of the given shape.
1826         #  @param theShape Shape, to perform fillet on.
1827         #  @param theR Fillet radius.
1828         #  @return New GEOM_Object, containing the result shape.
1829         #
1830         #  Example: see GEOM_TestOthers.py
1831         def MakeFilletAll(self,theShape, theR):
1832             anObj = self.LocalOp.MakeFilletAll(theShape, theR)
1833             RaiseIfFailed("MakeFilletAll", self.LocalOp)
1834             return anObj
1835         
1836         ## Perform a fillet on the specified edges/faces of the given shape
1837         #  @param theShape Shape, to perform fillet on.
1838         #  @param theR Fillet radius.
1839         #  @param theShapeType Type of shapes in <theListShapes>.
1840         #  @param theListShapes Global indices of edges/faces to perform fillet on.
1841         #    \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1842         #  @return New GEOM_Object, containing the result shape.
1843         #
1844         #  Example: see GEOM_TestAll.py
1845         def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
1846             anObj = None
1847             if theShapeType == ShapeType["EDGE"]:
1848                 anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes)
1849                 RaiseIfFailed("MakeFilletEdges", self.LocalOp)
1850             else:
1851                 anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
1852                 RaiseIfFailed("MakeFilletFaces", self.LocalOp)
1853             return anObj
1854         
1855         ## The same that MakeFillet but with two Fillet Radius R1 and R2
1856         def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
1857             anObj = None
1858             if theShapeType == ShapeType["EDGE"]:
1859                 anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes)
1860                 RaiseIfFailed("MakeFilletEdgesR1R2", self.LocalOp)
1861             else:
1862                 anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
1863                 RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
1864             return anObj
1865         
1866         ## Perform a symmetric chamfer on all edges of the given shape.
1867         #  @param theShape Shape, to perform chamfer on.
1868         #  @param theD Chamfer size along each face.
1869         #  @return New GEOM_Object, containing the result shape.
1870         #
1871         #  Example: see GEOM_TestOthers.py
1872         def MakeChamferAll(self,theShape, theD):
1873             anObj = self.LocalOp.MakeChamferAll(theShape, theD)
1874             RaiseIfFailed("MakeChamferAll", self.LocalOp)
1875             return anObj
1876         
1877         ## Perform a chamfer on edges, common to the specified faces,
1878         #  with distance D1 on the Face1
1879         #  @param theShape Shape, to perform chamfer on.
1880         #  @param theD1 Chamfer size along \a theFace1.
1881         #  @param theD2 Chamfer size along \a theFace2.
1882         #  @param theFace1,theFace2 Global indices of two faces of \a theShape.
1883         #    \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1884         #  @return New GEOM_Object, containing the result shape.
1885         #
1886         #  Example: see GEOM_TestAll.py
1887         def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
1888             anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
1889             RaiseIfFailed("MakeChamferEdge", self.LocalOp)
1890             return anObj
1891         
1892         ## The Same that MakeChamferEdge but with params theD is chamfer lenght and
1893         #  theAngle is Angle of chamfer (angle in radians)
1894         def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
1895             anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
1896             RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
1897             return anObj
1898         
1899         ## Perform a chamfer on all edges of the specified faces,
1900         #  with distance D1 on the first specified face (if several for one edge)
1901         #  @param theShape Shape, to perform chamfer on.
1902         #  @param theD1 Chamfer size along face from \a theFaces. If both faces,
1903         #               connected to the edge, are in \a theFaces, \a theD1
1904         #               will be get along face, which is nearer to \a theFaces beginning.
1905         #  @param theD2 Chamfer size along another of two faces, connected to the edge.
1906         #  @param theFaces Sequence of global indices of faces of \a theShape.
1907         #    \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
1908         #  @return New GEOM_Object, containing the result shape.
1909         #
1910         #  Example: see GEOM_TestAll.py
1911         def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
1912             anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
1913             RaiseIfFailed("MakeChamferFaces", self.LocalOp)
1914             return anObj
1915         
1916         ## The Same that MakeChamferFaces but with params theD is chamfer lenght and
1917         #  theAngle is Angle of chamfer (angle in radians)
1918         def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
1919             anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
1920             RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
1921             return anObj
1922         
1923         ## Perform a chamfer on edges,
1924         #  with distance D1 on the first specified face (if several for one edge)
1925         #  @param theShape Shape, to perform chamfer on.
1926         #  @param theD1 and theD2 Chamfer size 
1927         #  @param theEdges Sequence of edges of \a theShape.
1928         #  @return New GEOM_Object, containing the result shape.
1929         #
1930         #  Example:
1931         def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
1932             anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
1933             RaiseIfFailed("MakeChamferEdges", self.LocalOp)
1934             return anObj
1935         
1936         ## The Same that MakeChamferEdges but with params theD is chamfer lenght and
1937         #  theAngle is Angle of chamfer (angle in radians)
1938         def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
1939             anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
1940             RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
1941             return anObj
1942         
1943         ## Shortcut to MakeChamferEdge() and MakeChamferFaces()
1944         #
1945         #  Example: see GEOM_TestOthers.py
1946         def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
1947             anObj = None
1948             if aShapeType == ShapeType["EDGE"]:
1949                 anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
1950             else:
1951                 anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
1952             return anObj
1953         
1954         ## Perform an Archimde operation on the given shape with given parameters.
1955         #  The object presenting the resulting face is returned.
1956         #  @param theShape Shape to be put in water.
1957         #  @param theWeight Weight og the shape.
1958         #  @param theWaterDensity Density of the water.
1959         #  @param theMeshDeflection Deflection of the mesh, using to compute the section.
1960         #  @return New GEOM_Object, containing a section of \a theShape
1961         #          by a plane, corresponding to water level.
1962         #
1963         #  Example: see GEOM_TestAll.py
1964         def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
1965             anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
1966             RaiseIfFailed("MakeArchimede", self.LocalOp)
1967             return anObj
1968         
1969         # -----------------------------------------------------------------------------
1970         # Information objects
1971         # -----------------------------------------------------------------------------
1972         
1973         ## Get point coordinates
1974         #  @return [x, y, z]
1975         #
1976         #  Example: see GEOM_TestMeasures.py
1977         def PointCoordinates(self,Point):
1978             aTuple = self.MeasuOp.PointCoordinates(Point)
1979             RaiseIfFailed("PointCoordinates", self.MeasuOp)
1980             return aTuple
1981         
1982         ## Get summarized length of all wires,
1983         #  area of surface and volume of the given shape.
1984         #  @param theShape Shape to define properties of.
1985         #  @return [theLength, theSurfArea, theVolume]
1986         #  theLength:   Summarized length of all wires of the given shape.
1987         #  theSurfArea: Area of surface of the given shape.
1988         #  theVolume:   Volume of the given shape.
1989         #
1990         #  Example: see GEOM_TestMeasures.py
1991         def BasicProperties(self,theShape):
1992             aTuple = self.MeasuOp.GetBasicProperties(theShape)
1993             RaiseIfFailed("GetBasicProperties", self.MeasuOp)
1994             return aTuple
1995         
1996         ## Get parameters of bounding box of the given shape
1997         #  @param theShape Shape to obtain bounding box of.
1998         #  @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
1999         #  Xmin,Xmax: Limits of shape along OX axis.
2000         #  Ymin,Ymax: Limits of shape along OY axis.
2001         #  Zmin,Zmax: Limits of shape along OZ axis.
2002         #
2003         #  Example: see GEOM_TestMeasures.py
2004         def BoundingBox(self,theShape):
2005             aTuple = self.MeasuOp.GetBoundingBox(theShape)
2006             RaiseIfFailed("GetBoundingBox", self.MeasuOp)
2007             return aTuple
2008         
2009         ## Get inertia matrix and moments of inertia of theShape.
2010         #  @param theShape Shape to calculate inertia of.
2011         #  @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
2012         #  I(1-3)(1-3): Components of the inertia matrix of the given shape.
2013         #  Ix,Iy,Iz:    Moments of inertia of the given shape.
2014         #
2015         #  Example: see GEOM_TestMeasures.py
2016         def Inertia(self,theShape):
2017             aTuple = self.MeasuOp.GetInertia(theShape)
2018             RaiseIfFailed("GetInertia", self.MeasuOp)
2019             return aTuple
2020         
2021         ## Get minimal distance between the given shapes.
2022         #  @param theShape1,theShape2 Shapes to find minimal distance between.
2023         #  @return Value of the minimal distance between the given shapes.
2024         #
2025         #  Example: see GEOM_TestMeasures.py
2026         def MinDistance(self, theShape1, theShape2):
2027             aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2028             RaiseIfFailed("GetMinDistance", self.MeasuOp)
2029             return aTuple[0]
2030
2031         ## Get minimal distance between the given shapes.
2032         #  @param theShape1,theShape2 Shapes to find minimal distance between.
2033         #  @return Value of the minimal distance between the given shapes.
2034         #
2035         #  Example: see GEOM_TestMeasures.py
2036         def MinDistanceComponents(self, theShape1, theShape2):
2037             aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
2038             RaiseIfFailed("GetMinDistance", self.MeasuOp)
2039             aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
2040             return aRes
2041
2042         ## Get angle between the given shapes.
2043         #  @param theShape1,theShape2 Lines or linear edges to find angle between.
2044         #  @return Value of the angle between the given shapes.
2045         #
2046         #  Example: see GEOM_TestMeasures.py
2047         def GetAngle(self, theShape1, theShape2):
2048             anAngle = self.MeasuOp.GetAngle(theShape1, theShape2)
2049             RaiseIfFailed("GetAngle", self.MeasuOp)
2050             return anAngle
2051
2052         ## Get min and max tolerances of sub-shapes of theShape
2053         #  @param theShape Shape, to get tolerances of.
2054         #  @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
2055         #  FaceMin,FaceMax: Min and max tolerances of the faces.
2056         #  EdgeMin,EdgeMax: Min and max tolerances of the edges.
2057         #  VertMin,VertMax: Min and max tolerances of the vertices.
2058         #
2059         #  Example: see GEOM_TestMeasures.py
2060         def Tolerance(self,theShape):
2061             aTuple = self.MeasuOp.GetTolerance(theShape)
2062             RaiseIfFailed("GetTolerance", self.MeasuOp)
2063             return aTuple
2064
2065         ## Obtain description of the given shape (number of sub-shapes of each type)
2066         #  @param theShape Shape to be described.
2067         #  @return Description of the given shape.
2068         #
2069         #  Example: see GEOM_TestMeasures.py
2070         def WhatIs(self,theShape):
2071             aDescr = self.MeasuOp.WhatIs(theShape)
2072             RaiseIfFailed("WhatIs", self.MeasuOp)
2073             return aDescr
2074         
2075         ## Get a point, situated at the centre of mass of theShape.
2076         #  @param theShape Shape to define centre of mass of.
2077         #  @return New GEOM_Object, containing the created point.
2078         #
2079         #  Example: see GEOM_TestMeasures.py
2080         def MakeCDG(self,theShape):
2081             anObj = self.MeasuOp.GetCentreOfMass(theShape)
2082             RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
2083             return anObj
2084         
2085         ## Get a normale to the given face. If the point is not given,
2086         #  the normale is calculated at the center of mass.
2087         #  @param theFace Face to define normale of.
2088         #  @param theOptionalPoint Point to compute the normale at.
2089         #  @return New GEOM_Object, containing the created vector.
2090         #
2091         #  Example: see GEOM_TestMeasures.py
2092         def GetNormal(self, theFace, theOptionalPoint = None):
2093             anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
2094             RaiseIfFailed("GetNormal", self.MeasuOp)
2095             return anObj
2096         
2097         ## Check a topology of the given shape.
2098         #  @param theShape Shape to check validity of.
2099         #  @param theIsCheckGeom If FALSE, only the shape's topology will be checked,
2100         #                        if TRUE, the shape's geometry will be checked also.
2101         #  @return TRUE, if the shape "seems to be valid".
2102         #  If theShape is invalid, prints a description of problem.
2103         #
2104         #  Example: see GEOM_TestMeasures.py
2105         def CheckShape(self,theShape, theIsCheckGeom = 0):
2106             if theIsCheckGeom:
2107                 (IsValid, Status) = self.MeasuOp.CheckShapeWithGeometry(theShape)
2108                 RaiseIfFailed("CheckShapeWithGeometry", self.MeasuOp)
2109             else:
2110                 (IsValid, Status) = self.MeasuOp.CheckShape(theShape)
2111                 RaiseIfFailed("CheckShape", self.MeasuOp)
2112             if IsValid == 0:
2113                 print Status
2114             return IsValid
2115         
2116         ## Get position (LCS) of theShape.
2117         #
2118         #  Origin of the LCS is situated at the shape's center of mass.
2119         #  Axes of the LCS are obtained from shape's location or,
2120         #  if the shape is a planar face, from position of its plane.
2121         #
2122         #  @param theShape Shape to calculate position of.
2123         #  @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
2124         #          Ox,Oy,Oz: Coordinates of shape's LCS origin.
2125         #          Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
2126         #          Xx,Xy,Xz: Coordinates of shape's LCS X direction.
2127         #
2128         #  Example: see GEOM_TestMeasures.py
2129         def GetPosition(self,theShape):
2130             aTuple = self.MeasuOp.GetPosition(theShape)
2131             RaiseIfFailed("GetPosition", self.MeasuOp)
2132             return aTuple
2133         
2134         ## Get kind of theShape.
2135         #
2136         #  @param theShape Shape to get a kind of.
2137         #  @return Returns a kind of shape in terms of <VAR>GEOM_IKindOfShape.shape_kind</VAR> enumeration
2138         #          and a list of parameters, describing the shape.
2139         #  @note  Concrete meaning of each value, returned via \a theIntegers
2140         #         or \a theDoubles list depends on the kind of the shape.
2141         #         The full list of possible outputs is:
2142         #
2143         #  geompy.kind.COMPOUND              nb_solids  nb_faces  nb_edges  nb_vertices
2144         #  geompy.kind.COMPSOLID             nb_solids  nb_faces  nb_edges  nb_vertices
2145         #
2146         #  geompy.kind.SHELL       geompy.info.CLOSED   nb_faces  nb_edges  nb_vertices
2147         #  geompy.kind.SHELL       geompy.info.UNCLOSED nb_faces  nb_edges  nb_vertices
2148         #
2149         #  geompy.kind.WIRE        geompy.info.CLOSED             nb_edges  nb_vertices
2150         #  geompy.kind.WIRE        geompy.info.UNCLOSED           nb_edges  nb_vertices
2151         #
2152         #  geompy.kind.SPHERE       xc yc zc            R
2153         #  geompy.kind.CYLINDER     xb yb zb  dx dy dz  R         H
2154         #  geompy.kind.BOX          xc yc zc                      ax ay az
2155         #  geompy.kind.ROTATED_BOX  xc yc zc  zx zy zz  xx xy xz  ax ay az
2156         #  geompy.kind.TORUS        xc yc zc  dx dy dz  R_1  R_2
2157         #  geompy.kind.CONE         xb yb zb  dx dy dz  R_1  R_2  H
2158         #  geompy.kind.POLYHEDRON                       nb_faces  nb_edges  nb_vertices
2159         #  geompy.kind.SOLID                            nb_faces  nb_edges  nb_vertices
2160         #
2161         #  geompy.kind.SPHERE2D     xc yc zc            R
2162         #  geompy.kind.CYLINDER2D   xb yb zb  dx dy dz  R         H
2163         #  geompy.kind.TORUS2D      xc yc zc  dx dy dz  R_1  R_2
2164         #  geompy.kind.CONE2D       xc yc zc  dx dy dz  R_1  R_2  H
2165         #  geompy.kind.DISK_CIRCLE  xc yc zc  dx dy dz  R
2166         #  geompy.kind.DISK_ELLIPSE xc yc zc  dx dy dz  R_1  R_2
2167         #  geompy.kind.POLYGON      xo yo zo  dx dy dz            nb_edges  nb_vertices
2168         #  geompy.kind.PLANE        xo yo zo  dx dy dz
2169         #  geompy.kind.PLANAR       xo yo zo  dx dy dz            nb_edges  nb_vertices
2170         #  geompy.kind.FACE                                       nb_edges  nb_vertices
2171         #
2172         #  geompy.kind.CIRCLE       xc yc zc  dx dy dz  R
2173         #  geompy.kind.ARC_CIRCLE   xc yc zc  dx dy dz  R         x1 y1 z1  x2 y2 z2
2174         #  geompy.kind.ELLIPSE      xc yc zc  dx dy dz  R_1  R_2
2175         #  geompy.kind.ARC_ELLIPSE  xc yc zc  dx dy dz  R_1  R_2  x1 y1 z1  x2 y2 z2
2176         #  geompy.kind.LINE         xo yo zo  dx dy dz
2177         #  geompy.kind.SEGMENT      x1 y1 z1  x2 y2 z2
2178         #  geompy.kind.EDGE                                                 nb_vertices
2179         #
2180         #  geompy.kind.VERTEX       x  y  z
2181         #
2182         #  Example: see GEOM_TestMeasures.py
2183         def KindOfShape(self,theShape):
2184             aRoughTuple = self.MeasuOp.KindOfShape(theShape)
2185             RaiseIfFailed("KindOfShape", self.MeasuOp)
2186              
2187             aKind  = aRoughTuple[0]
2188             anInts = aRoughTuple[1]
2189             aDbls  = aRoughTuple[2]
2190             
2191             # Now there is no exception from this rule:
2192             aKindTuple = [aKind] + aDbls + anInts
2193             
2194             # If they are we will regroup parameters for such kind of shape.
2195             # For example:
2196             #if aKind == kind.SOME_KIND:
2197             #    #  SOME_KIND     int int double int double double
2198             #    aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
2199             
2200             return aKindTuple
2201     
2202         # -----------------------------------------------------------------------------
2203         # Import/Export objects
2204         # -----------------------------------------------------------------------------
2205         
2206         ## Import a shape from the BREP or IGES or STEP file
2207         #  (depends on given format) with given name.
2208         #  @param theFileName The file, containing the shape.
2209         #  @param theFormatName Specify format for the file reading.
2210         #         Available formats can be obtained with InsertOp.ImportTranslators() method.
2211         #  @return New GEOM_Object, containing the imported shape.
2212         #
2213         #  Example: see GEOM_TestOthers.py
2214         def Import(self,theFileName, theFormatName):
2215             anObj = self.InsertOp.Import(theFileName, theFormatName)
2216             RaiseIfFailed("Import", self.InsertOp)
2217             return anObj
2218         
2219         ## Shortcut to Import() for BREP format
2220         #
2221         #  Example: see GEOM_TestOthers.py
2222         def ImportBREP(self,theFileName):
2223             return self.Import(theFileName, "BREP")
2224         
2225         ## Shortcut to Import() for IGES format
2226         #
2227         #  Example: see GEOM_TestOthers.py
2228         def ImportIGES(self,theFileName):
2229             return self.Import(theFileName, "IGES")
2230         
2231         ## Shortcut to Import() for STEP format
2232         #
2233         #  Example: see GEOM_TestOthers.py
2234         def ImportSTEP(self,theFileName):
2235             return self.Import(theFileName, "STEP")
2236         
2237         ## Export the given shape into a file with given name.
2238         #  @param theObject Shape to be stored in the file.
2239         #  @param theFileName Name of the file to store the given shape in.
2240         #  @param theFormatName Specify format for the shape storage.
2241         #         Available formats can be obtained with InsertOp.ImportTranslators() method.
2242         #
2243         #  Example: see GEOM_TestOthers.py
2244         def Export(self,theObject, theFileName, theFormatName):
2245             self.InsertOp.Export(theObject, theFileName, theFormatName)
2246             if self.InsertOp.IsDone() == 0:
2247                 raise RuntimeError,  "Export : " + self.InsertOp.GetErrorCode()
2248                 pass
2249             pass
2250         
2251         ## Shortcut to Export() for BREP format
2252         #
2253         #  Example: see GEOM_TestOthers.py
2254         def ExportBREP(self,theObject, theFileName):
2255             return self.Export(theObject, theFileName, "BREP")
2256         
2257         ## Shortcut to Export() for IGES format
2258         #
2259         #  Example: see GEOM_TestOthers.py
2260         def ExportIGES(self,theObject, theFileName):
2261             return self.Export(theObject, theFileName, "IGES")
2262         
2263         ## Shortcut to Export() for STEP format
2264         #
2265         #  Example: see GEOM_TestOthers.py
2266         def ExportSTEP(self,theObject, theFileName):
2267             return self.Export(theObject, theFileName, "STEP")
2268         
2269         # -----------------------------------------------------------------------------
2270         # Block operations
2271         # -----------------------------------------------------------------------------
2272         
2273         ## Create a quadrangle face from four edges. Order of Edges is not
2274         #  important. It is  not necessary that edges share the same vertex.
2275         #  @param E1,E2,E3,E4 Edges for the face bound.
2276         #  @return New GEOM_Object, containing the created face.
2277         #
2278         #  Example: see GEOM_Spanner.py
2279         def MakeQuad(self,E1, E2, E3, E4):
2280             anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
2281             RaiseIfFailed("MakeQuad", self.BlocksOp)
2282             return anObj
2283         
2284         ## Create a quadrangle face on two edges.
2285         #  The missing edges will be built by creating the shortest ones.
2286         #  @param E1,E2 Two opposite edges for the face.
2287         #  @return New GEOM_Object, containing the created face.
2288         #
2289         #  Example: see GEOM_Spanner.py
2290         def MakeQuad2Edges(self,E1, E2):
2291             anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
2292             RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
2293             return anObj
2294         
2295         ## Create a quadrangle face with specified corners.
2296         #  The missing edges will be built by creating the shortest ones.
2297         #  @param V1,V2,V3,V4 Corner vertices for the face.
2298         #  @return New GEOM_Object, containing the created face.
2299         #
2300         #  Example: see GEOM_Spanner.py
2301         def MakeQuad4Vertices(self,V1, V2, V3, V4):
2302             anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
2303             RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
2304             return anObj
2305         
2306         ## Create a hexahedral solid, bounded by the six given faces. Order of
2307         #  faces is not important. It is  not necessary that Faces share the same edge.
2308         #  @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
2309         #  @return New GEOM_Object, containing the created solid.
2310         #
2311         #  Example: see GEOM_Spanner.py
2312         def MakeHexa(self,F1, F2, F3, F4, F5, F6):
2313             anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
2314             RaiseIfFailed("MakeHexa", self.BlocksOp)
2315             return anObj
2316         
2317         ## Create a hexahedral solid between two given faces.
2318         #  The missing faces will be built by creating the smallest ones.
2319         #  @param F1,F2 Two opposite faces for the hexahedral solid.
2320         #  @return New GEOM_Object, containing the created solid.
2321         #
2322         #  Example: see GEOM_Spanner.py
2323         def MakeHexa2Faces(self,F1, F2):
2324             anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
2325             RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
2326             return anObj
2327         
2328         ## Get a vertex, found in the given shape by its coordinates.
2329         #  @param theShape Block or a compound of blocks.
2330         #  @param theX,theY,theZ Coordinates of the sought vertex.
2331         #  @param theEpsilon Maximum allowed distance between the resulting
2332         #                    vertex and point with the given coordinates.
2333         #  @return New GEOM_Object, containing the found vertex.
2334         #
2335         #  Example: see GEOM_TestOthers.py
2336         def GetPoint(self,theShape, theX, theY, theZ, theEpsilon):
2337             anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
2338             RaiseIfFailed("GetPoint", self.BlocksOp)
2339             return anObj
2340         
2341         ## Get an edge, found in the given shape by two given vertices.
2342         #  @param theShape Block or a compound of blocks.
2343         #  @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
2344         #  @return New GEOM_Object, containing the found edge.
2345         #
2346         #  Example: see GEOM_Spanner.py
2347         def GetEdge(self,theShape, thePoint1, thePoint2):
2348             anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
2349             RaiseIfFailed("GetEdge", self.BlocksOp)
2350             return anObj
2351         
2352         ## Find an edge of the given shape, which has minimal distance to the given point.
2353         #  @param theShape Block or a compound of blocks.
2354         #  @param thePoint Point, close to the desired edge.
2355         #  @return New GEOM_Object, containing the found edge.
2356         #
2357         #  Example: see GEOM_TestOthers.py
2358         def GetEdgeNearPoint(self,theShape, thePoint):
2359             anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
2360             RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
2361             return anObj
2362         
2363         ## Returns a face, found in the given shape by four given corner vertices.
2364         #  @param theShape Block or a compound of blocks.
2365         #  @param thePoint1-thePoint4 Points, close to the corners of the desired face.
2366         #  @return New GEOM_Object, containing the found face.
2367         #
2368         #  Example: see GEOM_Spanner.py
2369         def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
2370             anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
2371             RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
2372             return anObj
2373         
2374         ## Get a face of block, found in the given shape by two given edges.
2375         #  @param theShape Block or a compound of blocks.
2376         #  @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
2377         #  @return New GEOM_Object, containing the found face.
2378         #
2379         #  Example: see GEOM_Spanner.py
2380         def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
2381             anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
2382             RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
2383             return anObj
2384         
2385         ## Find a face, opposite to the given one in the given block.
2386         #  @param theBlock Must be a hexahedral solid.
2387         #  @param theFace Face of \a theBlock, opposite to the desired face.
2388         #  @return New GEOM_Object, containing the found face.
2389         #
2390         #  Example: see GEOM_Spanner.py
2391         def GetOppositeFace(self,theBlock, theFace):
2392             anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
2393             RaiseIfFailed("GetOppositeFace", self.BlocksOp)
2394             return anObj
2395         
2396         ## Find a face of the given shape, which has minimal distance to the given point.
2397         #  @param theShape Block or a compound of blocks.
2398         #  @param thePoint Point, close to the desired face.
2399         #  @return New GEOM_Object, containing the found face.
2400         #
2401         #  Example: see GEOM_Spanner.py
2402         def GetFaceNearPoint(self,theShape, thePoint):
2403             anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
2404             RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
2405             return anObj
2406         
2407         ## Find a face of block, whose outside normale has minimal angle with the given vector.
2408         #  @param theShape Block or a compound of blocks.
2409         #  @param theVector Vector, close to the normale of the desired face.
2410         #  @return New GEOM_Object, containing the found face.
2411         #
2412         #  Example: see GEOM_Spanner.py
2413         def GetFaceByNormale(self,theBlock, theVector):
2414             anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
2415             RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
2416             return anObj
2417         
2418         ## Check, if the compound of blocks is given.
2419         #  To be considered as a compound of blocks, the
2420         #  given shape must satisfy the following conditions:
2421         #  - Each element of the compound should be a Block (6 faces and 12 edges).
2422         #  - A connection between two Blocks should be an entire quadrangle face or an entire edge.
2423         #  - The compound should be connexe.
2424         #  - The glue between two quadrangle faces should be applied.
2425         #  @param theCompound The compound to check.
2426         #  @return TRUE, if the given shape is a compound of blocks.
2427         #  If theCompound is not valid, prints all discovered errors.
2428         #
2429         #  Example: see GEOM_Spanner.py
2430         def CheckCompoundOfBlocks(self,theCompound):
2431             (IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
2432             RaiseIfFailed("CheckCompoundOfBlocks", self.BlocksOp)
2433             if IsValid == 0:
2434                 Descr = self.BlocksOp.PrintBCErrors(theCompound, BCErrors)
2435                 print Descr
2436             return IsValid
2437         
2438         ## Remove all seam and degenerated edges from \a theShape.
2439         #  Unite faces and edges, sharing one surface. It means that
2440         #  this faces must have references to one C++ surface object (handle).
2441         #  @param theShape The compound or single solid to remove irregular edges from.
2442         #  @return Improved shape.
2443         #
2444         #  Example: see GEOM_TestOthers.py
2445         def RemoveExtraEdges(self,theShape):
2446             anObj = self.BlocksOp.RemoveExtraEdges(theShape)
2447             RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
2448             return anObj
2449         
2450         ## Check, if the given shape is a blocks compound.
2451         #  Fix all detected errors.
2452         #    \note Single block can be also fixed by this method.
2453         #  @param theCompound The compound to check and improve.
2454         #  @return Improved compound.
2455         #
2456         #  Example: see GEOM_TestOthers.py
2457         def CheckAndImprove(self,theShape):
2458             anObj = self.BlocksOp.CheckAndImprove(theShape)
2459             RaiseIfFailed("CheckAndImprove", self.BlocksOp)
2460             return anObj
2461         
2462         ## Get all the blocks, contained in the given compound.
2463         #  @param theCompound The compound to explode.
2464         #  @param theMinNbFaces If solid has lower number of faces, it is not a block.
2465         #  @param theMaxNbFaces If solid has higher number of faces, it is not a block.
2466         #    \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
2467         #  @return List of GEOM_Objects, containing the retrieved blocks.
2468         #
2469         #  Example: see GEOM_TestOthers.py
2470         def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
2471             aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces)
2472             RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp)
2473             return aList
2474         
2475         ## Find block, containing the given point inside its volume or on boundary.
2476         #  @param theCompound Compound, to find block in.
2477         #  @param thePoint Point, close to the desired block. If the point lays on
2478         #         boundary between some blocks, we return block with nearest center.
2479         #  @return New GEOM_Object, containing the found block.
2480         #
2481         #  Example: see GEOM_Spanner.py
2482         def GetBlockNearPoint(self,theCompound, thePoint):
2483             anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
2484             RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
2485             return anObj
2486         
2487         ## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
2488         #  @param theCompound Compound, to find block in.
2489         #  @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
2490         #  @return New GEOM_Object, containing the found block.
2491         #
2492         #  Example: see GEOM_TestOthers.py
2493         def GetBlockByParts(self,theCompound, theParts):
2494             anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
2495             RaiseIfFailed("GetBlockByParts", self.BlocksOp)
2496             return anObj
2497         
2498         ## Return all blocks, containing all the elements, passed as the parts.
2499         #  @param theCompound Compound, to find blocks in.
2500         #  @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
2501         #  @return List of GEOM_Objects, containing the found blocks.
2502         #
2503         #  Example: see GEOM_Spanner.py
2504         def GetBlocksByParts(self,theCompound, theParts):
2505             aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
2506             RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
2507             return aList
2508
2509         ## Multi-transformate block and glue the result.
2510         #  Transformation is defined so, as to superpose direction faces.
2511         #  @param Block Hexahedral solid to be multi-transformed.
2512         #  @param DirFace1 ID of First direction face.
2513         #  @param DirFace2 ID of Second direction face.
2514         #  @param NbTimes Quantity of transformations to be done.
2515         #    \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
2516         #  @return New GEOM_Object, containing the result shape.
2517         #
2518         #  Example: see GEOM_Spanner.py
2519         def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
2520             anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
2521             RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
2522             return anObj
2523         
2524         ## Multi-transformate block and glue the result.
2525         #  @param Block Hexahedral solid to be multi-transformed.
2526         #  @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
2527         #  @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
2528         #  @param NbTimesU,NbTimesV Quantity of transformations to be done.
2529         #  @return New GEOM_Object, containing the result shape.
2530         #
2531         #  Example: see GEOM_Spanner.py
2532         def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
2533                                       DirFace1V, DirFace2V, NbTimesV):
2534             anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU,
2535                                                             DirFace1V, DirFace2V, NbTimesV)
2536             RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
2537             return anObj
2538         
2539         ## Build all possible propagation groups.
2540         #  Propagation group is a set of all edges, opposite to one (main)
2541         #  edge of this group directly or through other opposite edges.
2542         #  Notion of Opposite Edge make sence only on quadrangle face.
2543         #  @param theShape Shape to build propagation groups on.
2544         #  @return List of GEOM_Objects, each of them is a propagation group.
2545         #
2546         #  Example: see GEOM_TestOthers.py
2547         def Propagate(self,theShape):
2548             listChains = self.BlocksOp.Propagate(theShape)
2549             RaiseIfFailed("Propagate", self.BlocksOp)
2550             return listChains
2551         
2552         # -----------------------------------------------------------------------------
2553         # Group operations
2554         # -----------------------------------------------------------------------------
2555         
2556         ## Creates a new group which will store sub shapes of theMainShape
2557         #  @param theMainShape is a GEOM object on which the group is selected
2558         #  @param theShapeType defines a shape type of the group
2559         #  @return a newly created GEOM group
2560         #
2561         #  Example: see GEOM_TestOthers.py
2562         def CreateGroup(self,theMainShape, theShapeType):
2563             anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
2564             RaiseIfFailed("CreateGroup", self.GroupOp)
2565             return anObj
2566         
2567         ## Adds a sub object with ID theSubShapeId to the group
2568         #  @param theGroup is a GEOM group to which the new sub shape is added
2569         #  @param theSubShapeID is a sub shape ID in the main object.
2570         #  \note Use method GetSubShapeID() to get an unique ID of the sub shape
2571         #
2572         #  Example: see GEOM_TestOthers.py
2573         def AddObject(self,theGroup, theSubShapeID):
2574             self.GroupOp.AddObject(theGroup, theSubShapeID)
2575             RaiseIfFailed("AddObject", self.GroupOp)
2576             pass
2577         
2578         ## Removes a sub object with ID \a theSubShapeId from the group
2579         #  @param theGroup is a GEOM group from which the new sub shape is removed
2580         #  @param theSubShapeID is a sub shape ID in the main object.
2581         #  \note Use method GetSubShapeID() to get an unique ID of the sub shape
2582         #
2583         #  Example: see GEOM_TestOthers.py
2584         def RemoveObject(self,theGroup, theSubShapeID):
2585             self.GroupOp.RemoveObject(theGroup, theSubShapeID)
2586             RaiseIfFailed("RemoveObject", self.GroupOp)
2587             pass
2588         
2589         ## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
2590         #  @param theGroup is a GEOM group to which the new sub shapes are added.
2591         #  @param theSubShapes is a list of sub shapes to be added.
2592         #
2593         #  Example: see GEOM_TestOthers.py
2594         def UnionList (self,theGroup, theSubShapes):
2595             self.GroupOp.UnionList(theGroup, theSubShapes)
2596             RaiseIfFailed("UnionList", self.GroupOp)
2597             pass
2598         
2599         ## Works like the above method, but argument
2600         #  theSubShapes here is a list of sub-shapes indices
2601         #
2602         #  Example: see GEOM_TestOthers.py
2603         def UnionIDs(self,theGroup, theSubShapes):
2604             self.GroupOp.UnionIDs(theGroup, theSubShapes)
2605             RaiseIfFailed("UnionIDs", self.GroupOp)
2606             pass
2607         
2608         ## Removes from the group all the given shapes. No errors, if some shapes are not included.
2609         #  @param theGroup is a GEOM group from which the sub-shapes are removed.
2610         #  @param theSubShapes is a list of sub-shapes to be removed.
2611         #
2612         #  Example: see GEOM_TestOthers.py
2613         def DifferenceList (self,theGroup, theSubShapes):
2614             self.GroupOp.DifferenceList(theGroup, theSubShapes)
2615             RaiseIfFailed("DifferenceList", self.GroupOp)
2616             pass
2617
2618         ## Works like the above method, but argument
2619         #  theSubShapes here is a list of sub-shapes indices
2620         #
2621         #  Example: see GEOM_TestOthers.py
2622         def DifferenceIDs(self,theGroup, theSubShapes):
2623             self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
2624             RaiseIfFailed("DifferenceIDs", self.GroupOp)
2625             pass
2626         
2627         ## Returns a list of sub objects ID stored in the group
2628         #  @param theGroup is a GEOM group for which a list of IDs is requested
2629         #
2630         #  Example: see GEOM_TestOthers.py
2631         def GetObjectIDs(self,theGroup):
2632             ListIDs = self.GroupOp.GetObjects(theGroup)
2633             RaiseIfFailed("GetObjects", self.GroupOp)
2634             return ListIDs
2635         
2636         ## Returns a type of sub objects stored in the group
2637         #  @param theGroup is a GEOM group which type is returned.
2638         #
2639         #  Example: see GEOM_TestOthers.py
2640         def GetType(self,theGroup):
2641             aType = self.GroupOp.GetType(theGroup)
2642             RaiseIfFailed("GetType", self.GroupOp)
2643             return aType
2644         
2645         ## Returns a main shape associated with the group
2646         #  @param theGroup is a GEOM group for which a main shape object is requested
2647         #  @return a GEOM object which is a main shape for theGroup
2648         #
2649         #  Example: see GEOM_TestOthers.py
2650         def GetMainShape(self,theGroup):
2651             anObj = self.GroupOp.GetMainShape(theGroup)
2652             RaiseIfFailed("GetMainShape", self.GroupOp)
2653             return anObj
2654         
2655         ## Create group of edges of theShape, whose length is in range [min_length, max_length].
2656         #  If include_min/max == 0, edges with length == min/max_length will not be included in result.
2657         def GetEdgesByLength (self,theShape, min_length, max_length, include_min = 1, include_max = 1):
2658             edges = self.SubShapeAll(theShape, ShapeType["EDGE"])
2659             edges_in_range = []
2660             for edge in edges:
2661                 Props = self.BasicProperties(edge)
2662                 if min_length <= Props[0] and Props[0] <= max_length:
2663                     if (not include_min) and (min_length == Props[0]):
2664                         skip = 1
2665                     else:
2666                         if (not include_max) and (Props[0] == max_length):
2667                             skip = 1
2668                         else:
2669                             edges_in_range.append(edge)
2670                             
2671             if len(edges_in_range) <= 0:
2672                 print "No edges found by given criteria"
2673                 return 0
2674             
2675             group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
2676             self.UnionList(group_edges, edges_in_range)
2677             
2678             return group_edges
2679         
2680         ## Create group of edges of selected shape, whose length is in range [min_length, max_length].
2681         #  If include_min/max == 0, edges with length == min/max_length will not be included in result.
2682         def SelectEdges (self,min_length, max_length, include_min = 1, include_max = 1):
2683             nb_selected = sg.SelectedCount()
2684             if nb_selected < 1:
2685                 print "Select a shape before calling this function, please."
2686                 return 0
2687             if nb_selected > 1:
2688                 print "Only one shape must be selected"
2689                 return 0
2690             
2691             id_shape = sg.getSelected(0)
2692             shape = IDToObject( id_shape )
2693             
2694             group_edges = self.GetEdgesByLength(shape, min_length, max_length, include_min, include_max)
2695             
2696             left_str  = " < "
2697             right_str = " < "
2698             if include_min: left_str  = " <= "
2699             if include_max: right_str  = " <= "
2700             
2701             self.addToStudyInFather(shape, group_edges, "Group of edges with " + `min_length`
2702                                     + left_str + "length" + right_str + `max_length`)
2703             
2704             sg.updateObjBrowser(1)
2705             
2706             return group_edges
2707         
2708         ## Add Path to load python scripts from
2709         def addPath(self,Path):
2710             if (sys.path.count(Path) < 1):
2711                 sys.path.append(Path)
2712
2713 import omniORB
2714 #Register the new proxy for GEOM_Gen
2715 omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)