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