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